%I #19 Mar 03 2016 22:52:34
%S 16,36,81,121,196,225,256,289,361,441,484,529,576,625,676,841,900,961,
%T 1024,1156,1225,1296,1444,1521,1600,1681,1849,1936,2116,2304,2401,
%U 2500,2601,2704,2809,2916,3136,3249,3481,3721,4096,4356,4624,4761,4900,5041,5184
%N Square numbers that are the sum of two non-consecutive triangular numbers.
%C It is well known that tri(n) + tri(n+1) is always a square.
%C 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
%H Chai Wah Wu, <a href="/A229134/b229134.txt">Table of n, a(n) for n = 1..10000</a>
%e 16 = 15+1, 81 = 78+3 = 66+15.
%t 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 *)
%o (JavaScript)
%o function isSquare(n) {
%o if (Math.sqrt(n)==Math.floor(Math.sqrt(n))) return true; else return false;
%o }
%o a=new Array();
%o ac=0;
%o for (i=0;i<100;i++)
%o for (j=i+2;j<100;j++)
%o if (isSquare(i*(i+1)/2+j*(j+1)/2)) a[ac++]=i*(i+1)/2+j*(j+1)/2;
%o a.sort(function(a,b) {return a-b;});
%o a=trimArray(a);
%o function trimArray(arr) {
%o var j,c=new Array(),i;
%o for (j=0;j<arr.length;j++) c[j]=arr[j];
%o c.sort(function(a,b) {return a-b;});
%o i=-1;
%o while(i++<c.length-1)
%o if (c[i]==c[i+1]) c.splice(i--,1);
%o return c;
%o }
%o document.write(a+", ");
%o (Python)
%o from gmpy2 import is_square
%o A229134_list = []
%o for i in range(10**3):
%o m, m2, j, k = 2, 4, 4*i**2+1, 2*i**2
%o while k >= m2 + m:
%o if is_square(j-m2):
%o A229134_list.append(i**2)
%o break
%o m2 += 2*m+1
%o m += 1 # _Chai Wah Wu_, Feb 25 2016
%Y Cf. A000217, A001110.
%K nonn
%O 1,1
%A _Jon Perry_, Sep 15 2013
%E Corrected and extended by _T. D. Noe_, Sep 17 2013
%E a(2) = 36 reinserted by _Chai Wah Wu_, Feb 27 2016