login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A343328
a(0) = 0. a(n) = the second smallest number greater than a(n-1) that cannot be written as a sum of any previous distinct terms.
0
0, 2, 4, 7, 10, 18, 33, 38, 86, 162, 284, 522, 928, 1688, 3022, 5470, 9826, 17744, 31926, 57588, 103696, 186946, 336750, 606946, 1093500, 1970642, 3550696, 6398480, 11529230, 20775494, 37435474, 67457232, 121552686, 219031676, 394679816, 711190482, 1281518438
OFFSET
0,2
FORMULA
a(n+3) = a(n+2)+2a(n+1)-a(n) for n=5, n>=8.
EXAMPLE
For n=4, a(4) = 10, because the numbers which cannot be expressed as a sum of any of 0,2,4,7 are 1,3,5,8,10,12,14,15,...
PROG
(Python)
MAX=10000
dp=[False]*(MAX+2)
an=0
dp[an]=True
while an<MAX:
print(an)
while dp[an]:
an+=1
an+=1
while dp[an]:
an+=1
for i in reversed(range(an, MAX)):
dp[i]|=dp[i-an]
CROSSREFS
Sequence in context: A332639 A281168 A274352 * A088762 A217385 A138827
KEYWORD
easy,nonn
AUTHOR
Akihiko Yoshida, Apr 11 2021
STATUS
approved