OFFSET
0,6
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
EXAMPLE
For n=5, the concatenated digits of sqrt(5) are 223606797749978969640917366... The digit 1 first occurs in the 23rd position of this string of digits. So 23 is the 6th entry in the table counting from the 0th entry.
MAPLE
f:= proc(n) local x, s, j, k;
if issqr(n) then
s:= convert(sqrt(n), base, 10);
for j from 1 to nops(s) do
if s[-j] = 1 then return j fi
od;
return -1
fi;
x:= n/100^ilog[100](n);
s:= floor(sqrt(x));
if s = 1 then return 1 fi;
for j from 2 do
x:= 100*x;
for k from 1 to 10 do
if (10*s+k)^2 > x then
if k = 2 then return j fi;
s:= 10*s+k-1;
break
fi;
od;
od
end proc;
map(f, [$0..100]); # Robert Israel, Jan 25 2026
PROG
(PARI)
finddig(n, x)={my(d=digits(n)); for(i=1, #d, if(d[i]==x, return(i))); -1}
a(n) = {if(issquare(n), finddig(sqrtint(n), 1), my(m=2, z=-1); while(z<0, z=finddig(sqrtint(n*100^m), 1); m*=2); z)} \\ Andrew Howroyd, Jan 25 2026
CROSSREFS
KEYWORD
base,easy,sign
AUTHOR
Cino Hilliard, Dec 22 2006, corrected Jul 18 2007
STATUS
approved
