equal
deleted
inserted
replaced
345 // Avoid being mutable |
345 // Avoid being mutable |
346 //===================== |
346 //===================== |
347 |
347 |
348 // a student showed me... |
348 // a student showed me... |
349 import scala.collection.mutable.ListBuffer |
349 import scala.collection.mutable.ListBuffer |
|
350 |
|
351 |
350 |
352 |
351 def collatz_max(bnd: Long): (Long, Long) = { |
353 def collatz_max(bnd: Long): (Long, Long) = { |
352 val colNos = ListBuffer[(Long, Long)]() |
354 val colNos = ListBuffer[(Long, Long)]() |
353 for (i <- (1L to bnd).toList) colNos += ((collatz(i), i)) |
355 for (i <- (1L to bnd).toList) colNos += ((collatz(i), i)) |
354 colNos.max |
356 colNos.max |