Jump to content

Super-Poulet numbers: Difference between revisions

→‎{{header|Wren}}: Tweak, bit quicker.
(Added Wren)
(→‎{{header|Wren}}: Tweak, bit quicker.)
Line 125:
import "./gmp" for Mpz
import "./fmt" for Fmt
 
var one = Mpz.one
 
var isSuperPoulet = Fn.new { |x|
if (Int.isPrime(x)) return false
var bx = Mpz.from(x)
if (Mpz.two.modPow(bxx-1, bx) != 1one) return false
var t = Mpz.new()
return Int.divisors(x).skip(1).all { |d| t.uiPow(2, d).sub(2).isDivisibleUi(d) }
9,482

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.