OFFSET
1,2
COMMENTS
Let k be a positive integer and consider the Pisano cycle of Fibonacci numbers modulo k. We define the "Pisano cycle modulo k shape" to be the 2-dimensional shape obtained by applying the following process:
Step 1: Start from the origin of a 2-dimensional grid.
Step 2: Consider the first number of the Pisano cycle: if it's 0, then stay still in the position you were before; otherwise, if it's even, then turn 90 degrees counterclockwise and take a 1-unit step; if it's odd, then turn 90 degrees clockwise and take a 1-unit step.
Step 3: Continue this process for all the numbers in the Pisano cycle modulo n.
Step 4: When you have applied the above rules to all the numbers, repeat the entire process again and again, each time starting from the position where the previous iteration ended.
Some shapes seem to repeat; for example, the shapes associated with k = 6, 12, 14 are the same.
The condition for being bounded is that after processing one iteration of the Pisano cycle then either current direction must be different from the initial direction or the current position must be the origin.
LINKS
Luca Onnis, Shape for n = 14
Luca Onnis, Shape for n = 499
Luca Onnis, Shape for n = 751
Luca Onnis, JavaScript p5 code for the graphic of the shape
Jacob Yatsko, A new way to look at Fibonacci numbers (23 Feb 2020).
EXAMPLE
For k = 2 the Pisano Cycle modulo 2 of the Fibonacci numbers is (1,1,0) and the shape obtained by iterating the process described above is a 1-unit square, which is bounded, so a(2) = 2.
PROG
(PARI) \\ P(n) gives n-th row of A161553.
P(n)={my(L=List([0]), X=Mod([1, 1; 1, 0], n), I=Mod([1, 0; 0, 1], n), M=X, k=1); while(M<>I, k++; M*=X; listput(L, lift(M[2, 2]))); Vec(L)}
isok(n)={my(s=P(n), x=0, y=0, dx=1, dy=0, t); for(i=1, #s, if(s[i], [dx, dy]=if(s[i]%2, [dy, -dx], [-dy, dx]); x+=dx; y+=dy)); (x==0&&y==0) || dx!=1}
select(isok, [1..100]) \\ Andrew Howroyd, Mar 05 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Luca Onnis, Mar 05 2023
STATUS
approved