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.

A335021 a(n) = Sum_{d|n, 1 < d < n} (-1)^(d + 1).

Original entry on oeis.org

0, 0, 0, -1, 0, 0, 0, -2, 1, 0, 0, -2, 0, 0, 2, -3, 0, 0, 0, -2, 2, 0, 0, -4, 1, 0, 2, -2, 0, 0, 0, -4, 2, 0, 2, -3, 0, 0, 2, -4, 0, 0, 0, -2, 4, 0, 0, -6, 1, 0, 2, -2, 0, 0, 2, -4, 2, 0, 0, -4, 0, 0, 4, -5, 2, 0, 0, -2, 2, 0, 0, -6, 0, 0, 4, -2, 2, 0, 0, -6, 3, 0, 0, -4, 2, 0, 2, -4
Offset: 1

Views

Author

Ilya Gutkovskiy, May 19 2020

Keywords

Comments

Number of odd nontrivial divisors of n minus number of even nontrivial divisors of n.

Crossrefs

Programs

  • Mathematica
    Table[DivisorSum[n, (-1)^(# + 1) &, 1 < # < n &], {n, 1, 88}]
    nmax = 88; CoefficientList[Series[Sum[(-1)^(k + 1) x^(2 k)/(1 - x^k), {k, 2, nmax}], {x, 0, nmax}], x] // Rest
  • PARI
    a(n) = sumdiv(n, d, if ((d>1) && (dMichel Marcus, May 20 2020
    
  • Python
    from sympy import divisor_count
    def A335021(n): return 0 if n == 1 else (1-(m:=(~n & n-1).bit_length()))*divisor_count(n>>m)-((n&1)<<1) # Chai Wah Wu, Jul 01 2022

Formula

G.f.: Sum_{k>=2} (-1)^(k + 1) * x^(2*k) / (1 - x^k).
G.f.: - Sum_{k >= 2} x^(2*k)/(1 + x^k). - Peter Bala, Jan 12 2021
a(n) = A001227(n)*(1 - A007814(n)) - 1 + (-1)^n, if n > 1. - Sebastian Karlsson, Jan 14 2021