This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A114643 #54 Feb 16 2025 08:32:59 %S A114643 1,0,1,1,1,0,1,2,0,0,1,1,1,0,1,0,1,0,1,1,1,0,1,2,0,0,0,1,1,0,1,0,1,0, %T A114643 1,0,1,0,1,2,1,0,1,1,0,0,1,0,0,0,1,1,1,0,1,2,1,0,1,1,1,0,0,0,1,0,1,1, %U A114643 1,0,1,0,1,0,0,1,1,0,1,0,0,0,1,1,1,0,1,2,1,0,1,1,1,0,1,0,1,0,0,0,1,0,1,2,1 %N A114643 Number of real primitive Dirichlet characters modulo n. %C A114643 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. %C A114643 From _Jianing Song_, Feb 27 2019: (Start) %C A114643 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). %C A114643 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). %C A114643 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)}. %C A114643 a(n) = 0 if n == 2 (mod 4), n is divisible by 16 or the square of an odd prime. (End) %C A114643 Mobius transform of A060594. - _Jianing Song_, Mar 02 2019 %D A114643 W. Ellison and F. Ellison, Prime Numbers, Wiley, 1985, pp. 224-226. %H A114643 Robert Israel, <a href="/A114643/b114643.txt">Table of n, a(n) for n = 1..10000</a> %H A114643 Steven R. Finch, <a href="http://www.people.fas.harvard.edu/~sfinch/">Cubic and quartic characters</a> [Broken link] %H A114643 Steven R. Finch, <a href="https://citeseerx.ist.psu.edu/pdf/d8a1c458d0bbb761a2110777aea6ab614d9a7467">Cubic and quartic characters</a>. %H A114643 Vaclav Kotesovec, <a href="/A114643/a114643.jpg">Graph - the asymptotic ratio</a> %H A114643 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DirichletL-Series.html">Dirichlet L-Series</a>. %H A114643 I. J. Zucker and M. M. Robertson, <a href="https://doi.org/10.1088/0305-4470/9/8/006">Some properties of Dirichlet L-series</a>, J. Phys. A 9 (1976) 1207-1214. %F A114643 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) %F A114643 Dirichlet g.f.: zeta(s)*(1 + 2^(-2s) + 2^(1-3s))/(zeta(2s)*(1 + 2^(-s))). - _R. J. Mathar_, Jul 03 2011 %e A114643 From _Jianing Song_, Feb 27 2019: (Start) %e A114643 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. %e A114643 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. %e A114643 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) %p A114643 A114643 := proc(n) %p A114643 local a,pf,p,r; %p A114643 a := 1 ; %p A114643 for pf in ifactors(n)[2] do %p A114643 p := op(1,pf); %p A114643 r := op(2,pf); %p A114643 if p = 2 then %p A114643 if r = 1 then %p A114643 a := 0 ; %p A114643 elif r = 2 then %p A114643 ; %p A114643 elif r = 3 then %p A114643 a := a*2 ; %p A114643 elif r >= 4 then %p A114643 a := 0 ; %p A114643 end if; %p A114643 else %p A114643 if r =1 then %p A114643 ; %p A114643 else %p A114643 a := 0 ; %p A114643 end if; %p A114643 end if; %p A114643 end do: %p A114643 a ; %p A114643 end proc: %p A114643 seq(A114643(n),n=1..40) ; # _R. J. Mathar_, Mar 02 2015 %p A114643 # Alternative: %p A114643 f:= proc(n) local r,v,F; %p A114643 v:= padic:-ordp(n,2); %p A114643 if v = 1 or v >= 4 then return 0 %p A114643 elif v = 3 then r:= 2 %p A114643 else r:= 1 %p A114643 fi; %p A114643 if numtheory:-issqrfree(n/2^v) then r else 0 fi %p A114643 end proc: %p A114643 map(f, [$1..100]); # _Robert Israel_, Oct 08 2017 %t A114643 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_ *) %t A114643 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 *) %o A114643 (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 %Y A114643 Cf. A003657, A003658. %Y A114643 Cf. A160498 (number of cubic primitive Dirichlet characters modulo n), A160499 (number of quartic primitive Dirichlet characters modulo n). %Y A114643 Cf. A060594 (number of solutions to x^2 == 1 (mod n)). %K A114643 nonn,mult %O A114643 1,8 %A A114643 _Steven Finch_, Feb 16 2006