Anonymous user
Miller–Rabin primality test: Difference between revisions
→{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details
m (→{{header|Sidef}}: updated code) |
(→{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details) |
||
Line 2,281:
=={{header|Kotlin}}==
Translating the pseudo-code directly rather than using the Java library method BigInteger.isProbablePrime(certainty):
<lang scala>// version 1.1.
import java.math.BigInteger
Line 2,296:
s++
d = nn.shiftRight(s)
}
while (d % bigTwo == BigInteger.ZERO)
Line 2,316:
return false
}
return true
}
|