login
A229134
Square numbers that are the sum of two non-consecutive triangular numbers.
2
16, 36, 81, 121, 196, 225, 256, 289, 361, 441, 484, 529, 576, 625, 676, 841, 900, 961, 1024, 1156, 1225, 1296, 1444, 1521, 1600, 1681, 1849, 1936, 2116, 2304, 2401, 2500, 2601, 2704, 2809, 2916, 3136, 3249, 3481, 3721, 4096, 4356, 4624, 4761, 4900, 5041, 5184
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
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
Sequence in context: A050775 A022040 A074985 * A069262 A076956 A075369
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