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.119 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.118 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.117 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.116 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.115 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.114 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.113 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.111 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.110 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.109 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.108 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.107 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.106 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.105 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.104 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.103 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.102 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.101 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.100 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt
trackler-2.2.1.99 tracks/kotlin/exercises/sum-of-multiples/.meta/src/reference/kotlin/SumOfMultiples.kt