login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A124686 Position of the first 1 in the decimal expansion of the cube root of n, or -1 if this digit never appears. 1

%I

%S -1,1,1,1,1,1,1,1,-1,13,2,15,11,4,3,6,3,4,7,7,3,8,17,13,8,6,26,-1,10,

%T 6,2,2,2,24,6,4,4,7,4,4,3,6,27,17,20,23,10,11,7,9,7,14,6,13,8,13,44,7,

%U 21,9,3,8,7,16,-1,27,4,4,4,2,2,2,2,2,2,3,17,11,10,17,21,9,7,10,6,11,3,4,8,28,4,7,3,45,22,35,12,38,3,11,4

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

%H Chai Wah Wu, <a href="/A124686/b124686.txt">Table of n, a(n) for n = 0..10000</a>

%t Off[First::first];Flatten[Table[First[Position[RealDigits[n^(1/3),10,120] [[1]],1]],{n,0,100}]/.First[{}]->-1] (* _Harvey P. Dale_, May 05 2012 *)(* to restore the error message, enter "On[First::first]" after running the program *)

%o (PARI) digitposcbrt(n,m) = \ cbrt expansion { local(x,y,r,dot); for(x=0,n, r = (x^(1/3)); if(iscube(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) = \Return the position of the first occurrence of string \match in string str { local(lnm,lns,x,c,i); str=Str(str); \This allows leaving quotes off input match=Str(match); c=0; i=0; lns=length(str); lnm=length(match); if(lnm>1,i=1); x=1; while(x<=lns-lnm+1, if(mid(str,x,lnm)== match,break,x++); ); if(x>lns,return(0),return(x)) } mid(str,s,n) = \ Get a substring of length n from string str starting at position s in str. { local(v,ln,x,tmp); v =""; tmp = Vec(str); ln=length(tmp); for(x=s,s+n-1, v=concat(v,tmp[x]); ); return(v) } iscube(n) = { local(r); r = n^(1/3); if(floor(r+.5)^3== n,1,0) }

%K base,easy,sign

%O 0,10

%A _Cino Hilliard_, Dec 24 2006

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 20 21:19 EDT 2019. Contains 327247 sequences. (Running on oeis4.)