login
A071176
Smallest k such that the concatenation of n and k is a square (decimal notation).
6
6, 5, 6, 9, 29, 4, 29, 1, 61, 0, 56, 1, 69, 4, 21, 9, 64, 49, 6, 25, 16, 5, 104, 336, 6, 244, 225, 9, 16, 25, 36, 4, 64, 81, 344, 1, 21, 44, 69, 0, 209, 25, 56, 1, 369, 24, 61, 4, 284, 41, 84, 9, 29, 76, 225, 25, 6, 564, 29, 84, 504, 5, 504
OFFSET
1,1
COMMENTS
a(n) = 1 correspond to n = A132356(m), m > 0. - Bill McEachen, Aug 31 2023
LINKS
FORMULA
A000196(n . a(n)) = A071177(n) where "." stands for concatenation.
EXAMPLE
a(5) = 29 as 529 = 23^2 and 5'i is nonsquare for i<29, A071177(5)=23.
MATHEMATICA
nksq[n_]:=Module[{idn=IntegerDigits[n], k=0}, While[!IntegerQ[Sqrt[ FromDigits[Join[ idn, IntegerDigits[k]]]]], k++]; k]; Array[nksq, 70] (* Harvey P. Dale, Sep 28 2012 *)
PROG
(Haskell)
import Data.List (findIndex)
import Data.Maybe (fromJust)
a071176 n = fromJust $ findIndex (== 1) $
map (a010052 . read . (show n ++) . show) [0..]
-- Reinhard Zumkeller, Aug 09 2011
(PARI) a(n)={if(issquare(10*n), 0, my(m=n, 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
(Python)
from math import isqrt
from sympy.ntheory.primetest import is_square
def A071176(n):
m = 10*n
if is_square(m): return 0
a = 1
while (k:=(isqrt(a*(m+1)-1)+1)**2-m*a)>=10*a:
a *= 10
return k # Chai Wah Wu, Feb 15 2023
CROSSREFS
KEYWORD
nonn,base,nice,look
AUTHOR
Reinhard Zumkeller, May 15 2002
STATUS
approved