DEV Community

Discussion on: Daily Challenge #183 - Automorphic Numbers

Collapse
 
aminnairi profile image
Amin

Elm

square : Float -> Float
square float =
    float * float


isAutomorphic : Int -> Bool
isAutomorphic integer =
    integer
        |> toFloat
        |> square
        |> String.fromFloat
        |> String.endsWith (String.fromInt integer)