Factors of an integer: Difference between revisions
Content added Content deleted
ReeceGoding (talk | contribs) (→{{header|R}}: Filter solution) |
ReeceGoding (talk | contribs) |
||
Line 4,470:
===Filter solution===
With identical output, a more idiomatic way is to use R's Filter and Vectorize:
<lang R>factors<-function(n){c(Filter(function(x) n %% x == 0,
#If you want to use a vector of integers as an input, as in the previous solution, use:
|