A202035 Greatest prime residue of x^n (mod n) for x=0..n-1, or 0 if no such prime exists.
0, 0, 2, 0, 3, 3, 5, 0, 0, 5, 7, 0, 11, 11, 13, 0, 13, 0, 17, 5, 13, 11, 19, 0, 7, 23, 0, 0, 23, 19, 29, 0, 31, 19, 31, 0, 31, 23, 31, 0, 37, 7, 41, 37, 37, 41, 43, 0, 31, 0, 47, 29, 47, 0, 43, 0, 37, 53, 53, 0, 59, 59, 0, 0, 61, 37, 61, 17, 67, 29, 67, 0, 71
Offset: 1
Keywords
Examples
a(7) = 3 because k^7 ==0, 1, 2, 3, 4, 5, 6 (mod 7) => 5 is the greatest prime.
Programs
-
Maple
for n from 1 to 100 do: W:={}:for k from 0 to n-1 do:z:= irem(k^n,n): if type(z,prime)=true then W:=W union {z}:else fi:od: x:=nops(W): if x<>0 then printf(`%d, `,W[x]): else printf(`%d, `,0):fi: od: