login
A242261
Lexicographically last sequence such that every odd prime is the sum of at least two terms of the sequence.
0
1, 2, 4, 10, 18, 36, 72, 148, 156, 312, 456, 1068, 2136, 2436, 6552, 12036, 17976, 29400, 46308, 93228, 119736, 200928, 509556, 911412, 1351812, 2665080, 3978348, 7988688, 17315172, 18646416
OFFSET
1,2
COMMENTS
Every term is 1 less than a prime.
EXAMPLE
3 could be represented by 1+2 or 0+3, but 1,2 is lexicographically later than 0,3; so the sequence starts with 1,2.
Once 4 is added to sequence for 1+4 = 5, 7 = 1+2+4 is already a sum. So the next thing we need to add is 10 for 1+10=11.
PROG
(PARI) issum(v, k, tot, n)={if(n>=tot, n==tot,
n==0||(n>=v[k]&&issum(v, k-1, tot-v[k], n-v[k]))||issum(v, k-1, tot-v[k], n))}
al(n) = {local(r=vector(n), k=1, p=3, tot=1); r[1]=1;
while(k<n, if(!issum(r, k, tot, p), tot+=r[k++]=p-1); p=nextprime(p+1));
r}
CROSSREFS
Sequence in context: A320098 A320968 A279359 * A189892 A240877 A218008
KEYWORD
nonn
AUTHOR
STATUS
approved