I asked ChatGPT:
Write LiveCode script named “Find Prime” to find prime numbers up to the number to be specified.
command FindPrime
put field “Input” into tMax
put “” into field “Output”
if not isNumber(tMax) or tMax < 2 then
answer “Please enter a whole number greater than or equal to 2.”
exit FindPrime
end if
repeat with n = 2 to tMax
if isPrime(n) then
put n & return after field “Output”
end if
end repeat
end FindPrime
function isPrime p
if p = 2 then return true
if p mod 2 = 0 then return false
repeat with i = 3 to sqrt(p) step 2
if p mod i = 0 then return false
end repeat
return true
end isPrime
Somehow, the script misses “3” as a prime number.