login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A333355 Number of bits in binary expansion of n minus the number of digits of n when written in base 3. 0
0, 1, 0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 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, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,8

COMMENTS

Record highs are at n = 2^A054414.  All n=2^k >= 2 are increases, all n=3^j are decreases, and there is either one or none 3^j between 2^(k-1) and 2^k.  When one, a(2^k) = a(2^(k-1)) so not a record high.  When none, a(2^k) = a(2^(k-1)) + 1 which is a record high.  If 2^k and 2^(k-1) are the same length in ternary then there is no 3^j between them.  This is when 2^k has most significant ternary digit 2 since 2^(k-1) >= 3^j is 2^k >= 2*3^j.  These k are A054414.  Non-record increases are at its complement n = 2^A020914 >= 2. - Kevin Ryde, Apr 04 2020

LINKS

Table of n, a(n) for n=1..87.

FORMULA

a(n) = A000523(n) - A062153(n) = floor(log_2(n)) - floor(log_3(n)).

a(n) = length(A007088(n)) - length(A007089(n)).

EXAMPLE

a(8) = 2 = 4 - 2 for binary 1000 and ternary 22.

a(64) = 3 = 7 - 4 for binary 1000000 and ternary 2101.

MAPLE

a:= n-> ilog[2](n)-ilog[3](n):

seq(a(n), n=1..100);  # Alois P. Heinz, Mar 15 2020

MATHEMATICA

a[n_]: = Floor @ Log[2, n] - Floor @ Log[3, n]; Array[a, 100] (* Amiram Eldar, Mar 16 2020 *)

PROG

(Rexx)

L = 1 ;  M = 1 ;  B = 2 ;  T = 3       ;  S = 0

do N = 2 while length( S ) < 258

   if B = N then  do    ;  B = B * 2   ;  L = L + 1   ;  end

   if T = N then  do    ;  T = T * 3   ;  M = M + 1   ;  end

   S = S || ', ' L - M

end N

say S                   ;  return S

(PARI) a(n) = logint(n, 2) - logint(n, 3); \\ Kevin Ryde, May 15 2020

CROSSREFS

Cf. A007088 ( binary), A000523 (floor(log_2(n)), A029837.

Cf. A007089 (ternary), A062153 (floor(log_3(n)), A117966.

Sequence in context: A030615 A336766 A147753 * A116531 A101871 A101875

Adjacent sequences:  A333352 A333353 A333354 * A333356 A333357 A333358

KEYWORD

nonn,base,easy

AUTHOR

Frank Ellermann, Mar 15 2020

STATUS

approved

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 August 12 17:17 EDT 2020. Contains 336439 sequences. (Running on oeis4.)