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.

A387123 Numbers k such that Sum_{i=1..r} (k-i) and Sum_{i=1..r} (k+i) are both triangular for some r with 1 <= r < k.

Original entry on oeis.org

2, 6, 9, 21, 24, 38, 50, 53, 65, 77, 90, 96, 104, 133, 147, 195, 201, 224, 247, 286, 324, 377, 450, 483, 553, 588, 605, 614, 713, 792, 901, 1014, 1029, 1043, 1066, 1074, 1155, 1274, 1349, 1575, 1784, 1885, 1920, 2034, 2057, 2109, 2279, 2312, 2342, 2622
Offset: 1

Views

Author

Ctibor O. Zizka, Aug 17 2025

Keywords

Comments

For m >= 1, if k = m*(m+1)^2/2 then r = m, thus A006002 is a subsequence. For k >= 286 from A101265 or A101879, r = k-1.

Examples

			For k = 6: the least r = 5, T_i = 1 + 2 + 3 + 4 + 5 = 15, T_j = 7 + 8 + 9 + 10 + 11 = 45, both T_i and T_j are triangular numbers, thus k = 6 is a term.
		

Crossrefs

Programs

  • Mathematica
    triQ[n_] := IntegerQ[Sqrt[8*n + 1]]; q[k_] := Module[{r = 1, s1 = 0, s2 = 0}, While[s1 += k - r; s2 += k + r; r < k && (! triQ[s1] || ! triQ[s2]), r++]; 1 <= r < k]; Select[Range[3000], q] (* Amiram Eldar, Aug 17 2025 *)
  • PARI
    isok(k) = my(sm=0, sp=0); for (r=1, k-1, sm+=k-r; sp+=k+r; if (ispolygonal(sm, 3) && ispolygonal(sp, 3), return(r));); \\ Michel Marcus, Aug 17 2025
    
  • Python
    from itertools import count, islice
    from sympy.ntheory.primetest import is_square
    def A387123_gen(startvalue=1): # generator of terms >= startvalue
        for k in count(max(startvalue,1)):
            if any(is_square(((k*r<<1)-r*(r+1)<<2)+1) and is_square(((k*r<<1)+r*(r+1)<<2)+1) for r in range(1,k)):
                yield k
    A387123_list = list(islice(A387123_gen(),50)) # Chai Wah Wu, Aug 21 2025