OFFSET
0,2
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..1000
EXAMPLE
For n=2, the grid with 0..6 by rows is
0 1 2
3 4 5 first column is one longer
6
Reading them by columns gives (0,3,6,1,4,2,5) which as a permutation has order 6, so a(2) = 6.
PROG
(GAP) # GAP / KANT / KASH
# SpartaEncrypt(d, L) returns the list M obtained by writing L in d columns
# and then concatenating these columns
SpartaEncrypt := function(d, L)
local len, i, M;
len := Length(L);
M := [];
for i in [1..d] do
Append(M, L{[i, d+i..d*IntQuo(len-i, d)+i]});
od;
return M;
end;
# SpartaOrd(d, m) computes the order of SpartEncrypt(d, [0..m-1])
# in the group S_m
SpartaOrd := function(d, m)
local L, M, i;
M := [0..m-1];
L := [0..m-1];
i := 0;
repeat
i := i + 1;
L := SpartaEncrypt(d, L);
until L=M;
return i;
end;
d:=3; r:=1;
a := List([0..60], n->SpartaOrd(d, d*n+r));
(PARI)
P(n, w, j)={my(c=j%w); if(c==0, j/w, j\w + c*n + 1)}
Follow(s, f)={my(t=f(s), k=1); while(t>s, k++; t=f(t)); if(s==t, k, 0)}
CyclePoly(n, w, x)={my(q=0); for(i=0, w*n, my(l=Follow(i, j->P(n, w, j))); if(l, q+=x^l)); q}
a(n)={my(q=CyclePoly(n, 3, x), m=1); for(i=1, poldegree(q), if(polcoef(q, i), m=lcm(m, i))); m} \\ Andrew Howroyd, Jan 04 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Roland Miyamoto, Aug 03 2006
STATUS
approved