login
A049919
a(n) = a(1) + a(2) + ... + a(n-1) - a(m) for n >= 3, where m = 2*n - 2 - 2^(p+1) and p is the unique integer such that 2^p < n-1 <= 2^(p+1), starting with a(1) = 1 and a(2) = 3.
4
1, 3, 1, 2, 5, 9, 19, 31, 40, 108, 217, 427, 832, 1587, 2855, 4550, 6137, 16821, 33643, 67279, 134536, 268995, 537671, 1074182, 2145401, 4278531, 8506604, 16811492, 32817797, 62431245, 112329529, 179039305, 241470550, 661980402
OFFSET
1,2
LINKS
MAPLE
M:= n -> 2*n - 2 - 2^(ilog2(n-2)+1):
A:= proc(n) option remember; S(n-1) - procname(M(n)) end proc:
S:= proc(n) option remember; A(n) + procname(n-1) end proc:
S(1):= 1: A(1):= 1: A(2):= 3:
map(A, [$1..50]); # Robert Israel, Jan 17 2020
PROG
(PARI) lista(nn) = { nn = max(nn, 3); my(va = vector(nn)); va[1] = 1; va[2] = 3; va[3] = 1; my(sa = vecsum(va)); for (n=4, nn, va[n] = sa - va[2*(n - 1 - 2^logint(n-2, 2))]; sa += va[n]; ); va; } \\ Petros Hadjicostas, May 03 2020
CROSSREFS
Cf. A049918 (similar, but with minus a(m/2)), A049966 (similar, but with plus a(m/2)), A049967 (similar, but with plus a(m)).
Sequence in context: A050058 A144204 A048226 * A246432 A112571 A051277
KEYWORD
nonn
EXTENSIONS
Name edited by Petros Hadjicostas, Apr 26 2020
STATUS
approved