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.

A271860 a(n) = -Sum_{i=1..n} (-1)^floor(n/i).

Original entry on oeis.org

0, 1, 0, 3, 0, 3, 2, 5, 0, 5, 4, 7, 2, 5, 4, 11, 4, 7, 6, 9, 4, 11, 10, 13, 4, 9, 8, 15, 10, 13, 12, 15, 6, 13, 12, 19, 12, 15, 14, 21, 12, 15, 14, 17, 12, 23, 22, 25, 12, 17, 16, 23, 18, 21, 20, 27, 18, 25, 24, 27, 18, 21, 20, 31, 20, 27, 26, 29, 24, 31, 30
Offset: 0

Views

Author

Wesley Ivan Hurt, Apr 15 2016

Keywords

Crossrefs

Column k=1 of A345033.

Programs

  • Maple
    A271860:=n->-add((-1)^floor(n/i), i=1..n): seq(A271860(n), n=0..100);
  • Mathematica
    Table[-Sum[(-1)^Floor[n/i], {i, n}], {n, 0, 100}]
  • PARI
    a(n) = -sum(i=1, n, (-1)^(n\i)); \\ Michel Marcus, Apr 16 2016
    
  • PARI
    my(N=99, x='x+O('x^N)); concat(0, Vec(sum(k=1, N, x^k*(1-x^k)/(1+x^k))/(1-x))) \\ Seiichi Manyama, Jun 06 2021
    
  • Python
    from math import isqrt
    def A271860(n): return (((t:=isqrt(m:=n>>1))**2<<1)-(s:=isqrt(n))**2+(sum(n//k for k in range(1,s+1))-(sum(m//k for k in range(1,t+1))<<1)<<1)<<1)-n # Chai Wah Wu, Oct 23 2023

Formula

a(2n) = 2*A075989(n) for n>0.
a(n) mod 2 = A000035(n).
a(n) = Sum_{k=1..n} (-1)^floor((n-k)/k). - Wesley Ivan Hurt, May 09 2021
G.f.: (1/(1 - x)) * Sum_{k>=1} x^k * (1 - x^k)/(1 + x^k). - Seiichi Manyama, Jun 06 2021