I think the below is correct, but I could be wrong again. But down to an issue. I think $isprime would be a good identifier, but how many else would use it? Hopefully $isprime(number,0) would count 1 as not a prime. And $isprime(number,1) would count 1 as a prime. There are some who consider one as a prime. Why they do, it's because of the theory the numbers 1, 2, and 3 compose all of reality.
isprime {
var %t $ticks
if ($len($1) > 19) { return $ $+ error | halt }
if ($1 !isnum) { return $ $+ error | halt }
if ($1 < 1) { return $false | halt }
if ($1 != $int($1)) { return $false | halt }
if ($istok(1 2 3,$1,32)) { return $true | halt }
if (2 // $1) { return $false | halt }
var %n 1
var %a $sqrt($1)
while (%n < %a) {
inc %n 2
if (%n // $1) { return $false $calc($ticks - %t) | halt }
}
return $true $calc($ticks - %t)
}