PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def fib(x):
if(x==0):
global ax
ax=0
return 0
elif(x==1):
global bx
bx=1
return 1
else:
global cx
cx=ax+bx
ax=bx
bx=cx
return (cx)
ax=bx=cx=0
n=int(input())
leave=tempx=numa=numb=finalanswer=x=finaldigit=0
a=[]
finaldigit=[]
while(leave==0):
a.append((fib(x)%n))
if((x+1)%2==0):
tempx=int(x/2)
if(a[0:(tempx+1)]==a[(tempx+1):len(a)]):
leave=1
finalanswer=tempx
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run