galois.ilog¶
- galois.ilog(n: int, b: int) int ¶
Computes \(x = \lfloor\textrm{log}_b(n)\rfloor\) such that \(b^x \le n < b^{x + 1}\).
- Parameters
- Returns
The integer logarithm base \(b\) of \(n\).
Examples
In [1]: n = 1000 In [2]: x = galois.ilog(n, 5); x Out[2]: 4 In [3]: print(f"{5**x} <= {n} < {5**(x + 1)}") 625 <= 1000 < 3125
Last update:
Mar 30, 2022