OFFSET
1,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
Multiplicative: If p == 2 (mod 3) then a(p^s) = (p+1)*p^(s-1); if p == 1 (mod 3) then a(p^s) = (p-1)*p^(s-1); a(3^s) = 2*3^s.
From Amiram Eldar, Oct 13 2022: (Start)
Sum_{k=1..n} a(k) ~ c * n^2, where c = 2/(3 * A086724) = 0.853276... . (End)
MATHEMATICA
Eisenstein[1] = 1; Eisenstein[n_] := Length@Select[Flatten[Table[{a, b}, {a, n}, {b, n}], 1], Mod[#[[1]]^2 + #[[2]]^2 - #[[1]]*#[[2]], n] == 1 &]; Array[Eisenstein, 100]
f[p_, e_] := If[Mod[p, 3] == 2, p + 1, p - 1]*p^(e - 1); f[3, e_] := 2*3^e; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Oct 13 2022 *)
PROG
(PARI) a(n) = {my(f = factor(n)); prod(i = 1, #f~, if(f[i, 1] == 3, 2*3^f[i, 2], f[i, 1]^(f[i, 2] - 1) * (f[i, 1] + (-1)^(f[i, 1]%3))))}; \\ Amiram Eldar, Oct 13 2022
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
José María Grau Ribas, Jul 13 2013
STATUS
approved