A138796 Least possible k > 0 with T(k) - T(j) = n, j > 0, where T(i) > 0 are the triangular numbers A000217.
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, 32, 8, 10, 8, 13, 19, 11, 9, 10, 21, 9, 22, 9, 10, 13, 24, 17, 10, 12, 11, 10, 27, 10, 13, 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
Offset: 2
Keywords
Examples
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.
Links
- Vincenzo Librandi, Table of n, a(n) for n = 2..1000
- Peter Pein, Mathematica notebook containing a faster algorithm.
Programs
-
Mathematica
T=#(#+1)/2&;Min[k/.{ToRules[Reduce[{T[k]-T[j]\[Equal]#,0
-
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 } vector(100,n,a(n)) \\ Max Alekseyev, Mar 31 2008
Comments