Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isFraction(a: Int, b: Int): Boolean = a % b == 0
- def fractions(a: Int): List[Int] =
- (1 until a).filter(isFraction(a, _)).toList
- def commonFractions(a: Int*): List[Int] =
- a.map(fractions).reduce(_ intersect _)
- println(commonFractions(100, 250, 125))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement