OFFSET
1,1
COMMENTS
An Euler pseudoprime to the base b is a composite number k which satisfies b^((k-1)/2) == +-1 (mod k).
LINKS
Eric Weisstein's World of Mathematics, Euler Pseudoprime.
FORMULA
a(n) = 9 for n == 1 or 8 (mod 9).
PROG
(PARI) a(n) = my(m); forcomposite(k=3, oo, if(k%2 && ((m=Mod(n, k)^(k\2))==1 || m==k-1), return(k)));
(Python)
from sympy import isprime
from itertools import count
def a(n): return next(k for k in count(3, 2) if not isprime(k) and ((r:=pow(n, (k-1)//2, k)) == 1 or r == k-1))
print([a(n) for n in range(1, 67)]) # Michael S. Branicky, Jun 03 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Jinyuan Wang, Jun 03 2022
STATUS
approved