login
A367378
2*k-digit squares with the left half being a reversed k-digit square and the right half being a k-digit square.
1
49, 1849, 144400, 148225, 522729, 16564900, 40322500, 46717225, 98446084, 98863249, 1429293636, 1697440000, 4013222500, 4228250625, 4247128900, 4684991809, 5205622500, 5227290000, 6161465025, 6557274529, 104409765625, 121975562500, 123151864900, 127413302500, 140301186624
OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..1031 (all terms <= 40 digits)
David A. Corneth, PARI program
EXAMPLE
522729 is in the sequence since reversed the left half is the square 15^2 and the right half is the square 27^2.
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
PROG
(Python)
from math import isqrt
from itertools import count, islice
def agen(): # generator of terms
for k in count(1):
lb, ub, sk = isqrt(10**(k-1)-1)+1, isqrt(10**k-1), set()
for i in range(lb, ub+1):
if i%10 == 0: continue
left = int(str(i*i)[::-1]) * 10**k
# loop below based on idea by David A. Corneth in Example
lbt, ubt = isqrt(left-1)+1, isqrt(left + 10**k - 1)
for t in range(lbt, ubt+1):
tt = t*t
right = tt - left
sr = str(right)
if len(sr) == k and isqrt(right)**2 == right:
sk.add(tt)
found += len(sk)
yield from sorted(sk)
print(list(islice(agen(), 20))) # Michael S. Branicky, Nov 21 2023
(PARI) \\ See PARI link
CROSSREFS
Sequence in context: A145848 A014942 A260856 * A065785 A163927 A245036
KEYWORD
nonn,base
AUTHOR
Reiner Moewald, Nov 15 2023
EXTENSIONS
More terms from David A. Corneth, Nov 20 2023
STATUS
approved