login
A229297
Number of solutions to x^2 == n (mod 2*n) for 0 <= x < 2*n.
4
1, 0, 1, 2, 1, 0, 1, 0, 3, 0, 1, 2, 1, 0, 1, 4, 1, 0, 1, 2, 1, 0, 1, 0, 5, 0, 3, 2, 1, 0, 1, 0, 1, 0, 1, 6, 1, 0, 1, 0, 1, 0, 1, 2, 3, 0, 1, 4, 7, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 3, 8, 1, 0, 1, 2, 1, 0, 1, 0, 1, 0, 5, 2, 1, 0, 1, 4, 9, 0, 1, 2, 1, 0
OFFSET
1,4
LINKS
FORMULA
From Andrew Howroyd, Aug 07 2018: (Start)
Multiplicative with a(2^e) = 0 for odd e and 2^floor(e/2) for even e, and a(p^e) = p^floor(e/2) for p>=3. [corrected by Georg Fischer, Aug 01 2022].
a(n) = A000188(n) for odd n, a(2^k) = 1 + (-1)^k for k > 0. (End)
From Amiram Eldar, Jan 01 2023: (Start)
Dirichlet g.f.: zeta(2*s-1)*zeta(s)/(zeta(2*s)*(1+1/2^s)).
Sum_{k=1..n} a(k) ~ (n*log(n) + (3*gamma + log(2)/3 - 2*zeta'(2)/zeta(2) - 1)*n)*2/Pi^2, where gamma is Euler's constant (A001620). (End)
MATHEMATICA
A[n_] := Sum[If[Mod[a^2, 2*n] == n, 1, 0], {a, 0, 2*n - 1}]; Array[A, 100]
f[p_, e_] := If[OddQ[e], p^((e - 1)/2), p^(e/2)]; f[2, e_] := If[OddQ[e], 0, 2^(e/2)]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Jan 01 2023 *)
PROG
(PARI) a(n)={sum(i=0, 2*n-1, i^2%(2*n)==n)} \\ Andrew Howroyd, Aug 06 2018
(PARI) a(n)={if(valuation(n, 2)%2==1, 0, core(n, 1)[2])} \\ Andrew Howroyd, Aug 07 2018
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
STATUS
approved