Qurak

PowerMod

Khả dụng, khác với tài liệu tham chiếu .wl

Fast modular exponentiation — `PowerMod[b, e, m] == Mod[b^e, m]`.

`PowerMod[a, b, m]` computes `a^b mod m`. Modular inverses - the `b = -1` form - are the exception: above roughly 61-bit moduli the call returns unevaluated while smaller moduli work, which is exactly the field size cryptographic work uses. Until that is fixed, compute the inverse with `ExtendedGCD[a, m][[2, 1]]`, which is reliable at any size and returns the same value (reduce it with `Mod[..., m]` if you need the canonical representative).

PowerMod[a, b, m]
PowerMod[a, -1, m]
PowerMod[a, 1/ r, m]
PowerMod[2, 10, 100] → 24PowerMod[5, 1/3, 11] → 3

Được dùng trong

Chủ đề

Liên quan

Tất cả 6300 hàm · Dùng cái này từ một client MCP