galois.ilog

class galois.ilog(n, b)

Finds the integer \(\textrm{log}_b(n) = k\), such that \(b^k \le n\).

Parameters
  • n (int) – A positive integer.

  • b (int) – The logarithm base \(b\).

Returns

The integer \(\textrm{log}_b(n) = k\), such that \(b^k \le n\).

Return type

int

Examples

In [1]: galois.ilog(27**5 - 1, 27)
Out[1]: 4

In [2]: galois.ilog(27**5, 27)
Out[2]: 5

In [3]: galois.ilog(27**5 + 1, 27)
Out[3]: 5