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

%I #64 Feb 16 2023 15:15:29

%S 6,9,61,9,6,1,284,516,225,489,104,4,744,249,625,3201,444,9,201,689,

%T 4201,416,984,4801,681,5201,316,996,5801,601,6201,144,936,6801,449,

%U 7201,7401,804,7801,225,8201,8401,6,8801,9001,9201,9401,324,9801,19344,769,38025

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

%C The only one-digit 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.

%C From _Thomas Scheuerle_, Jan 14 2023: (Start)

%C The only term with two digits is a(3) = 61.

%C Some terms with an odd number of digits appear infinitely often, for example, 516 for n = 8, 1352, 632958674, ... .

%C 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)

%H Chai Wah Wu, <a href="/A359800/b359800.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Sq#sqtrunc">Index to sequences related to truncating digits of squares</a>.

%F a(n) = A071176(n^2) = A071176(A000290(n)).

%F From _Thomas Scheuerle_, Jan 13 2023: (Start)

%F a(A084070(n)) = 1.

%F a(2*A084070(n)) = 4.

%F a(A221874(n)) = 6.

%F a(A075836(n)) = 9. (End)

%e 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.

%e 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.

%o (Python)

%o from math import isqrt

%o def a(n):

%o t, k = str(n*n), isqrt(10*n**2)

%o while not (s:=str(k*k)).startswith(t) or s[len(t)]=="0": k += 1

%o return int(s[len(t):])

%o print([a(n) for n in range(1, 53)]) # _Michael S. Branicky_, Jan 15 2023

%o (Python)

%o from math import isqrt

%o from sympy.ntheory.primetest import is_square

%o def A359800(n):

%o m = 10*n*n

%o if is_square(m): return 0

%o a = 1

%o while (k:=(isqrt(a*(m+1)-1)+1)**2-m*a)>=10*a:

%o a *= 10

%o return k # _Chai Wah Wu_, Feb 15 2023

%o (PARI) a(n)={my(m=n^2, b=1); while(1, m*=10; my(r=(sqrtint(m+b-1)+1)^2-m); b*=10; if(r<b, return(r)))} \\ _Andrew Howroyd_, Jan 13 2023

%Y Cf. A000290, A071176, A075836, A084070, A221874, A246560.

%K nonn,look,base

%O 1,1

%A _Mohammed Yaseen_, Jan 13 2023