Skip to content

Instantly share code, notes, and snippets.

@nephilim
Last active December 16, 2015 11:29
Show Gist options
  • Save nephilim/5428120 to your computer and use it in GitHub Desktop.
Save nephilim/5428120 to your computer and use it in GitHub Desktop.
Project Euler 01: Multiples of 3 and 5
package ysl.p01
object Multiples extends App{
val naturalNumber: Stream[Int] = Stream.cons(1, naturalNumber.map(_ + 1))
val filtered = naturalNumber.filter(x => (x % 3 == 0 || x % 5 == 0))
println(filtered.takeWhile(_ < 1000).sum)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment