cp's OEIS Frontend

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.

A114643 Number of real primitive Dirichlet characters modulo n.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Steven Finch, Feb 16 2006

Keywords

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

Examples

			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)
		

References

  • W. Ellison and F. Ellison, Prime Numbers, Wiley, 1985, pp. 224-226.

Crossrefs

Cf. A160498 (number of cubic primitive Dirichlet characters modulo n), A160499 (number of quartic primitive Dirichlet characters modulo n).
Cf. A060594 (number of solutions to x^2 == 1 (mod n)).

Programs

  • 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 *)
  • 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

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