OFFSET
1,2
COMMENTS
Empirical: Lim_{n->infinity} a(n+1)/a(n) = 2. - Iain Fox, Dec 05 2017
LINKS
Iain Fox, Table of n, a(n) for n = 1..3325
Iain Fox, Table of n, a(n) for n = 1..8000
FORMULA
EXAMPLE
For n = 4, 2^p < 3 <= 2^(p+1), so p = 1, m = 2^2 + 2 - 4 = 2, and a(n) = a(1) + a(2) + a(3) - a(2) = 1 + 3 + 4 - 3 = 5.
For n = 6, 2^p < 5 <= 2^(p+1), so p = 2, m = 2^3 + 2 - 6 = 4, and a(n) = a(1) + a(2) + a(3) + a(4) + a(5) - a(4) = 1 + 3 + 4 + 5 + 12 - 5 = 20.
MATHEMATICA
Fold[Append[#1, Total@ #1 - #1[[2^Ceiling@ Log2@ #2 + 1 - #2]] ] &, {1, 3, 4}, Range[3, 32]] (* Michael De Vlieger, Dec 06 2017 *)
PROG
(PARI) first(n)= my(res = vector(n), s = 8); res[1]=1; res[2]=3; res[3]=4; for(x=4, n, res[x] = s - res[2*2^logint(x-2, 2)+2-x]; s += res[x]); res; \\ Iain Fox, Dec 05 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Name edited by Petros Hadjicostas, Nov 06 2019
STATUS
approved