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.38 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.37 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.36 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.35 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.34 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.33 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.32 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.31 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.30 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.29 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.28 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.27 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.26 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.25 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.24 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.23 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.22 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.21 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.20 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt
trackler-2.2.1.19 tracks/kotlin/exercises/sum-of-multiples/src/example/kotlin/SumOfMultiples.kt