Find prime numbers of the form n*n*n+2: Difference between revisions

m
→‎{{header|REXX}}: added some wording to the REXX section header.
mNo edit summary
m (→‎{{header|REXX}}: added some wording to the REXX section header.)
Line 195:
 
=={{header|REXX}}==
Since REXX doesn't have a &nbsp; '''isPrime''' &nbsp; function, &nbsp; this REXX program generates a number of primes such that some <br>numbers can be tested for primality directly, &nbsp; other numbers have to be tested by trial division for primality. &nbsp;
 
A suitable number was calculated to generate a number of primes such that about half of the computing time used to
<br>test the numbers for primality could be directly determined their primality, &nbsp; the other half of the computing time used
<br>would use trial division.
 
Since the task's requirements are pretty straight-forward and easy, &nbsp; a little extra code was added for presentation
<br>(title and title separator line, &nbsp; the count of primes found, &nbsp; and commatization of the numbers).
<lang rexx>/*REXX program finds and displays n primes of the form: n**3 + 2. */
parse arg LO HI hp . /*obtain optional argument from the CL.*/
Line 214 ⟶ 222:
if x//@.k==0 then iterate j
end /*k*/
finds= finds + 1 /*bump # of pimesprimes found of form: n**3+2 */
say right(commas(j), 20) right( commas(x), w)
end /*j*/