login
Least k > 1 such that tri(n)+ ... + tri(n+k-1) is a triangular number.
2

%I #30 Mar 03 2016 22:52:26

%S 2,3,5,17,7,2,89,125,3,215,269,13,10,8,11,27,719,815,21,57,316,11,26,

%T 1517,17,1799,30,26,7,5,2609,11,2975,10,2,76,3779,1251,208,4445,115,

%U 4919,1045,5417,11,17,1205,6485,38,2860,7349,18,25,8267,8585,8909

%N Least k > 1 such that tri(n)+ ... + tri(n+k-1) is a triangular number.

%C tri(n) = n*(n+1)/2 is the n-th triangular number, A000217(n).

%C a(n) is how many consecutive triangular numbers starting from tri(n) are needed to sum up to tri(x) for some x. The requirement a(n) > 1 is needed, because otherwise all a(n) = 1.

%C Because an oblong number (A002378) is twice a triangular number, this sequence is also the least k > 1 such that oblong(n) + ... + oblong(n+k-1) is an oblong number.

%C a(n) is least k > 1 such that 12*k^3 + 36*n*k^2 + 36*k*n^2 - 12*k + 9 is a perfect square. - _Chai Wah Wu_, Mar 01 2016

%C a(n) <= 3*n^2 - 3*n - 1 for n > 1, since 12*k^3 + 36*n*k^2 + 36*k*n^2 - 12*k + 9 is a square when k = 3*n^2 - 3*n - 1. - _Robert Israel_, Mar 03 2016

%H Chai Wah Wu, <a href="/A214697/b214697.txt">Table of n, a(n) for n = 0..5000</a>

%e 0+1 = 1 is a triangular number, two summands, so a(0)=2.

%e 1+3+6 = 10 is a triangular number, three summands, so a(1)=3.

%e 3+6+10+15+21 = 55 is a triangular number, five summands, so a(2)=5.

%e Starting from Triangular(5)=15: 15+21=36 is a triangular number, two summands, so a(5)=2.

%p f:= proc(n) local k;

%p for k from 2 do if issqr(12*k^3+36*k^2*n+36*k*n^2-12*k+9) then return k fi od

%p end proc:

%p map(f, [$0..100]); # _Robert Israel_, Mar 03 2016

%t triQ[n_] := IntegerQ[Sqrt[1+8*n]]; Table[k = n+1; s = k^2; While[! triQ[s], k++; s = s + k*(k+1)/2]; k - n + 1, {n, 0, 55}] (* _T. D. Noe_, Jul 26 2012 *)

%o (Python)

%o for n in range(77):

%o i = ti = n

%o sum = 0

%o tn_gte_sum = 0 # least oblong number >= sum

%o while i-n<=1 or tn_gte_sum!=sum:

%o sum += i*(i+1)

%o i+=1

%o while tn_gte_sum<sum:

%o tn_gte_sum = ti*(ti+1)

%o ti+=1

%o print i-n,

%o (Python)

%o from math import sqrt

%o def A214697(n):

%o k, a1, a2, m = 2, 36*n, 36*n**2 - 12, n*(72*n + 144) + 81

%o while int(round(sqrt(m)))**2 != m:

%o k += 1

%o m = k*(k*(12*k + a1) + a2) + 9

%o return k # _Chai Wah Wu_, Mar 01 2016

%Y Cf. A000217, A000292, A214648, A214696.

%K nonn,look

%O 0,1

%A _Alex Ratushnyak_, Jul 26 2012