Proper divisors: Difference between revisions
Content deleted Content added
ReeceGoding (talk | contribs) |
ReeceGoding (talk | contribs) |
||
Line 4,333: | Line 4,333: | ||
divisorList<-Vectorize(divisors)(1:N) |
divisorList<-Vectorize(divisors)(1:N) |
||
numberWithMostDivisors<-which.max(lengths(divisorList)) |
numberWithMostDivisors<-which.max(lengths(divisorList)) |
||
return(paste0("The number with the most divisors between 1 and ",N, |
return(paste0("The number with the most proper divisors between 1 and ",N, |
||
" is ",numberWithMostDivisors, |
" is ",numberWithMostDivisors, |
||
". It has ",length(divisorList[[numberWithMostDivisors]])," divisors.")) |
". It has ",length(divisorList[[numberWithMostDivisors]])," proper divisors.")) |
||
} |
} |
||
mostProperDivisors(20000)</lang> |
mostProperDivisors(20000)</lang> |
||
Line 4,374: | Line 4,374: | ||
#Task 3 |
#Task 3 |
||
> mostProperDivisors(20000) |
> mostProperDivisors(20000) |
||
[1] "The number with the most divisors between 1 and 20000 is 15120. It has 79 divisors."</pre> |
[1] "The number with the most proper divisors between 1 and 20000 is 15120. It has 79 proper divisors."</pre> |
||
=={{header|Racket}}== |
=={{header|Racket}}== |