login
A117131
Remainder when n^n is divided by the n-th prime number.
2
1, 1, 2, 4, 1, 12, 12, 7, 2, 6, 24, 26, 11, 6, 30, 15, 9, 41, 39, 32, 51, 64, 78, 4, 72, 43, 89, 25, 31, 109, 26, 62, 80, 36, 9, 72, 132, 140, 105, 52, 132, 135, 117, 147, 79, 193, 93, 49, 175, 76, 64, 187, 196, 9, 163, 221, 190, 62, 102, 280, 71, 87, 102, 268
OFFSET
1,3
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
Sequence in context: A124503 A114499 A030730 * A204117 A184176 A163546
KEYWORD
nonn,look,easy
AUTHOR
Axel Harvey, Jul 23 2006
EXTENSIONS
More terms from Franklin T. Adams-Watters, Jul 26 2006
STATUS
approved