|
Search: id:A124601
|
|
|
| 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, -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
(list; graph; listen)
|
|
|
OFFSET
|
0,6
|
|
|
EXAMPLE
|
For n=5, the concatenated digits of sqrt(5) are 223606797749978969640917366... The digit 1 first occurs in the 23-rd position of this string of digits. So 23 is the 6-th entry in the table counting from the 0-th entry.
|
|
PROGRAM
|
(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: A070838 A064735 A104958 this_sequence A040508 A070716 A105818
Adjacent sequences: A124598 A124599 A124600 this_sequence A124602 A124603 A124604
|
|
KEYWORD
|
base,easy,nonn
|
|
AUTHOR
|
Cino Hilliard (hillcino368(AT)hotmail.com), Dec 22 2006, corrected Jul 18 2007
|
|
|
Search completed in 0.002 seconds
|