Jump to content

Ordered partitions: Difference between revisions

m
→‎{{header|REXX}}: changed comments and added whitespace.
m (→‎{{header|REXX}}: changed comments and added whitespace.)
Line 1,770:
end /*i*/ /* [↑] may have an omitted argument. */
/* [↓] process each of the arguments. */
do j=1 for #; _= arg(j) /* _: is the Jth argument. */
len.j=max(1, _) /*LEN: length of args, 0=special. */
bot.j=left(d, _); if _==0 then bot.j=0 /*define the bottom number. */
Line 1,779:
end /*j*/
 
okD=left(0 || d, t + 1) /*define the legal digits to be used. */
say center(' partitions for: ' hdr" ", 60, '─') /*display centered title for the output*/
say
do g=low to high /* [↑] generate the ordered partitions*/
if verify(g, okD) \==0 then iterate /*filter out unwanted decimal digits. */
p=1 /*P: is the position of a decimal dig.*/
$= /*$: will be the transformed numbers. */
do k=1 for #; _=substr(g, p, len.k) /*verify the partitions numbers. */
if verify(_, @.k) \==0 then iterate g /*is the decimal digit not valid ? /*validate number: dups/ordered/repeats*/
_=substr(g,p,len.k) /*ordered partition number to be tested*/
if verify(_, @.k)\==0 then iterate g /*is the decimal digit not valid ? */
!= /* [↓] validate the decimal number. */
if @.k\==0 then do j=1 for length(_); z=substr(_, j, 1)
Line 1,799 ⟶ 1,797:
end /*j*/
p=p + len.k /*point to the next decimal number. */
$=$ ' {'strip( translate(!, ,0), ,",")'}' /*dress number up by suppressingsuppessing LZ ···*/
end /*k*/
say left('', 18) $ ' $ /*display numbers in ordered partition.*/
end /*g*/
say
Cookies help us deliver our services. By using our services, you agree to our use of cookies.