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.

A298043 If n = Sum_{i=1..h} 2^b_i with b_1 > ... > b_h >= 0, then a(n) = Sum_{i=1..h} i * 2^b_i.

Original entry on oeis.org

0, 1, 2, 4, 4, 6, 8, 11, 8, 10, 12, 15, 16, 19, 22, 26, 16, 18, 20, 23, 24, 27, 30, 34, 32, 35, 38, 42, 44, 48, 52, 57, 32, 34, 36, 39, 40, 43, 46, 50, 48, 51, 54, 58, 60, 64, 68, 73, 64, 67, 70, 74, 76, 80, 84, 89, 88, 92, 96, 101, 104, 109, 114, 120, 64, 66
Offset: 0

Views

Author

Rémy Sigrist, Jan 11 2018

Keywords

Comments

This sequence is similar to A298011.

Examples

			For n = 42:
  42 = 32 + 8 + 2,
  hence a(42) = 1*32 + 2*8 + 3*2 = 54.
		

Crossrefs

Programs

  • PARI
    a(n) = my (b=binary(n), z=0); for (i=1, #b, if (b[i], b[i] = z++)); return (fromdigits(b,2))

Formula

a(n) = Sum_{k = 0..A000120(n)-1} A053645^k(n) for any n > 0 (where A053645^k denotes the k-th iterate of A053645).
a(n) >= n with equality iff n = 0 or n = 2^k for some k >= 0.
a(2 * n) = 2 * a(n).
a(2^n - 1) = A000295(n + 1).
a(2 ^ i + n) = a(n) + 2 ^ i + n for 2 ^ i > n. - David A. Corneth, Jan 14 2018

A318303 a(0) = 0, a(n) = n + a(n-1) if n is odd, a(n) = -3*a(n/2) if n is even.

Original entry on oeis.org

0, 1, -3, 0, 9, 14, 0, 7, -27, -18, -42, -31, 0, 13, -21, -6, 81, 98, 54, 73, 126, 147, 93, 116, 0, 25, -39, -12, 63, 92, 18, 49, -243, -210, -294, -259, -162, -125, -219, -180, -378, -337, -441, -398, -279, -234, -348, -301, 0, 49, -75, -24, 117, 170, 36, 91, -189, -132, -276, -217, -54, 7, -147, -84, 729, 794, 630
Offset: 0

Views

Author

Altug Alkan, Aug 24 2018

Keywords

Comments

Let g_k(0) = 0. g_k(n) = n + g_k(n-1) if n is odd, g_k(n) = k*a(n/2) if n is even. A228451(n) is g_1(n), A298011(n) is g_2(n). This sequence is a(n) = g_k(n) where k = -3.

Crossrefs

Programs

  • Mathematica
    Nest[Append[#1, If[OddQ@ #2, #2 + #1[[-1]], -3 #1[[#2/2 + 1]] ]] & @@ {#, Length@ #} &, {0}, 66] (* Michael De Vlieger, Aug 25 2018 *)
  • PARI
    a(n)=if(n==0, 0, if(n%2, n+a(n-1), -3*a(n/2)));

A343934 Irregular triangle read by rows: row n gives the sequence of iterations of k - A006519(k), starting with k=n, until 0 is reached.

Original entry on oeis.org

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

Views

Author

Christian Perfect, May 04 2021

Keywords

Comments

Row n starts with n, then the highest power of 2 dividing n is subtracted to produce the next entry in the row.
n first appears at position A000788(n)+1.

Examples

			The triangle begins
1
2
3 2
4
5 4
6 4
7 6 4
		

Crossrefs

Cf. A000120 (row widths), A000788, A006519, A129760, A298011 (row sums).

Programs

  • Mathematica
    Table[Most @ NestWhileList[# - 2^IntegerExponent[#, 2] &, n, # > 0 &], {n, 1, 30}] // Flatten (* Amiram Eldar, May 05 2021 *)
  • Python
    def gen_a():
        for n in range(1,100):
            k = n
            while k>0:
                yield k
                k = k & (k-1)
    a = gen_a()
Showing 1-3 of 3 results.