Erdős-primes: Difference between revisions

Content added Content deleted
(→‎{{header|REXX}}: added the computer programming language REXX.)
m (→‎{{header|REXX}}: changed some whitespace and comments.)
Line 18: Line 18:
primes= 0 /*initialize the number of Erdős primes*/
primes= 0 /*initialize the number of Erdős primes*/
$= /*a list of Erdős primes (so far). */
$= /*a list of Erdős primes (so far). */
do j=1 until j>=n /*lets now search for Erdős primes. */
do j=1 until j>=n; if \!.j then iterate /*Is J not a prime? Then skip it. */
if \!.j then iterate /*Is J not a prime? Then skip it. */
_= sumDigs(j); if \!._ then iterate /*Is sum of J's digs a prime? No, skip.*/
_= sumDigs(j); if \!._ then iterate /*Is sum of J's digs a prime? No, skip.*/
primes= primes + 1 /*bump the count of Erdős primes. */
primes= primes + 1 /*bump the count of Erdős primes. */
if Ocols<1 then iterate /*Build the list (to be shown later)? */
if Ocols<1 then iterate /*Build the list (to be shown later)? */
$= $ right(j, w) /*add the Erdős prime to the $ list. */
$= $ right(j, w) /*add the Erdős prime to the $ list. */
if primes//cols\==0 then iterate /*have we populated a line of output? */
if primes//cols\==0 then iterate /*have we populated a line of output? */
say substr($, 2); $= /*display what we have so far (cols). */
say substr($, 2); $= /*display what we have so far (cols). */
end /*j*/
end /*j*/