A110591 Number of digits in base-4 representation of n.
1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
Offset: 0
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
Haskell
import Data.List (unfoldr) a110591 0 = 1 a110591 n = length $ unfoldr (\x -> if x == 0 then Nothing else Just (x, x `div` 4)) n -- Reinhard Zumkeller, Apr 22 2011
-
Maple
A110592 := proc(n) if n = 0 then 1; else 1+floor(log[4](n)) ; end if; end proc: seq(A110592(n),n=0..50) ; # R. J. Mathar, Sep 02 2020
-
Mathematica
a[n_] := If[n == 0, 1, Floor[Log[4, n]] + 1]; a /@ Range[0, 100] (* Jean-François Alcover, Nov 24 2020 *)
Formula
G.f.: 1 + (1/(1 - x))*Sum_{k>=0} x^(4^k). - Ilya Gutkovskiy, Jan 08 2017
a(n) = floor(log_4(n)) + 1 for n >= 1. - Petros Hadjicostas, Dec 12 2019
Comments