OFFSET
1,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
a(6) = 12 since 6 has 4 divisors, 1, 2, 3 and 6, all of them are of the form x^2 + 2*y^2: 1 = 1^2 + 2*0^2, 2 = 0^2 + 2*1^2, 3 = 1^2 + 2*1^2, and 6 = 2^2 + 2*1^2, and their sum is 1 + 2 + 3 + 6 = 12.
MATHEMATICA
f[p_, e_] := If[Mod[p, 8] > 4, (p^(2*(Floor[e/2] + 1)) - 1)/(p^2 - 1), (p^(e + 1) - 1)/(p - 1)]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100]
PROG
(PARI) a(n) = {my(f = factor(n)); prod(i = 1, #f~, if(f[i, 1]%8 > 4, (f[i, 1]^(2*(f[i, 2]\2 + 1)) - 1)/(f[i, 1]^2 - 1), (f[i, 1]^(f[i, 2] + 1) - 1)/(f[i, 1] - 1))); }
CROSSREFS
KEYWORD
nonn,mult,easy
AUTHOR
Amiram Eldar, Dec 02 2025
STATUS
approved
