%I #26 May 20 2019 15:31:02
%S 1,7,26,14,62,182,42,28,78,434,266,182,12,42,806,56,614,546,254,434,
%T 546,266,1106,364,310,84,234,42,28,5642,1986,112,3458,4298,1302,546,
%U 2814,1778,156,868,40,546,42,266,2418,1106,4514,728,294,2170,7982,84,5726,1638,8246,84,3302,28,7082,5642,582
%N Pisano period of sequence A006054 modulo n.
%H Robert Israel, Mathematics StackExchange, <a href="https://math.stackexchange.com/questions/2322702">When does x^3-x^2-2x+1 split mod p</a>.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Pisano_period">Pisano period</a>.
%F From _Robert Israel_, Jun 14 2017: (Start)
%F If m and n are coprime, a(m*n) = lcm(a(m),a(n)).
%F If p is a prime such that the polynomial x^3-x^2-2*x+1 splits into distinct factors mod p, then a(p) divides p-1. These primes are A045472. (End)
%p f:= proc(n) option remember; local F, t, k, a;
%p F:= ifactors(n)[2];
%p if nops(F) > 1 then
%p return(ilcm(seq(procname(t[1]^t[2]),t=F)))
%p fi;
%p a:= [0,0,1];
%p for k from 1 do
%p a:= [a[2],a[3],2*a[3]+a[2]-a[1] mod n];
%p if a = [0,0,1] then return k fi;
%p od:
%p end proc:
%p f(1):= 1:
%p map(f, [$1..100]); # _Robert Israel_, Jun 14 2017
%t Table[FindTransientRepeat[
%t Mod[LinearRecurrence[{2, 1, -1}, {0, 0, 1}, 100000], n], 2] //
%t Last // Length, {n, 1, 20}]
%Y Cf. A001175 Pisano periods of Fibonacci numbers mod n.
%Y Cf. A045472.
%K nonn
%O 1,2
%A _Patrick D McLean_, Apr 02 2017
%E More terms from _Robert Israel_, Jun 14 2017
|