Hi, again, Ladislav,

Ladislav Mecir wrote:
> 
> use [d] [
>     d: [2 3 5 7]
>     prime?: function [p] [c s l] [
>         l: to integer! square-root p
>         foreach v d [
>             if p // v = 0 [return p = v]
>             if v >= l [return true]
>         ]
>         c: (last d) + s: 6 - ((last d) // 3 * 2)
>         while [c <= l] [
>             if prime? c [
>                 append d c
>                 if p // c = 0 [return false]
>             ]
>             c: c + s: 6 - s
>         ]
>         true
>     ]
> ]
> 

Niceness restored!!

After I made the point earlier about testing only thru
the square root of the candidate, I'm glad you caught
my omission of that in the latter functions!

-jn-

-- 
; sub REBOL {}; sub head ($) {@_[0]}
REBOL []
# despam: func [e] [replace replace/all e ":" "." "#" "@"]
; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"}
print head reverse despam "moc:xedef#yleen:leoj" ;
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to