Skip to content

Commit

Permalink
Update 4.iterations.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBixley authored Feb 24, 2025
1 parent 82a100b commit 614ac0b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/4.iterations.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ We constructed a loop to multiply each number by 2, but we only have 1 number as
PATH[PATH > 0]
}

# Solutions for numbers 2 to 10
collatz_res <- vector(mode = "list", length = 100 - 1)
for (numbers in 2:100) {
# Solutions for numbers 2 to anything
test <- 10

collatz_res <- vector(mode = "list", length = test - 1)
for (numbers in 2:test) {
collatz_res[[numbers - 1]] <- collatz(numbers)
names(collatz_res)[numbers - 1] <- numbers
}
Expand Down

0 comments on commit 614ac0b

Please sign in to comment.