login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A225844 Least k>0 such that triangular(n) + k*(k+1) is a triangular number. 0

%I #10 Dec 07 2019 12:18:26

%S 2,1,3,5,7,2,11,13,5,17,19,3,6,25,27,9,31,33,35,4,9,41,8,45,47,10,14,

%T 53,9,5,59,61,21,18,67,69,21,73,75,14,22,6,11,13,87,15,91,26,20,34,12,

%U 101,26,105,30,7,20,33,115,117,119,34,21,125,37,129,29,133,14,137

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

%C For n>0, a(n) <= 2*n-1, because n*(n+1)/2 + (2*n-1)*2*n = (9*n^2 - 3*n)/2 = 3*n*(3*n-1)/2 = triangular(3*n-1).

%C The subsequence with terms less than 2*n-1 begins: 2, 5, 3, 6, 9, 4, 9, 8, 10, 14, 9, 5, 21, 18, 21, 14, 22, 6, 11, 13, 15, ...

%C The sequence of n's such that a(n) < 2*n-1 begins: 5, 8, 11, 12, 15, 19, 20, 22, 25, 26, ...

%t lktrno[n_]:=Module[{t=(n(n+1))/2,k=1},While[!IntegerQ[(Sqrt[ 8(t+k(k+1))+1]-1)/2],k++];k]; Array[lktrno,70,0] (* _Harvey P. Dale_, Aug 19 2014 *)

%o (Python)

%o def isTriangular(a):

%o sr = 1L << (long.bit_length(long(a)) >> 1)

%o a += a

%o while a < sr*(sr+1): sr>>=1

%o b = sr>>1

%o while b:

%o s = sr+b

%o if a >= s*(s+1): sr = s

%o b>>=1

%o return (a==sr*(sr+1))

%o n = tn = 0

%o while 1:

%o for m in range(1, 1000000000):

%o if isTriangular(tn + m*(m+1)): break

%o print str(m)+',',

%o n += 1

%o tn += n

%o (PARI) a(n)=for(k=1,2*n,t=n*(n+1)/2+k*(k+1);x=sqrtint(2*t);if(t==x*(x+1)/2,return(k))) /* from _Ralf Stephan_ */

%Y Cf. A000217, A002378, A082183.

%Y Cf. A101157 (least k>0 such that triangular(n) + k^2 is a triangular number).

%K nonn

%O 0,1

%A _Alex Ratushnyak_, May 17 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 09:04 EDT 2024. Contains 371240 sequences. (Running on oeis4.)