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.
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, 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, 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
Offset: 1
Examples
There is a list of all triples (including those with 0 < k < n) with n <= 16 in A309507.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
with(numtheory): A:=[]; M:=150; ct:=Array(0..M,0): for n from 1 to M do TT:=n*(n+1); dlis:=divisors(TT); for d in dlis do if (d mod 2) = 1 then e := TT/d; mi:=min(d,e); ma:=max(d,e); k:=(ma-mi-1)/2; m:=(ma+mi-1)/2; # skip if k
=n then ct[n]:=ct[n]+1; lprint(n,k,m); fi; fi; od: od: [seq(ct[n],n=1..M)]; # alternative: f:= proc(n) local t,t0, r, dmax, divs; t:= n*(n+1); r:= padic:-ordp(t,2); t0:= t/2^r; dmax:= floor((sqrt(8*t+1)-1)/2-n); divs:= numtheory:-divisors(t0); nops(select(`<=`,divs,dmax)) + nops(select(`<=`,divs,dmax/2^r)) end proc: map(f, [$1..200]); # Robert Israel, Apr 03 2020 -
Mathematica
T[n_] := n(n+1)/2; r[n_] := Reduce[n <= k <= m && T[n] + T[k] == T[m], {k, m}, Integers]; 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]]]; Array[a, 100] (* Jean-François Alcover, Jun 08 2020 *)
Comments