Sequence of primes by trial division: Difference between revisions

m
→‎somewhat optimized: used newline instead of break.
m (→‎somewhat optimized: expanded the vinculum.)
m (→‎somewhat optimized: used newline instead of break.)
Line 961:
This is an open-ended approach and it's a simple implementation and could be optimized more with some easy programming.
<br>The method used is to divided all odd numbers by all previous odd primes up to and including the &nbsp; <big>'''√{{overline| &nbsp;}}'''</big> &nbsp; of the odd number.
 
<br>Usage note: &nbsp; by using a negative number (for the program's argument), the list of primes is suppressed, but the prime count is still shown.
<lang rexx>/*REXX pgm lists a sequence of primes by testing primality by trial div.*/
parse arg n . /*let user choose how many, maybe*/