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.

A330926 a(n) = Sum_{k=1..n} (ceiling(n/k) mod 2).

Original entry on oeis.org

1, 1, 2, 1, 3, 2, 3, 2, 5, 3, 4, 3, 6, 5, 6, 3, 7, 6, 7, 6, 9, 6, 7, 6, 11, 9, 10, 7, 10, 9, 10, 9, 14, 11, 12, 9, 13, 12, 13, 10, 15, 14, 15, 14, 17, 12, 13, 12, 19, 17, 18, 15, 18, 17, 18, 15, 20, 17, 18, 17, 22, 21, 22, 17, 23, 20, 21, 20, 23, 20, 21, 20, 27, 26, 27, 22, 25, 22, 23, 22
Offset: 1

Views

Author

Ilya Gutkovskiy, May 25 2020

Keywords

Comments

a(n) = number of terms among {ceiling(n/k)}, 1 <= k <= n, that are odd.

Crossrefs

Programs

  • Maple
    b:= n-> add((-1)^d, d=numtheory[divisors](n)):
    a:= proc(n) option remember; `if`(n>0, 1+b(n-1)+a(n-1), 0) end:
    seq(a(n), n=1..80);  # Alois P. Heinz, May 25 2020
  • Mathematica
    Table[Sum[Mod[Ceiling[n/k], 2], {k, 1, n}], {n, 1, 80}]
    Table[n - Sum[DivisorSum[k, (-1)^(# + 1) &], {k, 1, n - 1}], {n, 1, 80}]
    nmax = 80; CoefficientList[Series[x/(1 - x) (1 + Sum[x^(2 k)/(1 + x^k), {k, 1, nmax}]), {x, 0, nmax}], x] // Rest
  • PARI
    a(n) = sum(k=1, n, ceil(n/k) % 2); \\ Michel Marcus, May 25 2020
    
  • Python
    from math import isqrt
    def A330926(n): return n+(s:=isqrt(n-1))**2-((t:=isqrt(m:=n-1>>1))**2<<1)-(sum((n-1)//k for k in range(1,s+1))-(sum(m//k for k in range(1,t+1))<<1)<<1) # Chai Wah Wu, Oct 23 2023

Formula

G.f.: (x/(1 - x)) * (1 + Sum_{k>=1} x^(2*k) / (1 + x^k)).
a(n) = n - Sum_{k=1..n-1} A048272(k).
a(n) = A075997(n-1) + 1.