This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A359246 #69 Jan 28 2023 12:41:32 %S A359246 2,2,5,2,2,5,2,2,5,2,2,20,2,7,2,7,2,14,9,7,2,7,2,29,2,7,2,7,2,7,2,41, %T A359246 9,9,16,22,2,23,7,2,7,2,7,2,7,22,9,2,7,2,7,43,9,29,2,41,9,7,2,9,5,2,7, %U A359246 2,22,9,9,9,25,9,29,2,7,2,7,2,32,43,65,5,2,2 %N A359246 Lexicographically earliest sequence of positive numbers in which no nonempty subsequence of consecutive terms sums to a triangular number. %C A359246 Differences of A030194. %e A359246 a(0) = 2 by the definition of the sequence. The next number >= 2 is 2; {2, 2 + 2} are not triangular numbers, thus a(1) = 2. Then we try 2; but 2 + 2 + 2 is a triangular number. We cannot try 3, which is a triangular number, so we try 4; but 4 + 2 is a triangular number, so we try 5; {5, 5 + 2, 5 + 2 + 2} are not triangular numbers, thus a(2) = 5. %p A359246 q:= proc(n) option remember; issqr(8*n+1) end: %p A359246 s:= proc(i, j) option remember; `if`(i>j, 0, a(j)+s(i, j-1)) end: %p A359246 a:= proc(n) option remember; local k; for k from 2 while %p A359246 ormap(q, [k+s(i, n-1)$i=0..n]) do od; k %p A359246 end: a(-1):=-1: %p A359246 seq(a(n), n=0..81); # _Alois P. Heinz_, Jan 21 2023 %t A359246 triQ[n_] := IntegerQ @ Sqrt[8*n + 1]; a[0] = 2; a[n_] := a[n] = Module[{k = 2, t = Accumulate @ Table[a[i], {i, n - 1, 0, -1}]}, While[triQ[k] || AnyTrue[t + k, triQ], k++]; k]; Array[a, 100, 0] (* _Amiram Eldar_, Jan 21 2023 *) %Y A359246 Cf. A000217, A030194 (partial sums), A332941, A360019. %K A359246 nonn %O A359246 0,1 %A A359246 _Ctibor O. Zizka_, Jan 21 2023 %E A359246 More terms from _Amiram Eldar_, Jan 21 2023