1,1,2,3,5,8,13...
Given basic Fibonacci sequence (as above) with a1=1 and a2=1 evaluate the GCD of a770 and a1000.
5 point 200
10 Phi=(1+sqrt(5))/2
20 A=int(Phi^770/sqrt(5)+0.5)
30 B=int(Phi^1000/sqrt(5)+0.5)
40 print gcd(A,B)
finds the GCD is 55.
|
Posted by Charlie
on 2020-06-10 19:18:12 |