A227501 Number of non-congruent solutions of x^2 - xy + y^2 == 1 (mod n).
1, 3, 6, 6, 6, 18, 6, 12, 18, 18, 12, 36, 12, 18, 36, 24, 18, 54, 18, 36, 36, 36, 24, 72, 30, 36, 54, 36, 30, 108, 30, 48, 72, 54, 36, 108, 36, 54, 72, 72, 42, 108, 42, 72, 108, 72, 48, 144, 42, 90, 108, 72, 54, 162, 72, 72, 108, 90, 60, 216, 60, 90, 108, 96
Offset: 1
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Programs
-
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 *)
-
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
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)