OFFSET
1,1
COMMENTS
a(n) = 1 correspond to n = A132356(m), m > 0. - Bill McEachen, Aug 31 2023
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
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
AUTHOR
Reinhard Zumkeller, May 15 2002
STATUS
approved