Oddly enough, my code is giving me the 4781st number, when I know it is the 4782nd Fibonacci Number (I was comparing with a friend). I don't want to submit until my code can do it though.
Here's my code:
import sys
FibNums = []
a=1
b=2
c=3
FibNums.append(a)
FibNums.append(b)
FibNums.append(c)
for i in range(1, sys.maxsize):
a = b
b = c
c = a + b
FibNums.append(c)
if len(str(c)) == 1000:
break
print (len(FibNums))
Can anyone help me find the error? I checked and my list doesn't skip anything (it does actually contain 1 as the 1st index). Thanks!