login
A280875
Set a(1)=0, a(2)=1, a(3)=3; b(1)=1, b(2)=2; c(1)=3. Thereafter, a(n) is the smallest positive integer m such that m is not yet in sequence a, m-a(n-1) is not yet in sequence b, and m-a(n-2) is not yet in sequence c; set b(n-1)=m-a(n-1), c(n-2)=m-a(n-2).
3
0, 1, 3, 2, 5, 9, 4, 13, 10, 6, 18, 11, 16, 7, 25, 17, 15, 28, 12, 19, 27, 8, 14, 24, 35, 49, 20, 37, 52, 21, 44, 33, 23, 47, 41, 29, 54, 70, 22, 42, 61, 36, 78, 31, 53, 74, 30, 57, 83, 26, 56, 84, 32, 64, 51, 34, 71, 100, 38, 81, 60, 40, 86, 63, 39, 87, 69, 43
OFFSET
1,3
EXAMPLE
For n=4: m=2 works, because 2 is not in a, 2-3=-1 is not in b, and 2-1=1 is not in c; set a(4)=2, b(3)=-1 and c(2)=1.
For n=5: m=5 works, because 5 is not in a, 5-2=3 is not in b, and 5-3=2 is not in c; set a(5)=5, b(4)=3 and c(3)=2.
MATHEMATICA
a = {0, 1};
d1 = {1};
d2 = {};
For[n = 3, n <= 10000, n++,
For[t = Min[Complement[Range[Max[n]], a]], t <= Infinity, t++,
If[MemberQ[a, t] == False,
If[MemberQ[d1, t - a[[n - 1]]] == False && MemberQ[d2, t - a[[n - 2]]] == False, Break[]; ]]];
a = Flatten[Append[a, t]];
d1 = Flatten[Append[d1, t - a[[n - 1]]]];
d2 = Flatten[Append[d2, t - a[[n - 2]]]]; ]
CROSSREFS
Cf. A257883, A308000 (b), A308001 (c).
Sequence in context: A257883 A169755 A169748 * A173701 A116627 A254331
KEYWORD
nonn
AUTHOR
Luca Petrone, May 14 2018
EXTENSIONS
Edited by N. J. A. Sloane, Jun 25 2018.
STATUS
approved