Mersenne primes: Difference between revisions

m
(Added Lua version)
Line 607:
=={{header|Lua}}==
This checks for primality using a trial division function. The limitation is 'until p == p + 1', meaning that the program will halt when Lua's number type (a 64-bit floating point value) no longer has enough precision to distiguish between one integer and the next.
<lang lua>-- Returns a boolean indicateto show whether x is prime
function isPrime (x)
if x < 2 then return false end
Anonymous user