Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

OpenSSL::BN#prime?

bn.prime? => true | false
bn.prime?(checks) => true | false

Performs a Miller-Rabin probabilistic primality test with checks iterations. If checks is not specified, a number of iterations is used that yields a false positive rate of at most 2^-80 for random input.

Parameters

  • checks - integer

See also #pretty_print #prime_fasttest? #one? #rshift! also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1