login
A197943
Greatest residue of x^(n-1) (mod n), x=0..n-1.
2
0, 1, 1, 3, 1, 5, 1, 7, 7, 9, 1, 11, 1, 13, 10, 15, 1, 17, 1, 19, 18, 21, 1, 23, 21, 25, 25, 27, 1, 29, 1, 31, 31, 33, 30, 35, 1, 37, 36, 39, 1, 41, 1, 43, 40, 45, 1, 47, 43, 49, 49, 51, 1, 53, 49, 55, 55, 57, 1, 59, 1, 61, 58, 63, 61, 65, 1, 67, 64, 69, 1, 71, 1, 73, 69, 75, 71, 77, 1, 79, 79, 81, 1, 83, 81, 85, 82, 87, 1, 89, 78
OFFSET
1,4
COMMENTS
a(n) = 1 if n prime and a(n) = n-1 if n even.
LINKS
EXAMPLE
a(8) = 7 because x^7 == 0, 1, 3, 5, 7 (mod 8) => 7 is the greatest residue.
MATHEMATICA
Table[Max[PowerMod[Range[0, n-1], n-1, n]], {n, 100}]
PROG
(PARI) A197943(n) = { my(m=0); for(x=0, n-1, m = max(m, lift(Mod(x^(n-1), n)))); (m); }; \\ Antti Karttunen, Sep 10 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michel Lagneau, Oct 19 2011
EXTENSIONS
More terms added, incorrect PARI-program removed by Antti Karttunen, Sep 10 2018
STATUS
approved