Sha256: 492aa316b06cc3d9171119deb56449512b1ddd8c5ab7e093c13383092af2cdae

Contents?: true

Size: 284 Bytes

Versions: 155

Compression:

Stored size: 284 Bytes

Contents

object SumOfMultiples {
  def sum(factors: Set[Int], limit: Int): Int = {
    def isDivisibleBy(x: Int)(y: Int): Boolean = x % y == 0
    def isMultiple(x: Int): Boolean = factors exists isDivisibleBy(x)

    val multiples = (1 until limit) filter isMultiple
    multiples sum
  }
}

Version data entries

155 entries across 155 versions & 1 rubygems

Version Path
trackler-2.2.1.119 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.118 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.117 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.116 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.115 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.114 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.113 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.111 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.110 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.109 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.108 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.107 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.106 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.105 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.104 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.103 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.102 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.101 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.100 tracks/scala/exercises/sum-of-multiples/example.scala
trackler-2.2.1.99 tracks/scala/exercises/sum-of-multiples/example.scala