login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A124601 Position of the first 1 in the decimal expansion of the square root of n, or -1 if 1 never appears. 0

%I #7 Mar 09 2015 04:47:32

%S -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,

%T 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,

%U 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

%N Position of the first 1 in the decimal expansion of the square root of n, or -1 if 1 never appears.

%e 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.

%o (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); }

%K base,easy,sign

%O 0,6

%A _Cino Hilliard_, Dec 22 2006, corrected Jul 18 2007

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 19:48 EDT 2024. Contains 371754 sequences. (Running on oeis4.)