%I #23 Jun 10 2020 07:53:08
%S 0,1,1,1,2,2,1,2,3,2,3,3,2,5,3,1,4,4,3,5,5,2,3,4,4,5,5,3,6,6,1,3,5,6,
%T 7,5,2,5,6,3,6,6,3,8,9,2,3,4,6,8,6,3,6,11,5,6,5,2,7,7,2,9,5,3,11,6,3,
%U 6,11,6,5,5,2,9,9,6,11,6,3,7,7,2,7,12,6,5,7,3,10,16,6,6,5,6,6,3,4,12,12,5,6,6,3,12
%N Number of triples [n,k,m] with n <= k <= m satisfying T_n + T_k = T_m, where T_i = i*(i+1)/2 are the triangular numbers.
%C a(n)=1 if n is in A068194. - _Robert Israel_, Apr 03 2020
%H Robert Israel, <a href="/A333529/b333529.txt">Table of n, a(n) for n = 1..10000</a>
%e There is a list of all triples (including those with 0 < k < n) with n <= 16 in A309507.
%p with(numtheory):
%p A:=[]; M:=150; ct:=Array(0..M,0):
%p for n from 1 to M do
%p TT:=n*(n+1);
%p dlis:=divisors(TT);
%p for d in dlis do
%p if (d mod 2) = 1 then e := TT/d;
%p mi:=min(d,e); ma:=max(d,e);
%p k:=(ma-mi-1)/2; m:=(ma+mi-1)/2;
%p # skip if k<n
%p if k>=n then
%p ct[n]:=ct[n]+1;
%p lprint(n,k,m);
%p fi;
%p fi;
%p od:
%p od:
%p [seq(ct[n],n=1..M)];
%p # alternative:
%p f:= proc(n) local t,t0, r, dmax, divs;
%p t:= n*(n+1);
%p r:= padic:-ordp(t,2);
%p t0:= t/2^r;
%p dmax:= floor((sqrt(8*t+1)-1)/2-n);
%p divs:= numtheory:-divisors(t0);
%p nops(select(`<=`,divs,dmax)) + nops(select(`<=`,divs,dmax/2^r))
%p end proc:
%p map(f, [$1..200]); # _Robert Israel_, Apr 03 2020
%t T[n_] := n(n+1)/2;
%t r[n_] := Reduce[n <= k <= m && T[n] + T[k] == T[m], {k, m}, Integers];
%t a[n_] := Module[{rn = r[n], r0}, r0 = rn[[0]]; Which[r0 === Or, Length[rn], r0 === And, 1, rn === False, 0, True, Print["error ", n, " ", rn]]];
%t Array[a, 100] (* _Jean-François Alcover_, Jun 08 2020 *)
%Y A309507 counts all triples with k>0.
%Y Cf. A000217, A068194.
%K nonn,look
%O 1,5
%A _N. J. A. Sloane_, Mar 31 2020
|