OFFSET
1,3
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..838
Wikipedia, Primitive root modulo n.
MATHEMATICA
Table[Times @@ PrimitiveRootList[n], {n, 42}] (* Michael De Vlieger, Apr 07 2025 *)
PROG
(Python)
from sympy import gcd, primitive_root, totient
def a(n):
try:
g = primitive_root(n)
except ValueError:
return 1
P = 1
if g:
phi = totient(n)
for k in range(1, phi):
if gcd(k, phi) == 1:
P *= pow(g, k, n)
return P
print([a(n) for n in range(1, 43)])
CROSSREFS
KEYWORD
nonn
AUTHOR
Darío Clavijo, Mar 27 2025
STATUS
approved
