OFFSET
1,3
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = mod(n^n, prime(n)).
EXAMPLE
a(8)=7 because 8^8 is 16777216, the 8th prime is 19 and 16777216 modulo 19 is 7.
MAPLE
a:= n-> n&^n mod ithprime(n):
seq(a(n), n=1..81); # Alois P. Heinz, Mar 20 2019
MATHEMATICA
Table[PowerMod[n, n, Prime[n]], {n, 100}] (* T. D. Noe, Aug 20 2013 *)
PROG
(Magma) [Modexp(n, n, NthPrime(n)): n in [1..100]]; // Vincenzo Librandi, Mar 20 2019
(PARI) a(n) = lift(Mod(n, prime(n))^n); \\ Michel Marcus, Mar 20 2019
CROSSREFS
KEYWORD
AUTHOR
Axel Harvey, Jul 23 2006
EXTENSIONS
More terms from Franklin T. Adams-Watters, Jul 26 2006
STATUS
approved