cp's OEIS Frontend

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.

A360019 Lexicographically earliest increasing sequence of positive numbers in which no nonempty subsequence of consecutive terms sums to a triangular number.

This page as a plain text file.
%I A360019 #35 Jan 22 2023 17:48:05
%S A360019 2,5,7,11,12,14,16,17,18,19,20,22,25,26,30,31,34,35,37,42,46,49,52,54,
%T A360019 59,63,64,68,72,73,77,80,81,84,85,87,92,93,94,98,100,101,108,113,115,
%U A360019 117,118,121,122,123,125,129,130,132,133,134,141,142,143,146,149
%N A360019 Lexicographically earliest increasing sequence of positive numbers in which no nonempty subsequence of consecutive terms sums to a triangular number.
%C A360019 The sequence cannot contain any triangular numbers.
%e A360019 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.
%p A360019 q:= proc(n) option remember; issqr(8*n+1) end:
%p A360019 s:= proc(i, j) option remember; `if`(i>j, 0, a(j)+s(i, j-1)) end:
%p A360019 a:= proc(n) option remember; local k; for k from 1+a(n-1) while
%p A360019       ormap(q, [k+s(i, n-1)$i=0..n]) do od; k
%p A360019     end: a(-1):=-1:
%p A360019 seq(a(n), n=0..60);  # _Alois P. Heinz_, Jan 21 2023
%t A360019 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 *)
%Y A360019 Cf. A000217, A084833, A332941.
%K A360019 nonn
%O A360019 0,1
%A A360019 _Ctibor O. Zizka_, Jan 21 2023
%E A360019 More terms from _Jon E. Schoenfield_, Jan 21 2023