OFFSET
1,2
LINKS
Project Euler, Problem 429: Sum of Squares of Unitary Divisors.
Wikipedia, Legendre's formula.
FORMULA
a(n) = Sum_{d|n!} (d^2 if gcd(d,n!//d) = 1).
a(n) = Product_{p <= n, p prime} (p^(2*f(n,p)))+1 with f(n,p) = f(floor(n/p)) + floor(n/p) and f(0,p) = 0 where f(n,p) is equivalent to the Legendre formula.
a(n) = A034676(n!).
MATHEMATICA
f[p_, e_] := p^(2*e)+1; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n!]; Array[a, 18] (* Amiram Eldar, Jun 02 2025 *)
PROG
(Python)
from sympy import nextprime
def f(n, p):
if n==0: return 0
return f(n//p, p) + n//p
def a(n):
s, p = 1, 2
while p<=n:
s *= p**(f(n, p)<<1)+1
p = nextprime(p)
return s
print([a(n) for n in range(1, 19)])
(PARI) row(n) = {my(d = divisors(n)); select(x->(gcd(x, n/x)==1), d); } \\ A077610
a(n) = norml2(row(n!)); \\ Michel Marcus, Jun 02 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Darío Clavijo, Jun 02 2025
STATUS
approved
