OFFSET
0,1
COMMENTS
The sequence cannot contain any triangular numbers.
EXAMPLE
a(0) = 2 by the definition of the sequence. The next number > a(0) is 3, but it is a triangular number, so we try 4, but 2 + 4 = 6 is a triangular number. Then we try 5; {5, 2 + 5} are not triangular numbers, thus a(1) = 5. a(2) cannot be 6, so we try 7; {7, 5 + 7, 2 + 5 + 7} are not triangular numbers, thus a(2) = 7.
MAPLE
q:= proc(n) option remember; issqr(8*n+1) end:
s:= proc(i, j) option remember; `if`(i>j, 0, a(j)+s(i, j-1)) end:
a:= proc(n) option remember; local k; for k from 1+a(n-1) while
ormap(q, [k+s(i, n-1)$i=0..n]) do od; k
end: a(-1):=-1:
seq(a(n), n=0..60); # Alois P. Heinz, Jan 21 2023
MATHEMATICA
triQ[n_] := IntegerQ @ Sqrt[8*n + 1]; a[0] = 2; a[n_] := a[n] = Module[{k = a[n - 1] + 1, t = Accumulate @ Table[a[i], {i, n - 1, 0, -1}]}, While[triQ[k] || AnyTrue[t + k, triQ], k++]; k]; Array[a, 61, 0] (* Amiram Eldar, Jan 21 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Jan 21 2023
EXTENSIONS
More terms from Jon E. Schoenfield, Jan 21 2023
STATUS
approved