OFFSET
1,4
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..10000
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
José María Grau Ribas, Sep 22 2013
STATUS
approved