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.0.5 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.0.4 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.0.3 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.0.2 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.0.1 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.0.0 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.55 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.54 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.53 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.52 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.51 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.50 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.49 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.48 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.47 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.46 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.45 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.44 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.43 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.1.0.42 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt