Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object main extends App {
- def loop(in : Stream[Int]) : Int =
- if (in.length == 1)
- in.head
- else {
- println(in.take(20).toList)
- loop(
- in.zip(Stream.from(1)).filter { case (_, i) =>
- ((i % 2) == 0) && ((i % 4) != 0)
- }.map(_._1)
- )
- }
- println(loop(1.to(2018).toStream))
- }
Add Comment
Please, Sign In to add comment