OFFSET
1,6
COMMENTS
If p is an odd prime then a(p)=1. However, a(n) is also 1 for pseudoprimes to base 2 such as 341.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..101101 (first 1000 terms from Harry J. Smith)
FORMULA
a(n) = A106262(2*n-3, n-2). - G. C. Greubel, Jan 11 2023
EXAMPLE
a(5) = 2^(5-1) mod 5 = 16 mod 5 = 1.
MATHEMATICA
Array[Mod[2^(# - 1), #] &, 105] (* Michael De Vlieger, Jul 01 2018 *)
Array[PowerMod[2, #-1, #]&, 120] (* Harvey P. Dale, May 17 2023 *)
PROG
(PARI) A062173(n) = if(1==n, 0, lift(Mod(2, n)^(n-1))); \\ Antti Karttunen, Jul 01 2018
(Haskell)
import Math.NumberTheory.Moduli (powerMod)
a062173 n = powerMod 2 (n - 1) n -- Reinhard Zumkeller, Oct 17 2015
(Magma) [Modexp(2, n-1, n): n in [1..110]]; // G. C. Greubel, Jan 11 2023
(SageMath) [power_mod(2, n-1, n) for n in range(1, 110)] # G. C. Greubel, Jan 11 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Henry Bottomley, Jun 12 2001
EXTENSIONS
More terms from Antti Karttunen, Jul 01 2018
STATUS
approved