OFFSET
0,3
EXAMPLE
For n=5, sqrt(5) = 2.23606797749978969640917366873127623544...
5 occurs in the 37th position so 37 is the 6th entry in the table counting from the 0th entry.
PROG
(PARI) digitpos(n) = { local(x, y, r, dot); for(x=0, n, r=sqrt(x); if(issquare(x), y=find(Str(floor(r)), x), y=find(Str(r), x); dot=find(Str(r), "."); if(dot < y, y--); ); if(y, print1(y", "), print1(-1", ") ) ) }
find(str, match) = /* Revised 2007 */ { local(lnm, lns, tstr, vstr, x, j); vstr=Vec(Str(str)); match=Str(match); lns=length(str); lnm=length(match); for(x=1, lns-lnm+1, tstr=""; for(j=x, x+lnm-1, tstr=concat(tstr, vstr[j]); ); if(match==tstr, return(x)) ); return(0); }
CROSSREFS
KEYWORD
base,easy,sign
AUTHOR
Cino Hilliard, Dec 22 2006, corrected Jul 18 2007
STATUS
approved