galois.ilog¶
- galois.ilog(n, b)¶
Computes \(x = \lfloor\textrm{log}_b(n)\rfloor\) such that \(b^x \le n < b^{x + 1}\).
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:
Feb 09, 2022