primes/primes.rexx

27 lines
315 B
Rexx
Raw Normal View History

2011-03-08 07:01:27 +00:00
/* REXX version of a Prime Number Finder
haplo@mindstab.net */
max=arg(1)
sq=2
sqm=4
do cnt = 3 to max by +2
isp = 1
i = 3
do while i <= sq & isp = 1
if cnt // i = 0 then
do
isp = 0
end
i = i + 2
end
if isp \= 0 then
say cnt
if cnt >= sqm then
do
sq = sq+1
sqm = sq*sq
end
end