cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A333529 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.

This page as a plain text file.
%I A333529 #23 Jun 10 2020 07:53:08
%S A333529 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 A333529 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 A333529 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 A333529 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 A333529 a(n)=1 if n is in A068194. - _Robert Israel_, Apr 03 2020
%H A333529 Robert Israel, <a href="/A333529/b333529.txt">Table of n, a(n) for n = 1..10000</a>
%e A333529 There is a list of all triples (including those with 0 < k < n) with n <= 16 in A309507.
%p A333529 with(numtheory):
%p A333529 A:=[]; M:=150; ct:=Array(0..M,0):
%p A333529 for n from 1 to M do
%p A333529 TT:=n*(n+1);
%p A333529 dlis:=divisors(TT);
%p A333529   for d in dlis do
%p A333529 if (d mod 2) = 1 then e := TT/d;
%p A333529 mi:=min(d,e); ma:=max(d,e);
%p A333529 k:=(ma-mi-1)/2; m:=(ma+mi-1)/2;
%p A333529 # skip if k<n
%p A333529     if k>=n then
%p A333529     ct[n]:=ct[n]+1;
%p A333529     lprint(n,k,m);
%p A333529     fi;
%p A333529 fi;
%p A333529 od:
%p A333529 od:
%p A333529 [seq(ct[n],n=1..M)];
%p A333529 # alternative:
%p A333529 f:= proc(n) local t,t0, r, dmax, divs;
%p A333529     t:= n*(n+1);
%p A333529     r:= padic:-ordp(t,2);
%p A333529     t0:= t/2^r;
%p A333529     dmax:= floor((sqrt(8*t+1)-1)/2-n);
%p A333529     divs:= numtheory:-divisors(t0);
%p A333529     nops(select(`<=`,divs,dmax)) + nops(select(`<=`,divs,dmax/2^r))
%p A333529 end proc:
%p A333529 map(f, [$1..200]); # _Robert Israel_, Apr 03 2020
%t A333529 T[n_] := n(n+1)/2;
%t A333529 r[n_] := Reduce[n <= k <= m && T[n] + T[k] == T[m], {k, m}, Integers];
%t A333529 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 A333529 Array[a, 100] (* _Jean-François Alcover_, Jun 08 2020 *)
%Y A333529 A309507 counts all triples with k>0.
%Y A333529 Cf. A000217, A068194.
%K A333529 nonn,look
%O A333529 1,5
%A A333529 _N. J. A. Sloane_, Mar 31 2020