

A359800


a(n) is the least m such that the concatenation of n^2 and m is a square.


1



6, 9, 61, 9, 6, 1, 284, 516, 225, 489, 104, 4, 744, 249, 625, 3201, 444, 9, 201, 689, 4201, 416, 984, 4801, 681, 5201, 316, 996, 5801, 601, 6201, 144, 936, 6801, 449, 7201, 7401, 804, 7801, 225, 8201, 8401, 6, 8801, 9001, 9201, 9401, 324, 9801, 19344, 769, 38025
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

The only onedigit terms are 1, 4, 6 and 9. Proof: Squares mod 10 are 0, 1, 4, 5, 6 and 9. Concatenation of a square and 0 is 10 times that square, which is not a square. So 0 is ruled out. Squares with last digit 5 have second last digit 2. Since no square ends in 2, 5 is also ruled out.
The only term with two digits is a(3) = 61.
Some terms with an odd number of digits appear infinitely often, for example, 516 for n = 8, 1352, 632958674, ... .
If a term has an even number of digits and is of the form 1+2*k*10^(d+1) with 10^d <= 2*k < 10^(d+1), then it appears only once at k = n in this sequence. Are terms with an even number of digits possible which are not of this form? (End)


LINKS



FORMULA



EXAMPLE

For n=3, 61 is the least number m such that the concatenation of 3^2 and m is a square: 961 = 31^2. So a(3) = 61.
For n=7, 284 is the least number m such that the concatenation of 7^2 and m is a square: 49284 = 222^2. So a(7) = 284.


PROG

(Python)
from math import isqrt
def a(n):
t, k = str(n*n), isqrt(10*n**2)
while not (s:=str(k*k)).startswith(t) or s[len(t)]=="0": k += 1
return int(s[len(t):])
(Python)
from math import isqrt
from sympy.ntheory.primetest import is_square
m = 10*n*n
if is_square(m): return 0
a = 1
while (k:=(isqrt(a*(m+1)1)+1)**2m*a)>=10*a:
a *= 10
(PARI) a(n)={my(m=n^2, b=1); while(1, m*=10; my(r=(sqrtint(m+b1)+1)^2m); b*=10; if(r<b, return(r)))} \\ Andrew Howroyd, Jan 13 2023


CROSSREFS



KEYWORD



AUTHOR



STATUS

approved



