Sha256: 56e8055ba1e2fd4ab53698a7b63906d4da4f3a7e37630e55ef902ea045094053

Contents?: true

Size: 263 Bytes

Versions: 105

Compression:

Stored size: 263 Bytes

Contents

module ArmstrongNumbers

let isArmstrongNumber (number: int) =
    let charToNumber c = int c - int '0'
    let numberAsString = string number
    let charToPower c = pown (charToNumber c) numberAsString.Length
    Seq.sumBy charToPower numberAsString = number

Version data entries

105 entries across 105 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.179 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.178 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.177 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.176 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.175 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.174 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.173 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.172 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.171 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.170 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.169 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.167 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.166 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.165 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.164 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.163 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.162 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.161 tracks/fsharp/exercises/armstrong-numbers/Example.fs
trackler-2.2.1.160 tracks/fsharp/exercises/armstrong-numbers/Example.fs