Project

General

Profile

Feature #12508

Integer#mod_pow

Added by metanest (Makoto Kishimoto) over 4 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:76084]

Description

A new method Integer#mod_pow, power with modulo.

a.mod_pow(b, m) #=> (a**b) % m

Sometimes a**b becomes very large number, then naive
implementation may be unefficient. Fast implementation
is useful.
(with USE_GMP symbol, this implement uses mpz_powm() )

(see https://github.com/ruby/ruby/pull/1320 )


Related issues

Has duplicate Ruby master - Feature #11003: Fast modular exponentiationClosedmatz (Yukihiro Matsumoto)Actions

Also available in: Atom PDF