login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the product of the distinct nonzero quadratic residues of n.
3

%I #35 May 30 2024 11:47:44

%S 1,1,1,1,4,12,8,4,28,1080,540,36,12960,44352,2160,36,1797120,524160,

%T 22619520,2880,1088640,4790016000,465813504,6912,5096577024,

%U 8115883776000,5477472000,2419200,267346759680000,124104960000,216218419200000,244800,143187264000

%N a(n) is the product of the distinct nonzero quadratic residues of n.

%F a(n) mod n = A232195(n).

%F a(n) = Product_{k=1..n} A046071(n,k).

%o (Python)

%o from sympy import prod

%o def a(n):

%o k, QS = 0,[]

%o for i in range((n >> 1) + 1):

%o if k > 0: QS.append(k)

%o k += (i << 1) + 1

%o k %= n

%o return prod(set(QS))

%o print([a(n) for n in range(1, 34)])

%o (Python)

%o from math import prod

%o from sympy.ntheory.residue_ntheory import quadratic_residues

%o def A372651(n): return prod(r for r in quadratic_residues(n) if r) # _Chai Wah Wu_, May 30 2024

%o (PARI) a(n) = my(list=List()); for (i=1, n-1, if (issquare(Mod(i, n)), listput(list, i))); vecprod(Vec(list)); \\ _Michel Marcus_, May 28 2024

%Y Cf. A046071, A105612, A165909, A230366, A232195.

%K nonn

%O 1,5

%A _DarĂ­o Clavijo_, May 27 2024