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.

A239071 Numbers k such that k+x+y is a triangular number (A000217), where x and y are the two triangular numbers nearest to k.

Original entry on oeis.org

0, 2, 6, 11, 19, 39, 53, 84, 104, 122, 146, 195, 225, 285, 321, 352, 392, 434, 470, 516, 605, 657, 757, 815, 864, 926, 990, 1044, 1112, 1241, 1315, 1455, 1535, 1602, 1686, 1844, 1934, 2103, 2199, 2279, 2379, 2481, 2566, 2672, 2870, 2982, 3191, 3309, 3407, 3529
Offset: 1

Views

Author

Alex Ratushnyak, Mar 10 2014

Keywords

Comments

If k is a triangular number then y=k.
The sequence of terms that are triangular numbers begins: 0, 6, 990, 189420, 36709596, 7120958130, 1381422007290, 267988648725336, 51988415041636920, 10085484510081574110.
Those are the triangular numbers with indices from A011916. - Ivan Neretin, May 31 2015

Examples

			The two triangular numbers nearest to 11 are 10 and 15. Because 10+11+15=36 is a triangular number, 11 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    Module[{nn=3600,trnos},trnos=Accumulate[Range[100]];Join[{0},Select[ Range[ nn],OddQ[Sqrt[8(Total[Nearest[trnos,#,2]]+#) +1]]&]]] (* Harvey P. Dale, Dec 19 2020 *)
  • PARI
    isok(k) = {my(x = k-1); while (! ispolygonal(x, 3), x--); my(y = k); while (! ispolygonal(y, 3), y++); ispolygonal(k+x+y, 3);} \\ Michel Marcus, May 31 2015
  • Python
    def isqrt(a):
        sr = 1 << (int.bit_length(int(a)) >> 1)
        while a < sr*sr:  sr>>=1
        b = sr>>1
        while b:
            s = sr + b
            if a >= s*s:  sr = s
            b>>=1
        return sr
    def isTriang(x):
        x+=x
        r = isqrt(x)
        return r*(r+1)==x
    print('0', end=', ')
    for n in range(777):
        tn = n*(n+1)//2
        tn1 = (n+1)*(n+2)//2
        for t in range(tn+1, tn1+1):
            if isTriang(tn+t+tn1): print(str(t), end=',')