Factors of an integer: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Minor tidy) |
Not a robot (talk | contribs) (add Refal) |
||
Line 6,029: | Line 6,029: | ||
print mold/flat sort factors num |
print mold/flat sort factors num |
||
]</syntaxhighlight> |
]</syntaxhighlight> |
||
=={{header|Refal}}== |
|||
<syntaxhighlight lang="refal">$ENTRY Go { |
|||
= <Prout <Factors 120>>; |
|||
} |
|||
Factors { |
|||
s.N = <Factors (s.N 1)>; |
|||
(s.N s.D), <Compare s.N <* s.D s.D>>: '-' = ; |
|||
(s.N s.D), <Divmod s.N s.D>: { |
|||
(s.D) 0 = s.D; |
|||
(s.F) 0 = s.D <Factors (s.N <+ 1 s.D>)> s.F; |
|||
(s.X) s.Y = <Factors (s.N <+ 1 s.D>)>; |
|||
}; |
|||
};</syntaxhighlight> |
|||
{{out}} |
|||
<pre>1 2 3 4 5 6 8 10 12 15 20 24 30 40 60 120</pre> |
|||
=={{header|Relation}}== |
=={{header|Relation}}== |