Sha256: 7f327376266e42ef6b0032f6cd15d166a591cab79bef94e25ee61f1b8e2fd61d

Contents?: true

Size: 212 Bytes

Versions: 218

Compression:

Stored size: 212 Bytes

Contents

object SumOfMultiples {

    fun sum(factors: Set<Int>, limit: Int): Int =
            (1 until limit).filter { x -> factors.any { y -> x.isMultipleOf(y) } }.sum()
}

fun Int.isMultipleOf(y: Int) = this % y == 0

Version data entries

218 entries across 218 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.179 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.178 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.177 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.176 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.175 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.174 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.173 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.172 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.171 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.170 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.169 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.167 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.166 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.165 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.164 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.163 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.162 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.161 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.160 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt