login
A355858
a(n) = n^(2*n-1) mod (2*n-1).
0
0, 2, 3, 4, 8, 6, 7, 2, 9, 10, 8, 12, 18, 26, 15, 16, 29, 2, 19, 5, 21, 22, 8, 24, 18, 32, 27, 32, 50, 30, 31, 8, 63, 34, 26, 36, 37, 32, 30, 40, 80, 42, 8, 11, 45, 32, 35, 22, 49, 35, 51, 52, 8, 54, 55, 14, 57, 87, 8, 2, 94, 77, 68, 64, 113, 66, 53, 107, 69
OFFSET
1,2
COMMENTS
If a(n) = n then 2*n-1 is prime or Fermat pseudoprime to base 2.
MATHEMATICA
a[n_] := PowerMod[n, 2*n - 1, 2*n - 1]; Array[a, 100] (* Amiram Eldar, Jul 23 2022 *)
PROG
(PARI) a(n)=n^(2*n-1)%(2*n-1)
(PARI) a(n)=lift(Mod(n, 2*n-1)^(2*n-1)) \\ Rémy Sigrist, Jul 21 2022
(Python)
def a(n): return pow(n, 2*n-1, 2*n-1)
print([a(n) for n in range(1, 70)]) # Michael S. Branicky, Jul 23 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Jonas Kaiser, Jul 20 2022
STATUS
approved