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.
%I A387123 #20 Aug 24 2025 05:40:45 %S A387123 2,6,9,21,24,38,50,53,65,77,90,96,104,133,147,195,201,224,247,286,324, %T A387123 377,450,483,553,588,605,614,713,792,901,1014,1029,1043,1066,1074, %U A387123 1155,1274,1349,1575,1784,1885,1920,2034,2057,2109,2279,2312,2342,2622 %N 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. %C A387123 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. %e A387123 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. %t A387123 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 *) %o A387123 (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 %o A387123 (Python) %o A387123 from itertools import count, islice %o A387123 from sympy.ntheory.primetest import is_square %o A387123 def A387123_gen(startvalue=1): # generator of terms >= startvalue %o A387123 for k in count(max(startvalue,1)): %o A387123 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)): %o A387123 yield k %o A387123 A387123_list = list(islice(A387123_gen(),50)) # _Chai Wah Wu_, Aug 21 2025 %Y A387123 Cf. A000217, A006002, A101265, A101879. %K A387123 nonn,new %O A387123 1,1 %A A387123 _Ctibor O. Zizka_, Aug 17 2025