login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 8
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
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
EXAMPLE
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)
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 *)
CROSSREFS
Sequence in context: A006906 A324703 A120940 * A265947 A358831 A323450
KEYWORD
nonn
AUTHOR
EXTENSIONS
Name edited by and more terms from Petros Hadjicostas, Sep 24 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 28 11:58 EDT 2024. Contains 375506 sequences. (Running on oeis4.)