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!)
A238456 Triangular numbers t such that t+x+y is a square, where x and y are the two squares nearest to t. 2

%I #19 May 05 2021 18:20:07

%S 0,2211,5151,1107816,20959575,4237107540,1564279847151,61066162885575,

%T 2533192954461975,2774988107938203,90728963274006291,

%U 18765679728507154152720

%N Triangular numbers t such that t+x+y is a square, where x and y are the two squares nearest to t.

%C For triangular numbers t such that t*x*y is a square, see A001110 (t is both triangular and square).

%C a(13) > 5*10^22. - _Giovanni Resta_, Mar 02 2014

%e The two squares nearest to triangular(101)=5151 are 71^2 and 72^2. Because 5151 + 71^2 + 72^2 = 15376 is a perfect square, 5151 is in the sequence.

%t sqQ[n_]:=Module[{c=Floor[Sqrt[n]]-1,x},x=Total[Take[SortBy[ Range[ c,c+3]^2, Abs[#-n]&],2]];IntegerQ[Sqrt[n+x]]]; Select[ Accumulate[ Range[ 0, 5000000]], sqQ] (* This will generate the first 7 terms of the sequence. To generate more, increase the second constant within the Range function, but computations will take a long time. *) (* _Harvey P. Dale_, May 12 2014 *)

%o (Python)

%o def isqrt(a):

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

%o while a < sr*sr: sr>>=1

%o b = sr>>1

%o while b:

%o s = sr + b

%o if a >= s*s: sr = s

%o b>>=1

%o return sr

%o t = i = 0

%o while 1:

%o t += i

%o i += 1

%o s = isqrt(t)

%o if s*s==t: s-=1

%o txy = t + 2*s*(s+1) + 1 # t + s^2 + (s+1)^2

%o r = isqrt(txy)

%o if r*r==txy: print(str(t), end=',')

%Y Cf. A000217, A000290, A001110, A238489.

%K nonn,hard,more

%O 1,2

%A _Alex Ratushnyak_, Feb 26 2014

%E a(12) from _Giovanni Resta_, Mar 02 2014

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 16 04:38 EDT 2024. Contains 371696 sequences. (Running on oeis4.)