Count in factors: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added highlights and whitespace in the REXX section header. -- ~~~~) |
|||
Line 1,473: | Line 1,473: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
It couldn't be determined if the '''x''' (for |
It couldn't be determined if the '''x''' (for multiplication) was a strict requirement or |
||
<br>whether there're blanks surrounding the '''x''' (blanks were assumed for this example for readability). |
<br>whether there're blanks surrounding the '''x''' (blanks were assumed for this example for readability). |
||
<br>There's commented code that shows how to not include blanks around the '''x''' [see comment about BLANKS=0]. |
<br>There's commented code that shows how to not include blanks around the '''x''' [see comment about '''BLANKS=0''' (6th statement)]. |
||
<br><br>Also, as per the task's requirements, the prime factors of '''1''' (unity) will be listed as '''1''', |
<br><br>Also, as per the task's requirements, the prime factors of '''1''' (unity) will be listed as '''1''', |
||
<br>even though, strictly speaking, it should be '''null'''. |
<br>even though, strictly speaking, it should be '''null'''. |
||
<lang rexx>/*REXX program to find & list the prime factors of positive integer(s). */ |
<lang rexx>/*REXX program to find & list the prime factors of positive integer(s). */ |
||
numeric digits 100 /*bump precision of the numbers. */ |
numeric digits 100 /*bump precision of the numbers. */ |
||
Line 1,492: | Line 1,492: | ||
if x <1 then return '' /*invalid number? Return null. */ |
if x <1 then return '' /*invalid number? Return null. */ |
||
if x==1 then return 1 /*special case for unity. */ |
if x==1 then return 1 /*special case for unity. */ |
||
Xtimes='x' |
Xtimes= 'x' /*character used for "times" (x).*/ |
||
list= /*nullify the list (to empty). */ |
list= /*nullify the list (to empty). */ |
||