Pisano Period

Author

Eric W. Weisstein
July 1, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/PisanoPeriod.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/PisanoPeriod.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Pisano Periods

Timing[pisano=Period/@Table[Mod[Table[Fibonacci[n],{n,5000}],k],{k,1000}];]

max=If[p=Position[pisano,0,1,1]=={},Length[pisano],p[[1,1]]]

Table[{n,Position[pisano,n]//Flatten},{n,2,100,2}]//ColumnForm

<<Graphics`Graphics`;

m=Max[Take[pisano,max]];
Show[Histogram[pisano,
HistogramCategories->Range[m+1],Ticks->{Transpose[{Range[m]+.5,Range[m]}],Automatic},
DisplayFunction->Identity],PlotRange->{{1,m+1},All},
AxesOrigin->{1,0},
Frame->True,
DisplayFunction->$DisplayFunction]

m=100;
Show[Histogram[pisano/2,
HistogramCategories->Range[m/2+1],Ticks->{Transpose[{Range[m/2]+.5,Range[1,m,2]}],Automatic},
DisplayFunction->Identity],PlotRange->{{1,m/2+1},All},
AxesOrigin->{1,0},
Frame->True,
DisplayFunction->$DisplayFunction]

π[m]==m

Position[Equal@@@MapIndexed[{#1,Sequence@@#2}&,Take[pisano,max]],True]//Flatten

Last Digit

l=Fibonacci[Range[10^5]];//Timing

Function[d,Period[IntegerDigits[#,10,d]&/@l]]/@Range[3]//Timing

Function[d,Period[IntegerDigits[#,10,d]&/@l]]/@Range[4]//Timing

Table[15 (10^(d-1)),{d,6}]