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-1 of 1 results.

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

Original entry on oeis.org

1, 2, 3, 4, 9, 15, 31, 63, 127, 192, 416, 848, 1702, 3409, 6819, 13639, 27279, 40920, 88660, 180730, 363167, 727188, 1454808, 2909840, 5819745, 11639554, 23279140, 46558296, 93116598, 186233201, 372466403, 744932807, 1489865615
Offset: 1

Views

Author

Keywords

Examples

			From _Petros Hadjicostas_, Nov 07 2019: (Start)
a(4) = -a(2^ceiling(log_2(4-1)) + 2 - 4) + a(1) + a(2) + a(3) = -a(2) + a(1) + a(2) + a(3) = 4.
a(5) = -a(2^ceiling(log_2(5-1)) + 2 - 5) + a(1) + a(2) + a(3) + a(4) = -a(1) + a(1) + a(2) + a(3) + a(4) = 9.
a(6) = -a(2^ceiling(log_2(6-1)) + 2 - 6) + a(1) + a(2) + a(3) + a(4) + a(5) = -a(4) + a(1) + a(2) + a(3) + a(4) + a(5) = 15.
a(7) =  -a(7 - 1 - A006257(7-2)) + Sum_{i = 1..6} a(i) = -a(3) +  Sum_{i = 1..6} a(i) = 31.
a(8) =  -a(8 - 1 - A006257(8-2)) + Sum_{i = 1..7} a(i) = -a(2) +  Sum_{i = 1..7} a(i) = 63. (End)
		

Crossrefs

Programs

  • Maple
    s:= proc(n) option remember; `if`(n<1, 0, a(n)+s(n-1)) end:
    a:= proc(n) option remember; `if`(n<4, [1, 2, 3][n],
          s(n-1) - a(Bits:-Iff(n-2$2) + 3 - n))
        end:
    seq(a(n), n=1..40); # Petros Hadjicostas, Nov 07 2019

Formula

From Petros Hadjicostas, Nov 07 2019: (Start)
a(n) = -a(2^ceiling(log_2(n-1)) + 2 - n) + Sum_{i = 1..n-1} a(i) for n >= 4.
a(n) = -a(n - 1 - A006257(n-2)) + Sum_{i = 1..n-1} a(i) for n >= 4. (End)

Extensions

Name edited by Petros Hadjicostas, Nov 07 2019
Showing 1-1 of 1 results.