OFFSET
1,1
COMMENTS
Is this a permutation of the positive integers > 1?
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
MAPLE
g:= proc() false end:
a:= proc(n) option remember; local b, p, pm, pp;
if n>0 then a(n-1); p:= ithprime(n); pm:=p-1; pp:= p^2;
for b from 2 while g(b) or b &^ pm mod pp <> 1 do od;
g(b):= true; b fi
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jul 20 2015
MATHEMATICA
f[n_] := f[n] = Block[{b = 2, p = Prime@ n, lst = Array[f, n - 1]}, While[ PowerMod[b, p - 1, p^2] != 1 || MemberQ[lst, b], b++]; b]; Array[f, 60] (* Robert G. Wilson v, Jul 12 2015 *)
PROG
(PARI) v=vector(1); forprime(p=1, 50, b=2; while(Mod(b, p^2)^(p-1)!=1, b++; if(Mod(b, p^2)^(p-1)==1, for(k=1, #v, if(b==v[k], b++)))); v=concat(v, b); print1(v[#v], ", "))
(PARI) A259234=List(); for(n=1, 500, my(p=prime(n), b=1); until(Mod(b++, p^2)^(p-1)==1 && !setsearch(Set(A259234), b), ); listput(A259234, b); /*print1(b", ")*/) \\ M. F. Hasler, Jul 20 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Felix Fröhlich, Jun 29 2015
STATUS
approved