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.

A329320 a(n) = Sum_{k=0..floor(log_2(n))} 1 - A035263(1 + floor(n/2^k)).

Original entry on oeis.org

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

Views

Author

Mikhail Kurkov, Nov 10 2019 [verification needed]

Keywords

Comments

Sequence which arise from attempts to simplify computing of A329319.
For all positive integers k, the subsequence a(2^k) to a(3*2^(k-1)-1) is identical to the subsequence a(3*2^(k-1)) to a(2^(k+1)-1). Also subsequences a(2^k) to a(3*2^(k-1)-1) and a(0) to a(2^(k-1)-1) always differ by 1.

Crossrefs

Programs

  • PARI
    a(n) = if (n==0, 0, a(floor(n/2)) + valuation(n+1, 2) %  2); \\ Michel Marcus, Nov 13 2019
    
  • PARI
    a(n)=my(s,t); while(n, n>>=valuation(n,2); t=valuation(n+1,2); s+=(t+1)\2; n>>=t); s \\ Charles R Greathouse IV, Oct 14 2021

Formula

a(n) = a(floor(n/2)) + 1 - A035263(n+1) for n>0 with a(0)=0.
a(2^m+k) = a(k mod 2^(m-1)) + 1 for 0<=k<2^m, m>0 with a(0)=0, a(1)=1.