Proper divisors: Difference between revisions
m
→Filter solution: Clarification
ReeceGoding (talk | contribs) m (→Filter solution: Missed treatment of 1 as a special case.) |
ReeceGoding (talk | contribs) m (→Filter solution: Clarification) |
||
Line 4,316:
<lang r>#Task 1
#Has no input error checking.
{
if(n==1)
else(Filter(function(x) n %% x == 0, 1:(n%/%2)))
}
Line 4,324:
#Task 2
#The output could be put in to a cleaner form than a list, but this is the idiomatic way.
Vectorize(
#Task 3
Line 4,333:
mostProperDivisors<-function(N)
{
divisorList<-Vectorize(
numberWithMostDivisors<-which.max(lengths(divisorList))
return(paste0("The number with the most proper divisors between 1 and ",N,
Line 4,343:
{{Output}}
<pre>#Task 2
> Vectorize(
[[1]]
NULL
|