Numbers with prime digits whose sum is 13: Difference between revisions
Content added Content deleted
(Realize in F#) |
m (→{{header|REXX}}: simplified code.) |
||
Line 309: | Line 309: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
<lang rexx>/*REXX pgm finds and displays all decimal numbers whose digits are prime and sum to 13. */ |
<lang rexx>/*REXX pgm finds and displays all decimal numbers whose digits are prime and sum to 13. */ |
||
LO= 337; HI= 322222 |
LO= 337; HI= 322222; #= 0 /*define low&high range for #s; # count*/ |
||
pDigs= 2357; #= 0 /*define prime digits; found #s count.*/ |
|||
$= /*variable to hold the list of #s found*/ |
$= /*variable to hold the list of #s found*/ |
||
do j=LO for HI-LO+1 /*search for numbers in this range. */ |
do j=LO for HI-LO+1 /*search for numbers in this range. */ |
||
if verify(j, |
if verify(j, 2357) \== 0 then iterate /*J must be comprised of prime digits.*/ |
||
parse var j a 2 b 3 '' -1 z /*parse: 1st, 2nd, & last decimal digs.*/ |
parse var j a 2 b 3 '' -1 z /*parse: 1st, 2nd, & last decimal digs.*/ |
||
sum= a + b + z /*sum: " " " " " " */ |
sum= a + b + z /*sum: " " " " " " */ |