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.

A340632 a(n) in binary is a run of 1-bits from the most significant 1-bit of n down to the least significant 1-bit of n, inclusive.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 7, 8, 15, 14, 15, 12, 15, 14, 15, 16, 31, 30, 31, 28, 31, 30, 31, 24, 31, 30, 31, 28, 31, 30, 31, 32, 63, 62, 63, 60, 63, 62, 63, 56, 63, 62, 63, 60, 63, 62, 63, 48, 63, 62, 63, 60, 63, 62, 63, 56, 63, 62, 63, 60, 63, 62, 63, 64, 127, 126
Offset: 0

Views

Author

Kevin Ryde, Jan 13 2021

Keywords

Examples

			n    = 172 = binary 10101100;
a(n) = 252 = binary 11111100.
		

Crossrefs

Cf. A023758 (distinct terms).

Programs

  • PARI
    a(n) = if(n, 2<
    				
  • Python
    def a(n): return (1<
    				

Formula

a(n) = A062383(n) - A006519(n) for n>=1.
a(n) = A003817(n) - A135481(n-1).
a(n) = n + A334045(n) (filling in 0-bits, including n=0 by taking A334045(0)=0).
a(n) = A142151(n-1) + 1.
G.f.: x/(1-x) + Sum_{k>=0} 2^k*x^(2^k)*(1/(1-x) - 1/(1-x^(2^(k+1)))).