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.

Showing 1-1 of 1 results.

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

Original entry on oeis.org

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, 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, 2, 22, 9, 9, 9, 25, 9, 29, 2, 7, 2, 7, 2, 32, 43, 65, 5, 2, 2
Offset: 0

Views

Author

Ctibor O. Zizka, Jan 21 2023

Keywords

Comments

Differences of A030194.

Examples

			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.
		

Crossrefs

Cf. A000217, A030194 (partial sums), A332941, A360019.

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 2 while
          ormap(q, [k+s(i, n-1)$i=0..n]) do od; k
        end: a(-1):=-1:
    seq(a(n), n=0..81);  # Alois P. Heinz, Jan 21 2023
  • Mathematica
    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 *)

Extensions

More terms from Amiram Eldar, Jan 21 2023
Showing 1-1 of 1 results.