Interestingly, as I wrote this and made various mistakes, at some point ChatGPT figured out I was trying to implement Fibonacci, and started to emit the right output even though the program wasn't correctly written.