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.

A379697 For n >= 3, a(n) is the least k >= 0 such that (k + 1)*(2*n + k) / 2 is a triangular number (A000217).

Original entry on oeis.org

0, 2, 5, 0, 1, 20, 4, 0, 2, 6, 8, 2, 0, 10, 119, 3, 4, 20, 0, 1, 5, 14, 2, 5, 1, 0, 32, 6, 7, 464, 20, 2, 8, 0, 24, 8, 2, 4, 65, 9, 10, 47, 0, 3, 11, 30, 17, 2, 3, 1, 59, 12, 0, 2, 21, 4, 14, 38, 40, 14, 4, 42, 101, 0, 16, 74, 2, 5, 17, 46, 48, 17, 5, 1, 11, 0, 19, 125, 10, 6, 20, 54, 1, 20, 6, 44, 272, 21, 0
Offset: 3

Views

Author

Ctibor O. Zizka, Dec 30 2024

Keywords

Comments

Also for n >= 3, a(n) is the least k >= 0 such that the Sum_{i = 0..k} (n + i) is a triangular number (A000217). For n = 0, 1 the Sum is a triangular number for all n. For n = 2, there is no solution.

Examples

			n = 4: the least k >= 0 such that (k + 1)*(8 + k)/2 is a triangular number is k = 2, thus a(4) = 2.
n = 6: the least k >= 0 such that (k + 1)*(12 + k)/2 is a triangular number is k = 0, thus a(6) = 0.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local t, alpha, beta;
          t:= n^2-n;
          alpha:= convert(select(type, numtheory:-divisors(t),odd),list);
          beta:= map(s -> (s+t/s - 1)/2 - n, alpha);
          min(select(`>=`,beta,0))
    end proc:
    map(f, [$3..100]); # Robert Israel, Jan 30 2025
  • Mathematica
    a[n_] := Module[{k = 0}, While[! IntegerQ[Sqrt[4*(k + 1)*(2*n + k) + 1]], k++]; k]; Array[a, 100, 3] (* Amiram Eldar, Dec 30 2024 *)
  • PARI
    a(n) = my(k=0); while (!ispolygonal((k + 1)*(2*n + k)/2, 3), k++); k; \\ Michel Marcus, Dec 30 2024

Formula

a(n) = 0 for n from A000217.
a(n) = 1 for n from A074377 AND n is not a triangular number.