1Math::NumSeq::PisanoPerUisoedr(3C)ontributed Perl DocumeMnattaht:i:oNnumSeq::PisanoPeriod(3)
2
3
4

NAME

6       Math::NumSeq::PisanoPeriod -- cycle length of Fibonacci numbers mod i
7

SYNOPSIS

9        use Math::NumSeq::PisanoPeriod;
10        my $seq = Math::NumSeq::PisanoPeriod->new;
11        my ($i, $value) = $seq->next;
12

DESCRIPTION

14       This is the length cycle of Fibonacci numbers modulo i.
15
16           1, 3, 8, 6, 20, 24, 16, 12, 24, 60, 10, 24, 28, 48, 40, ...
17           starting i=1
18
19       For example Fibonacci numbers modulo 4 repeat in a cycle of 6 numbers,
20       so value=6.
21
22          Fibonacci  0, 1, 1, 2, 3, 5, 8,13,21,34,55,89,144,...
23          mod 4      0, 1, 1, 2, 3, 1, 0, 1, 1, 2, 3, 1, 0,...
24                     \--------------/  \--------------/  \---
25                   repeating cycle of 6
26
27       The Fibonaccis are determined by a pair F[i],F[i+1] and there can be at
28       most i*i many different pairs mod i, so there's always a finite
29       repeating period.  Since the Fibonaccis can go backwards as
30       F[i-1]=F[i+1]-F[i] the modulo sequence is purely periodic, so the
31       initial 0,1 is always part of the cycle.
32

FUNCTIONS

34       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
35       classes.
36
37       "$seq = Math::NumSeq::PisanoPeriod->new ()"
38           Create and return a new sequence object.
39
40   Random Access
41       "$value = $seq->ith($i)"
42           Return the Pisano period of $i.
43

SEE ALSO

45       Math::NumSeq, Math::NumSeq::Fibonacci, Math::NumSeq::FibonacciWord
46

HOME PAGE

48       <http://user42.tuxfamily.org/math-numseq/index.html>
49

LICENSE

51       Copyright 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
52
53       Math-NumSeq is free software; you can redistribute it and/or modify it
54       under the terms of the GNU General Public License as published by the
55       Free Software Foundation; either version 3, or (at your option) any
56       later version.
57
58       Math-NumSeq is distributed in the hope that it will be useful, but
59       WITHOUT ANY WARRANTY; without even the implied warranty of
60       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
61       General Public License for more details.
62
63       You should have received a copy of the GNU General Public License along
64       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
65
66
67
68perl v5.36.0                      2023-01-20     Math::NumSeq::PisanoPeriod(3)
Impressum