tracks/r/exercises/perfect-numbers/example.R in trackler-2.2.1.7 vs tracks/r/exercises/perfect-numbers/example.R in trackler-2.2.1.8
- old
+ new
@@ -8,13 +8,13 @@
if (n %in% c(1, 2))
return("deficient")
find_factors <- function(n) {
factors <- c()
- for (i in 2:floor(n^0.5 + 1)) {
+ for (i in 2:floor(n ^ 0.5 + 1)) {
if (n %% i == 0) {
- if (i^2 != n) {
+ if (i ^ 2 != n) {
factors <- c(factors, i, n / i)
}
else {
factors <- c(factors, i)
}