Conclusion: gcd(F[n],F[m])=F[gcd(n,m)];
F[n]=a and F[n+1]=b
F[n+2]=a+b ,F[n+3]=a+2b,…F[m]=F[m?n?1]a+F[m?n]b
F[n]=a,F[n+1]=b ,F[m]=F[m?n?1]a+F[m?n]
F[m]=F[m?n?1]?F[n]+F[m?n]?F[ n+1]
gcd(F[n],F[m])=gcd(F[n],F[m?n?1]?F[n]+F[m?n]?F[n+1 ])
gcd(F[n],F[m])=gcd(F[n],F[m?n]?F[n+1])
Lemma: gcd(F[n],F[n+ 1])=1
Proof: gcd(F[n],F[n+1])=gcd(F[n],F[n+1]?F[n])=gcd(F[n],F [n?1])=...=gcd(f[1],f[2]);
gcd(F[n],F[n+1])=1;
gcd(F[n] ,F[m])=gcd(F[n],F[m?n]?F[n+1]);
gcd(F[n],F[m])=gcd(F[n],F [m?n]);
that is, gcd(F[n], F[m])=gcd(F[n], F[mmodn]);
then gcd(F[n], F[m])=gcd( F[nmodm1],F[m1]);
It is not difficult to find that the whole recursive process is actually solving gcd(n,m)
and finally recursing until F[0] appears, then f[n] at this time is the answer;
gcd( F[n],F[m])=F[gcd(n,m)];
转载于:https://www.cnblogs.com/kamimxr/p/11544191.html