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.

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

Original entry on oeis.org

1, 1, 3, 6, 14, 26, 54, 119, 278, 503, 1008, 2027, 4094, 8412, 17554, 38194, 89848, 162143, 324288, 648587, 1297214, 2594652, 5190034, 10383154, 20779768, 41631830, 83498100, 167969126, 339831072, 695251878, 1453222088, 3162777148, 7438945312, 13424668537, 26849337076, 53698674163
Offset: 1

Views

Author

Keywords

Examples

			From _Petros Hadjicostas_, Sep 24 2019: (Start)
a(3) = a(1) + a(2) + a(m=1) = 1 + 1 + 1 = 3 because m = A006257(3-2) = 2*3 - 3 - 2^ceiling(log[2](3-1)) = 1.
a(4) = a(1) + a(2) + a(3) + a(m=1) = 1 + 1 + 3 + 1 = 6 because m = A006257(4-2) = 2*4 - 3 - 2^ceiling(log[2](4-1)) = 1.
a(5) = a(1) + a(2) + a(3) + a(4) + a(m=3) = 1 + 1 + 3 + 6 + 3 = 14 because m = A006257(5-2) = 2*5 - 3 - 2^ceiling(log[2](5-1)) = 3.
a(6) = a(1) + a(2) + a(3) + a(4) + a(5) + a(m=1) = 1 + 1 + 3 + 6 + 14 + 1 = 26 because m = A006257(6-2) = 2*6 - 3 - 2^ceiling(log[2](6-1)) = 1.
(End)
		

Crossrefs

Programs

  • Maple
    a := proc(n) local vv, i; option remember; if n = 1 then vv := 1; end if; if n = 2 then vv := 1; end if; if 3 <= n then vv := 0; for i to n - 1 do vv := vv + a(i); end do; vv := vv + a(2*n - 3 - 2^ceil(log[2](n - 1))); end if; vv; end proc; # Petros Hadjicostas, Sep 24 2019
    # second Maple program:
    s:= proc(n) option remember; `if`(n<1, 0, a(n)+s(n-1)) end:
    a:= proc(n) option remember; `if`(n<3, 1,
          s(n-1)+a(2*(n-2^ilog2(n-2))-3))
        end:
    seq(a(n), n=1..36);  # Alois P. Heinz, Sep 24 2019
  • Mathematica
    s[n_] := s[n] = If[n < 1, 0, a[n] + s[n-1]];
    a[n_] := a[n] = If[n < 3, 1, s[n-1] + a[2(n - 2^Floor@Log[2, n-2]) - 3]];
    Array[a, 36] (* Jean-François Alcover, Apr 23 2020, after Alois P. Heinz *)

Formula

a(n) = a(2*n - 3 - 2^ceiling(log_2(n-1))) + Sum_{i = 1..n-1} a(i) = a(A006257(n-2)) + Sum_{i = 1..n-1} a(i) for n >= 3 with a(1) = a(2) = 1. - Petros Hadjicostas, Sep 24 2019

Extensions

Name edited by and more terms from Petros Hadjicostas, Sep 24 2019