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!)
A102572 a(n) = floor(log_4(n)). 13

%I #17 Sep 08 2022 08:45:16

%S 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,

%T 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,

%U 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3

%N a(n) = floor(log_4(n)).

%F G.f.: (1/(1 - x))*Sum_{k>=1} x^(4^k). - _Ilya Gutkovskiy_, Jan 08 2017

%o (Magma) [ Ilog(4,n) : n in [1..150] ];

%o (PARI) a(n)=#digits(n,4)-1 \\ Twice as fast as a(n)=for(i=0,n,(n>>=2)||return(i)); the naïve code a(n)=log(n)\log(4) works for standard realprecision=28 only up to n=4^47-5 and it is slower by another factor 2. - _M. F. Hasler_, Mar 11 2015

%o (PARI) A102572(n)=logint(n,4) \\ _M. F. Hasler_, Nov 07 2019

%Y Cf. A000523, A062153.

%K nonn

%O 1,16

%A _N. J. A. Sloane_, Dec 23 2006

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 25 06:49 EDT 2024. Contains 371964 sequences. (Running on oeis4.)