OFFSET
1,1
COMMENTS
It is well known that tri(n) + tri(n+1) is always a square.
Sequence includes all terms of A001110 > 1. A number m is a term if and only if there exists k > 1 such that m >= tri(k) and 4m - k^2 + 1 is a perfect square. - Chai Wah Wu, Feb 25 2016
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
EXAMPLE
16 = 15+1, 81 = 78+3 = 66+15.
MATHEMATICA
nn = 10000; mx = Floor[Sqrt[1 + 8 nn]/2]; tri = Table[n (n + 1)/2, {n, mx}]; t = {}; Do[s = tri[[i]] + tri[[j]]; If[s <= nn && IntegerQ[Sqrt[s]], AppendTo[t, s]], {i, mx - 2}, {j, i + 2, mx}]; t = Union[t] (* T. D. Noe, Sep 17 2013 *)
PROG
(JavaScript)
function isSquare(n) {
if (Math.sqrt(n)==Math.floor(Math.sqrt(n))) return true; else return false;
}
a=new Array();
ac=0;
for (i=0; i<100; i++)
for (j=i+2; j<100; j++)
if (isSquare(i*(i+1)/2+j*(j+1)/2)) a[ac++]=i*(i+1)/2+j*(j+1)/2;
a.sort(function(a, b) {return a-b; });
a=trimArray(a);
function trimArray(arr) {
var j, c=new Array(), i;
for (j=0; j<arr.length; j++) c[j]=arr[j];
c.sort(function(a, b) {return a-b; });
i=-1;
while(i++<c.length-1)
if (c[i]==c[i+1]) c.splice(i--, 1);
return c;
}
document.write(a+", ");
(Python)
from gmpy2 import is_square
A229134_list = []
for i in range(10**3):
m, m2, j, k = 2, 4, 4*i**2+1, 2*i**2
while k >= m2 + m:
if is_square(j-m2):
A229134_list.append(i**2)
break
m2 += 2*m+1
m += 1 # Chai Wah Wu, Feb 25 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon Perry, Sep 15 2013
EXTENSIONS
Corrected and extended by T. D. Noe, Sep 17 2013
a(2) = 36 reinserted by Chai Wah Wu, Feb 27 2016
STATUS
approved