Skip to main content

log3_strict_usize

Function log3_strict_usize 

Source
pub const fn log3_strict_usize(n: usize) -> usize
Expand description

Computes the strict base-3 logarithm of n.

Returns k such that 3^k == n. Panics if n is not a power of 3.

This is the base-3 analogue of log2_strict_usize.

§Arguments

  • n - A positive integer that must be a power of 3 (i.e., 1, 3, 9, 27, 81, …).

§Returns

The exponent k where 3^k == n.

§Panics

Panics if:

  • n is zero
  • n is not a power of 3