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.

Original entry on oeis.org

2, 5, 7, 11, 12, 14, 16, 17, 18, 19, 20, 22, 25, 26, 30, 31, 34, 35, 37, 42, 46, 49, 52, 54, 59, 63, 64, 68, 72, 73, 77, 80, 81, 84, 85, 87, 92, 93, 94, 98, 100, 101, 108, 113, 115, 117, 118, 121, 122, 123, 125, 129, 130, 132, 133, 134, 141, 142, 143, 146, 149
Offset: 0

Views

Author

Ctibor O. Zizka, Jan 21 2023

Keywords

Comments

The sequence cannot contain any triangular numbers.

Examples

			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.
		

Crossrefs

Programs

  • 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 *)

Extensions

More terms from Jon E. Schoenfield, Jan 21 2023