equal
deleted
inserted
replaced
15 def collatz_max(bnd: Long): (Long, Long) = { |
15 def collatz_max(bnd: Long): (Long, Long) = { |
16 val all = for (i <- (1L to bnd)) yield (collatz(i), i) |
16 val all = for (i <- (1L to bnd)) yield (collatz(i), i) |
17 all.maxBy(_._1) |
17 all.maxBy(_._1) |
18 } |
18 } |
19 |
19 |
|
20 //collatz_max(1000000) |
|
21 //collatz_max(10000000) |
|
22 //collatz_max(100000000) |
20 |
23 |
21 /* some test cases |
24 /* some test cases |
22 val bnds = List(10, 100, 1000, 10000, 100000, 1000000) |
25 val bnds = List(10, 100, 1000, 10000, 100000, 1000000) |
23 |
26 |
24 for (bnd <- bnds) { |
27 for (bnd <- bnds) { |