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.

A091400 a(n) = Product_{ odd primes p | n } (1 + Legendre(-1,p) ).

Original entry on oeis.org

1, 1, 0, 1, 2, 0, 0, 1, 0, 2, 0, 0, 2, 0, 0, 1, 2, 0, 0, 2, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0, 1, 0, 2, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 1, 4, 0, 0, 2, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 2, 0
Offset: 1

Views

Author

N. J. A. Sloane, Mar 02 2004

Keywords

Examples

			G.f. = x + x^2 + x^4 + 2*x^5 + x^8 + 2*x^10 + 2*x^13 + x^16 + 2*x^17 + 2*x^20 + ...
		

References

  • Goro Shimura, Introduction to the Arithmetic Theory of Automorphic Functions, Princeton, 1971, see p. 25, Eq. (2) (but without the restriction that a(4k) = 0).

Crossrefs

Programs

  • Maple
    with(numtheory): A091400 := proc(n) local i,t1,t2; t1 := ifactors(n)[2]; t2 := 1; for i from 1 to nops(t1) do if t1[i][1] > 2 then t2 := t2*(1+legendre(-1,t1[i][1])); fi; od: t2; end;
    with(numtheory): seq(mul(1+legendre(-1,p),p in select(isprime, divisors(n) minus {2})),n=1..105); # Peter Luschny, Apr 20 2016
  • Mathematica
    Legendre[-1, p_] := Which[p==2, 0, Mod[p, 4]==1, 1, True, -1]; a[1] = 1; a[n_] := Times @@ (Legendre[-1, #] + 1&) /@ FactorInteger[n][[All, 1]]; Array[a, 105] (* Jean-François Alcover, Dec 01 2015 *)
    Join[{1},Table[Product[1+JacobiSymbol[-1,p],{p,Complement[FactorInteger[n][[All, 1]], {2}]}], {n,2,105}]] (* Peter Luschny, Apr 20 2016 *)
  • PARI
    {a(n)=if(n<1,0,sumdiv(n,d,(-1)^bigomega(d)*moebius(d)*if(d%2,(-1)^(d\2),0)))} \\ Benoit Cloitre, Apr 17 2016

Formula

Here we use the definition that Legendre(-1, 2) = 0, Legendre(-1, p) = 1 if p == 1 mod 4, = -1 if p == 3 mod 4. This is Shimura's definition, which is different from Maple's.
a(n) is multiplicative with:
a(2^e) = 1 for e >= 0,
a(p^e) = 0 if p == 3 (mod 4) for e > 0,
a(p^e) = 2 if p == 1 (mod 4) for e > 0.
(corrected by Werner Schulte, Dec 12 2020).
a(2*n) = a(n). a(3*n) = a(4*n + 3) = 0.
a(3*n + 1) = A122865(n). a(3*n + 2) = A122856(n).
a(n) = Sum_{d|n} b(d)*(-1)^bigomega(d)*moebius(d) where b(2n)=0 and b(2n+1)=(-1)^n. - Benoit Cloitre, Apr 17 2016
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2/Pi = 0.636619... (A060294). - Amiram Eldar, Oct 11 2022

Extensions

Definition clarified by Peter Luschny, Apr 20 2016