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!)
A124603 Position of the first 3 in the decimal expansion of the square root of n, or -1 if 3 never appears. 0

%I #7 May 02 2023 16:37:32

%S -1,-1,7,3,-1,3,13,8,22,1,1,1,1,1,1,1,-1,4,36,2,6,28,13,6,14,-1,10,15,

%T 22,2,18,8,14,12,3,10,-1,9,26,11,2,4,18,6,3,7,5,21,7,-1,25,23,21,23,2,

%U 23,4,6,7,30,15,17,24,3,-1,20,6,5,12,2,2,10,8,7,5,9,14,8,3,11,21,-1,5,6,8,17,4,2,2,3,6,3,7,4,5,8,12,42,9,8,-1

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

%t Table[Position[RealDigits[Sqrt[n],10,100][[1]],3,1,1],{n,0,100}]/.{}->-1//Flatten (* _Harvey P. Dale_, May 02 2023 *)

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

%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 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)