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.

A138796 Least possible k > 0 with T(k) - T(j) = n, j > 0, where T(i) > 0 are the triangular numbers A000217.

This page as a plain text file.
%I A138796 #16 Sep 10 2024 16:14:09
%S A138796 2,3,4,3,6,4,8,4,10,6,5,7,5,6,16,9,6,10,6,8,7,12,9,7,8,7,28,15,8,16,
%T A138796 32,8,10,8,13,19,11,9,10,21,9,22,9,10,13,24,17,10,12,11,10,27,10,13,
%U A138796 11,12,16,30,11,31,17,11,64,11,18,34,12,14,13,36,12,37,20,12,13,12,21,40,18
%N A138796 Least possible k > 0 with T(k) - T(j) = n, j > 0, where T(i) > 0 are the triangular numbers A000217.
%C A138796 For T(k) see A138797, for j see A138798 and for T(j) see A138799.
%C A138796 The number of ways n can be written as difference of two triangular numbers is sequence A136107
%C A138796 Note that n = t(k)-t(j) implies 2n = (k-j)(k+j+1), where (k-j) and (k+j+1) are of opposite parity.  Let d be the odd element of { k-j, k+j+1 }. Then d is an odd divisor of n and k = ( d + 2n/d - 1 ) / 2. Therefore a(n) = ( min{ d + 2n/d } - 1 ) / 2 where d runs through all odd divisors of n, except perhaps (sqrt(8*n+1) +- 1)/2 which correspond to j=0. See PARI program. The restriction that j > 0 seems artificial. If it is removed we get A212652. - _Max Alekseyev_, Mar 31 2008
%H A138796 Vincenzo Librandi, <a href="/A138796/b138796.txt">Table of n, a(n) for n = 2..1000</a>
%H A138796 Peter Pein, <a href="http://freenet-homepage.de/Peter_Berlin/triadiff.nb">Mathematica notebook containing a faster algorithm</a>.
%e A138796 a(30)=8, because 30 = T(30) - T(29) = T(11) - T(8) = T(9) - T(5) = T(8) - T(3) and 8 is the least index of the minuends.
%t A138796 T=#(#+1)/2&;Min[k/.{ToRules[Reduce[{T[k]-T[j]\[Equal]#,0<j<k},{j,k},Integers]]}]&/@Range[2,100]
%o A138796 (PARI) { a(n) = local(m); m=2*n+1; fordiv(n/2^valuation(n,2),d,if((2*d+1)^2!=8*n+1&&(2*d-1)^2!=8*n+1,m=min(m,d+(2*n)\d))); (m-1)\2 }
%o A138796 vector(100,n,a(n)) \\ _Max Alekseyev_, Mar 31 2008
%Y A138796 Cf. A000217, A109814, A118235, A136107, A138797, A138798, A138799, A212652.
%K A138796 nonn
%O A138796 2,1
%A A138796 Peter Pein (petsie(AT)dordos.net), Mar 30 2008