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.

A351619 a(n) = Sum_{p|n, p prime} (-1)^p.

Original entry on oeis.org

0, 1, -1, 1, -1, 0, -1, 1, -1, 0, -1, 0, -1, 0, -2, 1, -1, 0, -1, 0, -2, 0, -1, 0, -1, 0, -1, 0, -1, -1, -1, 1, -2, 0, -2, 0, -1, 0, -2, 0, -1, -1, -1, 0, -2, 0, -1, 0, -1, 0, -2, 0, -1, 0, -2, 0, -2, 0, -1, -1, -1, 0, -2, 1, -2, -1, -1, 0, -2, -1, -1, 0, -1, 0, -2, 0, -2, -1, -1, 0, -1, 0, -1, -1, -2, 0, -2, 0, -1, -1, -2, 0, -2, 0, -2, 0, -1, 0, -2, 0, -1
Offset: 1

Views

Author

Seiichi Manyama, Mar 02 2022

Keywords

Crossrefs

Programs

  • Mathematica
    A351619[n_] := 2*Boole[EvenQ[n]] - PrimeNu[n]; Array[A351619, 100] (* Paolo Xausa, Jan 28 2025 *)
  • PARI
    a(n) = my(f=factor(n)); sum(k=1, #f~, (-1)^f[k, 1]);
    
  • PARI
    my(N=99, x='x+O('x^N)); concat(0, Vec(sum(k=1, N, isprime(k)*(-x)^k/(1-x^k))))
    
  • Python
    from sympy import primefactors
    def A351619(n): return (0 if n%2 else 2) - len(primefactors(n)) # Chai Wah Wu, Mar 02 2022

Formula

G.f.: Sum_{k>=1} (-x)^prime(k)/(1 - x^prime(k)).
a(n) = -A001221(n) if n is odd and a(n) = 2 - A001221(n) if n is even. - Chai Wah Wu, Mar 02 2022