Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. N = int(input("value of N: "))
  2. fibo = [0,1]
  3. sequence = [1,2]
  4. i = 1
  5. if N == 2 :
  6.         print(sequence)
  7. elif N == 1:
  8.         print (sequence[0])
  9. while(sequence[i] < N):
  10.         i += 1
  11.         fibo.append(fibo[i - 1] + fibo[i - 2])
  12.         sequence.append(sequence[i-1] + fibo[i]**2)
  13.  
  14. print(sequence)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement