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.

A049938 a(n) = a(1) + a(2) + ... + a(n-1) + a(m) for n >= 4, where m = n - 1 - 2^p and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), with a(1) = a(2) = 1 and a(3) = 2.

Original entry on oeis.org

1, 1, 2, 5, 10, 20, 40, 81, 165, 326, 652, 1305, 2613, 5231, 10472, 20964, 41969, 83858, 167716, 335433, 670869, 1341743, 2683496, 5367012, 10734065, 21468214, 42936589, 85873504, 171747661, 343496630, 686995878, 1373996997, 2748004486, 5495988009, 10991976018, 21983952037, 43967904077
Offset: 1

Views

Author

Keywords

Examples

			From _Petros Hadjicostas_, Oct 01 2019: (Start)
a(4) = a(4 - 1 - 2^ceiling(-1 + log_2(3))) + a(1) + a(2) + a(3) = a(1) + a(1) + a(2) + a(3) = 5.
a(5) = a(5 - 1 - 2^ceiling(-1 + log_2(4))) + a(1) + a(2) + a(3) + a(4) = a(2) + a(1) + a(2) + a(3) + a(4) = 10.
a(6) = a(6 - 1 - 2^ceiling(-1 + log_2(5))) + a(1) + a(2) + a(3) + a(4) + a(5) = a(1) + a(1) + a(2) + a(3) + a(4) + a(5) = 20.
(End)
		

Crossrefs

Cf. A006257, A049890 (similar, but with minus a(m)), A049891 (similar, but with minus a(2*m)), A049939 (similar, but with plus a(2*m)), A049940, A049960, A049964, A049978.

Programs

  • Maple
    a := proc(n) local i; option remember; if n < 4 then return [1, 1, 2][n]; end if; add(a(i), i = 1 .. n - 1) + a(n - 3/2 - 1/2*Bits:-Iff(n - 2, n - 2)); end proc; # Petros Hadjicostas, Oct 01 2019
  • PARI
    lista(nn) = { nn = max(nn, 3); my(va = vector(nn)); va[1] = 1; va[2] = 1; va[3] = 2; my(sa = vecsum(va)); for (n=4, nn, va[n] = sa + va[n - 1 - 2^ceil(-1 + log(n-1)/log(2))]; sa += va[n]; ); va; } \\ Petros Hadjicostas, Apr 27 2020

Formula

a(n) = a(n - 1 - 2^ceiling(-1 + log_2(n-1))) + Sum_{i = 1..n-1} a(i) = a((1 + A006257(n-2))/2) + Sum_{i = 1..n-1} a(i) for n >= 4 with a(1) = a(2) = 1 and a(3) = 2. - Petros Hadjicostas, Oct 01 2019

Extensions

More terms from Petros Hadjicostas, Oct 01 2019