%I #37 Mar 14 2017 00:14:49
%S 2,4,6,7,9,11,12,13,16,18,20,21,22,24,25,27,29,30,31,34,36,37,38,39,
%T 42,43,46,48,49,51,55,56,57,58,60,61,64,65,66,67,69,70,72,73,76,79,81,
%U 83,84,87,88,90,91,92,93,94,97,99,100,101,102,106,108
%N Numbers that are the sum of two positive triangular numbers.
%C Numbers n such that 8n+2 is in A085989. - _Robert Israel_, Mar 06 2017
%H T. D. Noe, <a href="/A051533/b051533.txt">Table of n, a(n) for n = 1..1000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/FermatsPolygonalNumberTheorem.html">Fermat's Polygonal Number Theorem</a>
%F A053603(a(n)) > 0. - _Reinhard Zumkeller_, Jun 28 2013
%F A061336(a(n)) = 2. - _M. F. Hasler_, Mar 06 2017
%e 666 is in the sequence because we can write 666 = 435 + 231 = binomial(22,2) + binomial(30,2).
%p isA051533 := proc(n)
%p local a,ta;
%p for a from 1 do
%p ta := A000217(a) ;
%p if 2*ta > n then
%p return false;
%p end if;
%p if isA000217(n-ta) then
%p return true;
%p end if;
%p end do:
%p end proc:
%p for n from 1 to 200 do
%p if isA051533(n) then
%p printf("%d,",n) ;
%p end if;
%p end do: # _R. J. Mathar_, Dec 16 2015
%t f[k_] := If[!
%t Head[Reduce[m (m + 1) + n (n + 1) == 2 k && 0 < m && 0 < n, {m, n},
%t Integers]] === Symbol, k, 0]; DeleteCases[Table[f[k], {k, 1, 108}], 0] (* _Ant King_, Nov 22 2010 *)
%t nn=50; tri=Table[n(n+1)/2, {n,nn}]; Select[Union[Flatten[Table[tri[[i]]+tri[[j]], {i,nn}, {j,i,nn}]]], #<=tri[[-1]] &]
%t With[{nn=70},Take[Union[Total/@Tuples[Accumulate[Range[nn]],2]],nn]] (* _Harvey P. Dale_, Jul 16 2015 *)
%o (Haskell)
%o a051533 n = a051533_list !! (n-1)
%o a051533_list = filter ((> 0) . a053603) [1..]
%o -- _Reinhard Zumkeller_, Jun 28 2013
%o (PARI) is(n)=for(k=ceil((sqrt(4*n+1)-1)/2),(sqrt(8*n-7)-1)\2, if(ispolygonal(n-k*(k+1)/2, 3), return(1))); 0 \\ _Charles R Greathouse IV_, Jun 09 2015
%Y Cf. A000217, A020756 (sums of two triangular numbers), A001481 (sums of two squares), A007294, A051611 (complement).
%Y Cf. A061336: minimal number of triangular numbers that sum up to n.
%Y Cf. A085989.
%K easy,nonn,nice
%O 1,1
%A Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de)
|