login
a(n) = least integer m such that concatenating n distinct nonzero squares <= m^2 in ascending order yields a perfect square.
0

%I #37 Dec 09 2025 13:59:51

%S 1,3,6,10,14,29,29,70

%N a(n) = least integer m such that concatenating n distinct nonzero squares <= m^2 in ascending order yields a perfect square.

%C a(n) <= square root of the largest of the n squares that was used to construct A391022(n).

%e Case n=2: Squares <= 3^2 = 9 are 1,4,9.

%e Concatenating 4 and 9 gives 49, which is 7^2. Thus a(2) = 3.

%o (Python)

%o from math import isqrt

%o from itertools import combinations, count

%o def is_square(n): return isqrt(n)**2 == n

%o def a(n):

%o squares = [str(i*i) for i in range(1, n)]

%o for m in count(n):

%o mm = str(m**2)

%o for c in combinations(squares, n-1):

%o if is_square(s:=int("".join(c)+mm)):

%o return m # use s to obtain the concatenation of squares

%o squares.append(mm)

%o print([a(n) for n in range(1, 8)]) # _Michael S. Branicky_, Dec 03 2025

%Y Cf. A019521, A391022.

%K nonn,base,more

%O 1,2

%A _Jean-Marc Rebert_, Dec 02 2025