login
2*k-digit squares with the left half being a reversed k-digit square and the right half being a k-digit square.
1

%I #30 Jun 17 2025 00:39:39

%S 49,1849,144400,148225,522729,16564900,40322500,46717225,98446084,

%T 98863249,1429293636,1697440000,4013222500,4228250625,4247128900,

%U 4684991809,5205622500,5227290000,6161465025,6557274529,104409765625,121975562500,123151864900,127413302500,140301186624

%N 2*k-digit squares with the left half being a reversed k-digit square and the right half being a k-digit square.

%H Michael S. Branicky, <a href="/A367378/b367378.txt">Table of n, a(n) for n = 1..1031</a> (all terms <= 40 digits)

%H David A. Corneth, <a href="/A367378/a367378.gp.txt">PARI program</a>

%e 522729 is in the sequence since reversed the left half is the square 15^2 and the right half is the square 27^2.

%e A 6-digit term might start with 522 as 522 is the reversal of a three-digit square (namely 225 = 15^2). If a 6-digit term starts with 522 then it is between (inclusive) 522100 and 522999. The only such square is 522729. As 729 (= 522729 - 522000) is a square we have 522729 is in the sequence. - _David A. Corneth_, Nov 21 2023

%o (Python)

%o from math import isqrt

%o from itertools import count, islice

%o def agen(): # generator of terms

%o for k in count(1):

%o lb, ub, sk = isqrt(10**(k-1)-1)+1, isqrt(10**k-1), set()

%o for i in range(lb, ub+1):

%o if i%10 == 0: continue

%o left = int(str(i*i)[::-1]) * 10**k

%o # loop below based on idea by _David A. Corneth_ in Example

%o lbt, ubt = isqrt(left-1)+1, isqrt(left + 10**k - 1)

%o for t in range(lbt, ubt+1):

%o tt = t*t

%o right = tt - left

%o sr = str(right)

%o if len(sr) == k and isqrt(right)**2 == right:

%o sk.add(tt)

%o yield from sorted(sk)

%o print(list(islice(agen(), 20))) # _Michael S. Branicky_, Nov 21 2023

%o (PARI) \\ See PARI link

%Y Cf. A000290, A004086.

%K nonn,base

%O 1,1

%A _Reiner Moewald_, Nov 15 2023

%E More terms from _David A. Corneth_, Nov 20 2023