<s>
In	O
number	O
theory	O
,	O
the	O
nth	O
Pisano	B-Algorithm
period	I-Algorithm
,	O
written	O
as	O
(	O
n	O
)	O
,	O
is	O
the	O
period	O
with	O
which	O
the	O
sequence	O
of	O
Fibonacci	B-Algorithm
numbers	I-Algorithm
taken	O
modulo	O
n	O
repeats	O
.	O
</s>
<s>
Pisano	B-Algorithm
periods	I-Algorithm
are	O
named	O
after	O
Leonardo	O
Pisano	O
,	O
better	O
known	O
as	O
Fibonacci	O
.	O
</s>
<s>
The	O
existence	O
of	O
periodic	O
functions	O
in	O
Fibonacci	B-Algorithm
numbers	I-Algorithm
was	O
noted	O
by	O
Joseph	O
Louis	O
Lagrange	O
in	O
1774	O
.	O
</s>
<s>
The	O
Fibonacci	B-Algorithm
numbers	I-Algorithm
are	O
the	O
numbers	O
in	O
the	O
integer	O
sequence	O
:	O
</s>
<s>
For	O
any	O
integer	O
n	O
,	O
the	O
sequence	O
of	O
Fibonacci	B-Algorithm
numbers	I-Algorithm
Fi	O
taken	O
modulo	O
n	O
is	O
periodic	O
.	O
</s>
<s>
The	O
Pisano	B-Algorithm
period	I-Algorithm
,	O
denoted	O
(	O
n	O
)	O
,	O
is	O
the	O
length	O
of	O
the	O
period	O
of	O
this	O
sequence	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
sequence	O
of	O
Fibonacci	B-Algorithm
numbers	I-Algorithm
modulo	O
3	O
begins	O
:	O
</s>
<s>
With	O
the	O
exception	O
of	O
(	O
2	O
)	O
=3	O
,	O
the	O
Pisano	B-Algorithm
period	I-Algorithm
(	O
n	O
)	O
is	O
always	O
even	O
.	O
</s>
<s>
in	O
the	O
general	O
linear	O
group	O
GL2(ℤn )	O
of	O
invertible	O
2	O
by	O
2	O
matrices	B-Architecture
in	O
the	O
finite	O
ring	O
ℤn	O
of	O
integers	O
modulo	O
n	O
.	O
Since	O
Q	O
has	O
determinant	O
−1	O
,	O
the	O
determinant	O
of	O
Q(n )	O
is	O
( −1	O
)	O
(	O
n	O
)	O
,	O
and	O
since	O
this	O
must	O
equal	O
1	O
in	O
ℤn	O
,	O
either	O
n	O
≤	O
2	O
or	O
(	O
n	O
)	O
is	O
even	O
.	O
</s>
<s>
Thus	O
the	O
study	O
of	O
Pisano	B-Algorithm
periods	I-Algorithm
may	O
be	O
reduced	O
to	O
that	O
of	O
Pisano	B-Algorithm
periods	I-Algorithm
of	O
prime	O
powers	O
q	O
=	O
pk	O
,	O
for	O
k	O
≥	O
1	O
.	O
</s>
<s>
So	O
the	O
study	O
of	O
Pisano	B-Algorithm
periods	I-Algorithm
may	O
be	O
further	O
reduced	O
to	O
that	O
of	O
Pisano	B-Algorithm
periods	I-Algorithm
of	O
primes	O
.	O
</s>
<s>
The	O
prime	O
2	O
has	O
an	O
odd	O
Pisano	B-Algorithm
period	I-Algorithm
,	O
and	O
the	O
prime	O
5	O
has	O
period	O
that	O
is	O
relatively	O
much	O
larger	O
than	O
the	O
Pisano	B-Algorithm
period	I-Algorithm
of	O
any	O
other	O
prime	O
.	O
</s>
<s>
That	O
is	O
r	O
2( p+1	O
)	O
=	O
1	O
,	O
and	O
the	O
Pisano	B-Algorithm
period	I-Algorithm
,	O
which	O
is	O
the	O
order	O
of	O
r	O
,	O
is	O
the	O
quotient	O
of	O
2( p+1	O
)	O
by	O
an	O
odd	O
divisor	O
.	O
</s>
<s>
The	O
first	O
twelve	O
Pisano	B-Algorithm
periods	I-Algorithm
and	O
their	O
cycles	O
(	O
with	O
spaces	O
before	O
the	O
zeros	O
for	O
readability	O
)	O
are	O
(	O
using	O
hexadecimal	O
cyphers	O
A	O
and	O
B	O
for	O
ten	O
and	O
eleven	O
,	O
respectively	O
)	O
:	O
</s>
<s>
The	O
first	O
144	O
Pisano	B-Algorithm
periods	I-Algorithm
are	O
shown	O
in	O
the	O
following	O
table	O
:	O
</s>
<s>
That	O
is	O
,	O
if	O
the	O
modulo	O
base	O
is	O
a	O
Fibonacci	B-Algorithm
number	I-Algorithm
( ≥3	O
)	O
with	O
an	O
even	O
index	O
,	O
the	O
period	O
is	O
twice	O
the	O
index	O
and	O
the	O
cycle	O
has	O
two	O
zeros	O
.	O
</s>
<s>
If	O
the	O
base	O
is	O
a	O
Fibonacci	B-Algorithm
number	I-Algorithm
( ≥5	O
)	O
with	O
an	O
odd	O
index	O
,	O
the	O
period	O
is	O
four	O
times	O
the	O
index	O
and	O
the	O
cycle	O
has	O
four	O
zeros	O
.	O
</s>
<s>
That	O
is	O
,	O
if	O
the	O
modulo	O
base	O
is	O
a	O
Lucas	B-Algorithm
number	I-Algorithm
( ≥3	O
)	O
with	O
an	O
even	O
index	O
,	O
the	O
period	O
is	O
four	O
times	O
the	O
index	O
.	O
</s>
<s>
If	O
the	O
base	O
is	O
a	O
Lucas	B-Algorithm
number	I-Algorithm
( ≥4	O
)	O
with	O
an	O
odd	O
index	O
,	O
the	O
period	O
is	O
twice	O
the	O
index	O
.	O
</s>
<s>
For	O
generalized	O
Fibonacci	B-Algorithm
sequences	I-Algorithm
(	O
satisfying	O
the	O
same	O
recurrence	O
relation	O
,	O
but	O
with	O
other	O
initial	O
values	O
,	O
e.g.	O
</s>
<s>
the	O
Lucas	B-Algorithm
numbers	I-Algorithm
)	O
the	O
number	O
of	O
occurrences	O
of	O
0	O
per	O
cycle	O
is	O
0	O
,	O
1	O
,	O
2	O
,	O
or	O
4	O
.	O
</s>
<s>
The	O
ratio	O
of	O
the	O
Pisano	B-Algorithm
period	I-Algorithm
of	O
n	O
and	O
the	O
number	O
of	O
zeros	O
modulo	O
n	O
in	O
the	O
cycle	O
gives	O
the	O
rank	O
of	O
apparition	O
or	O
Fibonacci	O
entry	O
point	O
of	O
n	O
.	O
That	O
is	O
,	O
smallest	O
index	O
k	O
such	O
that	O
n	O
divides	O
F(k )	O
.	O
</s>
<s>
See	O
also	O
generalizations	B-Algorithm
of	I-Algorithm
Fibonacci	I-Algorithm
numbers	I-Algorithm
.	O
</s>
<s>
Pisano	B-Algorithm
periods	I-Algorithm
can	O
be	O
analyzed	O
using	O
algebraic	O
number	O
theory	O
.	O
</s>
<s>
Let	O
be	O
the	O
n-th	O
Pisano	B-Algorithm
period	I-Algorithm
of	O
the	O
k-Fibonacci	O
sequence	O
Fk(n )	O
(	O
k	O
can	O
be	O
any	O
natural	O
number	O
,	O
these	O
sequences	O
are	O
defined	O
as	O
Fk(0 )	O
=	O
0	O
,	O
Fk(1 )	O
=	O
1	O
,	O
and	O
for	O
any	O
natural	O
number	O
n	O
>	O
1	O
,	O
Fk(n )	O
=	O
kFk( n−1	O
)	O
+	O
Fk( n−2	O
)	O
)	O
.	O
</s>
<s>
For	O
example	O
,	O
and	O
so	O
Thus	O
it	O
suffices	O
to	O
compute	O
Pisano	B-Algorithm
periods	I-Algorithm
for	O
prime	O
powers	O
(	O
Usually	O
,	O
,	O
unless	O
p	O
is	O
k-Wall	O
–	O
Sun	O
–	O
Sun	O
prime	O
,	O
or	O
k-Fibonacci	O
–	O
Wieferich	O
prime	O
,	O
that	O
is	O
,	O
p2	O
divides	O
Fk( p−1	O
)	O
or	O
Fk( p+1	O
)	O
,	O
where	O
Fk	O
is	O
the	O
k-Fibonacci	O
sequence	O
,	O
for	O
example	O
,	O
241	O
is	O
a	O
3-Wall	O
–	O
Sun	O
–	O
Sun	O
prime	O
,	O
since	O
2412	O
divides	O
F3(242 )	O
.	O
)	O
</s>
<s>
If	O
k2+4	O
is	O
a	O
quadratic	O
residue	O
modulo	O
p	O
(	O
where	O
p	O
>	O
2	O
and	O
p	O
does	O
not	O
divide	O
k2+4	O
)	O
,	O
then	O
and	O
can	O
be	O
expressed	O
as	O
integers	O
modulo	O
p	O
,	O
and	O
thus	O
Binet	O
's	O
formula	O
can	O
be	O
expressed	O
over	O
integers	O
modulo	O
p	O
,	O
and	O
thus	O
the	O
Pisano	B-Algorithm
period	I-Algorithm
divides	O
the	O
totient	O
,	O
since	O
any	O
power	O
(	O
such	O
as	O
)	O
has	O
period	O
dividing	O
as	O
this	O
is	O
the	O
order	O
of	O
the	O
group	O
of	O
units	O
modulo	O
p	O
.	O
</s>
<s>
If	O
k2+4	O
is	O
not	O
a	O
quadratic	O
residue	O
modulo	O
p	O
,	O
then	O
Binet	O
's	O
formula	O
is	O
instead	O
defined	O
over	O
the	O
quadratic	O
extension	O
field	O
,	O
which	O
has	O
p2	O
elements	O
and	O
whose	O
group	O
of	O
units	O
thus	O
has	O
order	O
p21	O
,	O
and	O
thus	O
the	O
Pisano	B-Algorithm
period	I-Algorithm
divides	O
p21	O
.	O
</s>
<s>
For	O
p	O
=	O
2	O
,	O
is	O
congruent	O
to	O
1	O
mod2	O
(	O
for	O
k	O
odd	O
)	O
,	O
but	O
the	O
Pisano	B-Algorithm
period	I-Algorithm
is	O
not	O
p−1	O
=	O
1	O
,	O
but	O
rather3	O
(	O
in	O
fact	O
,	O
this	O
is	O
also	O
3	O
for	O
even	O
k	O
)	O
.	O
</s>
<s>
For	O
p	O
divides	O
the	O
squarefree	O
part	O
of	O
k2+4	O
,	O
the	O
Pisano	B-Algorithm
period	I-Algorithm
is	O
πk( k2+4	O
)	O
=	O
p2−p	O
=	O
p( p−1	O
)	O
,	O
which	O
does	O
not	O
divide	O
p−1	O
or	O
p2−1	O
.	O
</s>
<s>
One	O
can	O
consider	O
Fibonacci	O
integer	O
sequences	O
and	O
take	O
them	O
modulo	O
n	O
,	O
or	O
put	O
differently	O
,	O
consider	O
Fibonacci	B-Algorithm
sequences	I-Algorithm
in	O
the	O
ring	O
Z/nZ	O
.	O
</s>
