You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
315 B

/* 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