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.159 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.158 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.157 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.156 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.155 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.154 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.153 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.152 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.151 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.150 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.149 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.148 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.147 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.146 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.145 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.144 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.143 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.142 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.141 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.140 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt