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.78 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.77 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.76 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.75 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.74 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.73 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.72 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.71 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.70 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.69 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.68 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.67 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.66 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.65 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.64 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.63 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.62 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.61 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.60 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.59 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt