Factors of an integer: Difference between revisions
m
→{{header|R}}: Syntax highlighting.
(Moved Polyglot:PL/I and PL/M into the correct place) |
ReeceGoding (talk | contribs) m (→{{header|R}}: Syntax highlighting.) |
||
Line 5,379:
=={{header|R}}==
===Array solution===
<lang
{
if(length(n) > 1)
Line 5,404:
===Filter solution===
With identical output, a more idiomatic way is to use R's Filter.
<lang
#Vectorize is an interesting alternative to the previous solution's lapply.
manyFactors <- function(vec) Vectorize(factors)(vec)</lang>
|