OFFSET
1,8
COMMENTS
a(n) = 1 if either n or -n is a fundamental discriminant (not both); a(n) = 2 if n and -n are fundamental discriminants; a(n) = 0 otherwise. Also, Sum_{k=1..n} a(k) is asymptotic to (6/Pi^2)*n.
From Jianing Song, Feb 27 2019: (Start)
If n is an odd squarefree number, then a(n) = 1, where the unique real primitive Dirichlet character modulo n is {Kronecker(n,k)} = {Jacobi(k,n)} if n == 1 (mod 4) and {Kronecker(-n,k)} = {Jacobi(k,n)} if n == 3 (mod 4).
If n = 4*m, m is an odd squarefree number, then a(n) is also 1, where the unique real primitive Dirichlet character modulo n is {Kronecker(-n,k)} if m == 1 (mod 4) and {Kronecker(n,k)} if m == 3 (mod 4).
If n is 8 times an odd squarefree number, then a(n) = 2, where the two real primitive Dirichlet characters modulo n are {Kronecker(n,k)} and {Kronecker(-n,k)}.
a(n) = 0 if n == 2 (mod 4), n is divisible by 16 or the square of an odd prime. (End)
Mobius transform of A060594. - Jianing Song, Mar 02 2019
REFERENCES
W. Ellison and F. Ellison, Prime Numbers, Wiley, 1985, pp. 224-226.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Steven R. Finch, Cubic and quartic characters [Broken link]
Steven R. Finch, Cubic and quartic characters.
Vaclav Kotesovec, Graph - the asymptotic ratio
Eric Weisstein's World of Mathematics, Dirichlet L-Series.
I. J. Zucker and M. M. Robertson, Some properties of Dirichlet L-series, J. Phys. A 9 (1976) 1207-1214.
FORMULA
This sequence is multiplicative with a(2) = 0, a(4) = 1, a(8) = 2, a(2^r) = 0 for r > 3, a(p) = 1 for prime p > 2 and a(p^r) = 0 for r > 1. - Steven Finch, Mar 08 2006 (With correction by Jianing Song, Jun 28 2018)
Dirichlet g.f.: zeta(s)*(1 + 2^(-2s) + 2^(1-3s))/(zeta(2s)*(1 + 2^(-s))). - R. J. Mathar, Jul 03 2011
EXAMPLE
From Jianing Song, Feb 27 2019: (Start)
For n = 5, the only real primitive Dirichlet characters modulo n is {Kronecker(5,k)} = [0, 1, -1, -1, 1] = A080891, so a(5) = 1.
For n = 8, the real primitive Dirichlet characters modulo n are {Kronecker(8,k)} = [0, 1, 0, -1, 0, -1, 0, 1] = A091337 and [0, 1, 0, 1, 0, -1, 0, -1] = A188510, so a(8) = 2.
For n = 20, the only real primitive Dirichlet characters modulo n is {Kronecker(-20,k)} = [0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, -1, 0, -1, 0, 0, 0, -1, 0, -1] = A289741, so a(20) = 1. (End)
MAPLE
A114643 := proc(n)
local a, pf, p, r;
a := 1 ;
for pf in ifactors(n)[2] do
p := op(1, pf);
r := op(2, pf);
if p = 2 then
if r = 1 then
a := 0 ;
elif r = 2 then
;
elif r = 3 then
a := a*2 ;
elif r >= 4 then
a := 0 ;
end if;
else
if r =1 then
;
else
a := 0 ;
end if;
end if;
end do:
a ;
end proc:
seq(A114643(n), n=1..40) ; # R. J. Mathar, Mar 02 2015
# Alternative:
f:= proc(n) local r, v, F;
v:= padic:-ordp(n, 2);
if v = 1 or v >= 4 then return 0
elif v = 3 then r:= 2
else r:= 1
fi;
if numtheory:-issqrfree(n/2^v) then r else 0 fi
end proc:
map(f, [$1..100]); # Robert Israel, Oct 08 2017
MATHEMATICA
a[n_] := Sum[ MoebiusMu[n/d] * Sum[ If[ Mod[i^2 - 1, d] == 0, 1, 0], {i, 2, d}], {d, Divisors[n]}]; a[1] = 1; Table[a[n], {n, 1, 105}] (* Jean-François Alcover, Jun 20 2013, after Steven Finch *)
f[2, e_] := Which[e == 1, 0, e == 2, 1, e == 3, 2, e >= 4, 0]; f[p_, e_] := If[e == 1, 1, 0]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 16 2020 *)
PROG
(PARI) a(n)=sum(d=1, n, if(n%d==0, moebius(n/d)*sum(i=1, d, if((i^2-1)%d, 0, 1)), 0)) \\ Steven Finch, Jun 09 2009
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Steven Finch, Feb 16 2006
STATUS
approved