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.

Showing 1-3 of 3 results.

A163510 Irregular table read by rows: Write n in binary. For each 1, the m-th term of row n is the number of 0's between the m-th 1, reading right to left, and the (m-1)th 1 (or the right side of the number if m-1 = 0).

Original entry on oeis.org

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

Views

Author

Leroy Quet, Jul 29 2009

Keywords

Comments

Row n contains exactly A000120(n) terms, for each n.
All odd-numbered rows begin with 0. All even-numbered rows begin with a positive integer.
Can be used to compute the permutation A163511.

Examples

			Table begins as:
  Row  n in    Terms on
   n   binary  that row
   1      1    0; (the distance of 1-bit from the right edge is zero)
   2     10    1; (the distance of 1-bit from the right edge is one)
   3     11    0,0;
   4    100    2;
   5    101    0,1; (the least significant 1-bit is zero steps away from the right edge, and there is one zero between those two 1-bits)
   6    110    1,0;
   7    111    0,0,0;
   8   1000    3;
   9   1001    0,2;
  10   1010    1,1;
  11   1011    0,0,1;
  12   1100    2,0;
  13   1101    0,1,0;
  14   1110    1,0,0;
  15   1111    0,0,0,0;
  16  10000    4;
		

Crossrefs

Equals A228351-1, termwise.

Programs

  • Mathematica
    Table[Reverse@ Map[Ceiling[(Length@ # - 1)/2] &, DeleteCases[Split@ Join[Riffle[IntegerDigits[n, 2], 0], {0}], {k__} /; k == 1]], {n, 46}] // Flatten (* Michael De Vlieger, Jul 25 2016 *)
  • Python
    from itertools import count, islice
    def A163510_gen(): # generator of terms
        for n in count(1):
            k = n
            while k:
                yield (s:=(~k&k-1).bit_length())
                k >>= s+1
    A163510_list = list(islice(A163510_gen(),30)) # Chai Wah Wu, Jul 17 2023
  • Scheme
    (define (A163510 n) (- (A227186bi (A006068 (A100922 (- n 1))) (A243067 n)) 1))
    ;; See A227186 for A227186bi. - Antti Karttunen, Jun 19 2014
    

Formula

a(n) = A227186(A006068(A100922(n-1)), A243067(n)) - 1. - Antti Karttunen, Jun 19 2014

Extensions

Additional terms computed and Example section added by Antti Karttunen, Jun 19 2014

A243067 Integers from 0 to A000120(n)-1 followed by integers from 0 to A000120(n+1)-1 and so on, starting with n=1.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jun 19 2014

Keywords

Examples

			For n=1, also 1 in binary notation, so the count of its 1-bits is 1 (A000120(1)=1), we list numbers from 0 to 0, thus just 0.
For n=2, 10 in binary, thus A000120(2)=1, we list numbers from 0 to 0, thus just 0.
For n=3, 11 in binary, thus A000120(3)=2, we list numbers from 0 to 1, and so we have the first four terms of the sequence: 0; 0; 0, 1;
		

Crossrefs

Programs

Formula

a(n) = n - (1 + A000788(A100922(n-1)-1)).

A100921 n appears A023416(n) times (appearances equal number of 0-bits).

Original entry on oeis.org

0, 2, 4, 4, 5, 6, 8, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 14, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 23, 24, 24, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 32, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37
Offset: 0

Views

Author

Rick L. Shepherd, Nov 21 2004

Keywords

Examples

			The binary representation of 16 is 10000, which has four 0-bits (and one 1-bit), hence 16 appears four times in this sequence (but only once in A100922).
		

Crossrefs

Cf. A100922 (n's appearances equal its number of 1-bits), A030530 (n's appearances equal its total number of bits), A023416, A059009.

Programs

  • Mathematica
    Flatten[Table[Table[n, {DigitCount[n, 2, 0]}], {n, 0, 37}]] (* Amiram Eldar, Feb 18 2024 *)
  • Python
    def A059015(n): return 2+(n+1)*((t:=(n+1).bit_length())-n.bit_count())-(1<>j)-(r if n<<1>=m*(r:=k<<1|1) else 0)) for j in range(1,n.bit_length()+1))>>1)
    def A100921(n):
        if n == 0: return 0
        m, k = 1, 1
        while A059015(m)<=n: m<<=1
        while m-k>1:
            r = m+k>>1
            if A059015(r)>n:
                m = r
            else:
                k = r
        return m  # Chai Wah Wu, Nov 11 2024

Formula

Sum_{n>=1} (-1)^(n+1)/a(n) = Sum_{n>=1} (-1)^(n+1)/A059009(n) = 0.395592509... . - Amiram Eldar, Feb 18 2024
Showing 1-3 of 3 results.