login
A124608
Position of the first 8 in the decimal expansion of the square root of n, or -1 if 8 never appears.
0
-1, -1, 19, 8, -1, 15, 6, 45, 2, -1, 13, 17, 18, 15, 9, 2, -1, 20, 9, 4, 20, 3, 11, 5, 2, -1, 15, 17, 15, 3, 26, 11, 5, 13, 2, 9, -1, 3, 13, 10, 16, 14, 3, 7, 9, 4, 3, 2, 4, -1, 8, 7, 16, 3, 4, 7, 3, 5, 11, 3, 14, 2, 2, 23, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 6, 16, 9, 14, 7, 12, 3, 6, 3, 26, 18, 36, 11, 11, 7, 2, 2, 5, -1
OFFSET
0,3
MATHEMATICA
Table[Position[RealDigits[Sqrt[n], 10, 50][[1]], 8, 1, 1]/.{}->-1, {n, 0, 100}]//Flatten (* Harvey P. Dale, May 29 2024 *)
PROG
(PARI) digitpos(n, m) = /* m-th digit in sqrt expansions */ { local(x, y, r, dot); default(realprecision, 1000); for(x=0, n, r = sqrt(x); if(issquare(x), y=find(Str(floor(r)), m), y=find(Str(r), m); 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
Sequence in context: A040347 A040346 A364786 * A218162 A064264 A040345
KEYWORD
base,easy,sign
AUTHOR
Cino Hilliard, Dec 22 2006, corrected Jul 18 2007
STATUS
approved