%I #48 May 18 2022 09:37:59
%S 5,8,9,7,26,17,18,57,80,33,3,18,182,242,65,19,124,1047,1068,728,129,
%T 38,239,1963,1353,1068,2186,257,28,158,239,27216,34967,32318,6560,513,
%U 28,333,4260,109193,284995,82681,110443,19682,1025,14,42,2819,15541,861642,758546,2387947,280182,59048,2049
%N Table T(k, n) of smallest bases b > 1 such that p = prime(n) satisfies b^(p-1) == 1 (mod p^k), read by antidiagonals.
%H Chai Wah Wu, <a href="/A257833/b257833.txt">Table of n, a(n) for n = 2..10000</a>
%e T(3, 5) = 124, since prime(5) = 11 and the smallest b such that b^10 == 1 (mod 11^3) is 124.
%e Table starts
%e k\n| 1 2 3 4 5 6 7
%e ---+----------------------------------------------------------
%e 2 | 5 8 7 18 3 19 38 ...
%e 3 | 9 26 57 18 124 239 158 ...
%e 4 | 17 80 182 1047 1963 239 4260 ...
%e 5 | 33 242 1068 1353 27216 109193 15541 ...
%e 6 | 65 728 1068 34967 284995 861642 390112 ...
%e 7 | 129 2186 32318 82681 758546 6826318 21444846 ...
%e 8 | 257 6560 110443 2387947 9236508 6826318 112184244 ...
%e 9 | 513 19682 280182 14906455 ....
%e 10 | 1025 59048 3626068 ....
%e ...
%o (PARI) for(k=2, 10, forprime(p=2, 25, b=2; while(Mod(b, p^k)^(p-1)!=1, b++); print1(b, ", ")); print(""))
%o (PARI) T(k,n) = my(p=prime(n), v=List([2])); if(n==1, return(2^k+1)); for(i=1, k, w=List([]); for(j=1, #v, forstep(b=v[j], p^i-1, p^(i-1), if(Mod(b, p^i)^p==b, listput(w, b)))); v=Vec(w)); vecmin(v); \\ _Jinyuan Wang_, May 17 2022
%o (Python)
%o from itertools import count, islice
%o from sympy import prime
%o from sympy.ntheory.residue_ntheory import nthroot_mod
%o def A257833_T(n,k): return 2**k+1 if n == 1 else int(nthroot_mod(1,(p:= prime(n))-1,p**k,True)[1])
%o def A257833_gen(): # generator of terms
%o yield from (A257833_T(n,i-n+2) for i in count(1) for n in range(i,0,-1))
%o A257833_list = list(islice(A257833_gen(),50)) # _Chai Wah Wu_, May 17 2022
%Y Column 1 of table is A000051.
%Y Column 2 of table is A024023 (with offset 2).
%Y Column 3 of table is A034939 (with offset 2).
%Y Rows k=2-10 give: A039678, A249275, A353937, A353938, A353939, A353940, A353941, A353942, A353943.
%K nonn,tabl
%O 2,1
%A _Felix Fröhlich_, May 10 2015