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!)
A226789 Triangular numbers obtained as the concatenation of n+1 and n. 3

%I #18 Oct 22 2021 23:57:10

%S 10,21,26519722651971,33388573338856,69954026995401,80863378086336

%N Triangular numbers obtained as the concatenation of n+1 and n.

%C There are only six terms less than 10^20.

%e 26519722651971 is the concatenation of 2651972 and 2651971 and a triangular number, because 26519722651971 = 7282818*7282819/2.

%t TriangularQ[n_] := IntegerQ[Sqrt[1 + 8*n]]; t = {}; Do[s = FromDigits[Join[IntegerDigits[n+1], IntegerDigits[n]]]; If[TriangularQ[s], AppendTo[t, s]], {n, 100000}]; t (* _T. D. Noe_, Jun 18 2013 *)

%o (PARI)

%o concatint(a,b)=eval(concat(Str(a),Str(b)))

%o istriang(x)=issquare(8*x+1)

%o {for(n=1,10^7,a=concatint(n+1,n);if(istriang(a),print(a)))}

%o (Python)

%o from math import isqrt

%o def istri(n): t = 8*n+1; return isqrt(t)**2 == t

%o def afind(klimit, kstart=0):

%o strk = "0"

%o for k in range(kstart, klimit+1):

%o strkp1 = str(k+1)

%o t = int(strkp1 + strk)

%o if istri(t):

%o print(t, end=", ")

%o strk = strkp1

%o afind(81*10**5) # _Michael S. Branicky_, Oct 21 2021

%o (Python) # alternate version

%o def isconcat(n):

%o if n < 10: return False

%o s = str(n)

%o mid = (len(s)+1)//2

%o lft, rgt = int(s[:mid]), int(s[mid:])

%o return lft - 1 == rgt

%o def afind(tlimit, tstart=0):

%o for t in range(tstart, tlimit+1):

%o trit = t*(t+1)//2

%o if isconcat(trit):

%o print(trit, end=", ")

%o afind(13*10**6) # _Michael S. Branicky_, Oct 21 2021

%Y Cf. A003098, A068899, A226742, A226772, A226788.

%K nonn,base,more

%O 1,1

%A _Antonio Roldán_, Jun 18 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 April 17 23:23 EDT 2024. Contains 371767 sequences. (Running on oeis4.)