%I #35 Nov 01 2020 06:07:32
%S 1,1,2,1,0,3,1,2,0,4,1,3,4,0,5,1,2,9,8,0,6,1,5,4,21,16,0,7,1,2,25,6,
%T 27,20,0,8,1,7,3,125,8,63,32,0,9,1,2,49,4,625,12,81,40,0,10,1,3,4,343,
%U 6,1555,16,147,64,0,11,1,2,9,8,889,8,3125,18,171,80,0,12
%N A(n,k) is the n-th number m that divides k^m - 1 (or 0 if m does not exist); square array A(n,k), n>=1, k>=1, read by antidiagonals.
%H Seiichi Manyama, <a href="/A333432/b333432.txt">Antidiagonals n = 1..25, flattened</a>
%H OEIS Wiki, <a href="/wiki/2^n mod n">2^n mod n</a>
%e Square array A(n,k) begins:
%e 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
%e 2, 0, 2, 3, 2, 5, 2, 7, 2, ...
%e 3, 0, 4, 9, 4, 25, 3, 49, 4, ...
%e 4, 0, 8, 21, 6, 125, 4, 343, 8, ...
%e 5, 0, 16, 27, 8, 625, 6, 889, 10, ...
%e 6, 0, 20, 63, 12, 1555, 8, 2359, 16, ...
%e 7, 0, 32, 81, 16, 3125, 9, 2401, 20, ...
%e 8, 0, 40, 147, 18, 7775, 12, 6223, 32, ...
%e 9, 0, 64, 171, 24, 15625, 16, 16513, 40, ...
%p A:= proc() local h, p; p:= proc() [1] end;
%p proc(n, k) if k=2 then `if`(n=1, 1, 0) else
%p while nops(p(k))<n do for h from 1+p(k)[-1]
%p while k&^h mod h <> 1 do od;
%p p(k):= [p(k)[], h]
%p od; p(k)[n] fi
%p end
%p end():
%p seq(seq(A(n, 1+d-n), n=1..d), d=1..12); # _Alois P. Heinz_, Mar 24 2020
%t A[n_, k_] := Module[{h, p}, p[_] = {1}; If[k == 2, If[n == 1, 1, 0], While[ Length[p[k]] < n, For[h = 1 + p[k][[-1]], Mod[k^h, h] != 1, h++]; p[k] = Append[p[k], h]]; p[k][[n]]]];
%t Table[A[n, 1+d-n], {d, 1, 12}, {n, 1, d}] // Flatten (* _Jean-François Alcover_, Nov 01 2020, after _Alois P. Heinz_ *)
%Y Columns k=1-20 give: A000027, A063524, A067945, A014945, A067946, A014946, A067947, A014949, A068382, A014950, A068383, A014951, A116621, A177805, A014957, A177807, A128358, A333506, A128360.
%Y Main diagonal gives A333433.
%Y Cf. A333429, A333500.
%K nonn,tabl
%O 1,3
%A _Seiichi Manyama_, Mar 21 2020