|
|
A004978
|
|
a(n) = least integer m > a(n-1) such that m - a(n-1) != a(j) - a(k) for all j, k less than n; a(1) = 1, a(2) = 2.
(Formerly N0416)
|
|
10
|
|
|
1, 2, 4, 8, 13, 21, 31, 45, 60, 76, 97, 119, 144, 170, 198, 231, 265, 300, 336, 374, 414, 456, 502, 550, 599, 649, 702, 759, 819, 881, 945, 1010, 1080, 1157, 1237, 1318, 1401, 1486, 1572, 1662, 1753, 1845, 1945, 2049, 2156, 2264
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Equivalently, if S(n) = { a(j) - a(k); n > j > k > 0 }, then a(n) = a(n-1) + M where M = min( {1, 2, 3, ...} \ S(n) ) is the smallest positive integer not in S(n). - M. F. Hasler, Jun 26 2019
|
|
REFERENCES
|
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
|
|
LINKS
|
|
|
EXAMPLE
|
After a(1) = 1, a(2) = 2, we have a(3) = least m > a(2) such that m - a(2) = m - 2 is not in { a(j) - a(k); 1 <= k < j < 3 } = { a(2) - a(1) } = { 1 }. Thus we must have m - 2 = 2, whence m = 4.
The next term a(4) is the least m > a(3) such that m - a(3) = m - 4 is not in { a(j) - a(k); 1 <= k < j < 4 } = { 1, 4 - 2 = 2, 4 - 1 = 3 }, i.e., m = 4 + 4 = 8.
The next term a(5) is the least m > a(4) such that m - a(4) = m - 8 is not in { a(j) - a(k); 1 <= k < j < 5 } = { 1, 2, 3, 8 - 4 = 4, 8 - 2 = 6, 8 - 1 = 7 }, i.e., m = 5 + 8 = 13.
(End)
|
|
PROG
|
for n=3:2000
d=sort(unique(d));
end
(PARI) A004978_vec(N, a=[1..N], S=[1])={for(n=3, N, a[n]=a[n-1]+S[1]+1; S=setunion(S, select(t->t>S[1], vector(n-1, k, a[n]-a[n-k]))); for(k=1, #S-1, if(S[k+1]-S[k]>1, S=S[k..-1]; next(2))); S[#S]==#S&&S=[#S]); a} \\ M. F. Hasler, Jun 26 2019
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Definition corrected by Bryan S. Robinson, Mar 16 2006
|
|
STATUS
|
approved
|
|
|
|