login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A124601
Position of the first 1 in the decimal expansion of the square root of n, or -1 if 1 never appears.
0
-1, 1, 1, 1, -1, 23, 14, 7, 8, -1, 2, 3, 5, 7, 4, 15, -1, 2, 11, 25, 5, 26, 6, 7, 17, -1, 6, 2, 4, 5, 13, 16, 17, 24, 7, 3, -1, 15, 2, 26, 41, 5, 57, 23, 12, 25, 11, 13, 17, -1, 4, 2, 3, 5, 22, 3, 6, 32, 3, 4, 12, 3, 12, 11, -1, 24, 2, 2, 6, 12, 22, 5, 7, 12, 19, 25, 3, 14, 4, 5, 7
OFFSET
0,6
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.
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: A199713 A064735 A104958 * A040508 A305943 A318090
KEYWORD
base,easy,sign
AUTHOR
Cino Hilliard, Dec 22 2006, corrected Jul 18 2007
STATUS
approved