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.

User: Lorenzo Cococcia

Lorenzo Cococcia's wiki page.

Lorenzo Cococcia has authored 2 sequences.

A260812 a(n) is the number of edges in a rooted 2-ary tree built from the binary representation of n: each vertex at level i (i=0,...,floor(log_2(n))) has two children if the i-th most significant bit is 1 and one child if the i-th bit is 0.

Original entry on oeis.org

1, 2, 4, 6, 6, 8, 10, 14, 8, 10, 12, 16, 14, 18, 22, 30, 10, 12, 14, 18, 16, 20, 24, 32, 18, 22, 26, 34, 30, 38, 46, 62, 12, 14, 16, 20, 18, 22, 26, 34, 20, 24, 28, 36, 32, 40, 48, 64, 22, 26, 30, 38, 34, 42, 50, 66, 38, 46, 54, 70, 62, 78, 94, 126
Offset: 0

Author

Lorenzo Cococcia, Jul 31 2015

Keywords

Examples

			a(6) = 10:
The binary representation of 6 is 110.
  digit    h
  1        0        O
                  /   \
  1        1     O     O
                / \   / \
  0        2   O   O O   O
               |   | |   |
               O   O O   O
so the number of edges is 10.
		

Crossrefs

Cf. A000120.

Programs

  • PARI
    a(n) = if (n==0, 0, if (n==1, 2, 2^hammingweight(n) + a(n\2))); \\ Michel Marcus, Aug 17 2015
  • Python
    def a(n):
        t=1
        edges=0
        for digit in bin(n)[2:]:
            t=t*(int(digit)+1)
            edges=edges+t
        return edges
    print([a(n) for n in range(0,100)])
    

Formula

a(0) = 1, a(1) = 2, a(2*n) = 2^A000120(2*n) + a(n), a(2*n+1) = 2^A000120(2*n+1) + a(n).

A172165 A simple sequence a(n) = n + n^(n-1).

Original entry on oeis.org

2, 4, 12, 68, 630, 7782, 117656, 2097160, 43046730, 1000000010, 25937424612, 743008370700, 23298085122494, 793714773254158, 29192926025390640, 1152921504606846992, 48661191875666868498, 2185911559738696531986, 104127350297911241532860
Offset: 1

Author

Lorenzo Cococcia, Jan 27 2010

Keywords

Examples

			a(10) = 1000000010 = 10 + 10^9.
		

Programs

Formula

a(n) = n + n^(n-1).
a(n) = n + A000169(n). - R. J. Mathar, Jan 30 2010

Extensions

Every second term removed by R. J. Mathar, Jan 30 2010