| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 | 
module Collatz exposing (..)import Html exposing (..)import Html.Events exposing (..)import Html.Attributes exposing (id, class, style)import Hextype alias Model =    {    }initModel : ModelinitModel =    {    }type Msg    = NoOpbox : Int -> List Int -> Html Msgbox n p =    let        truval = List.length p        val = round (atan (toFloat truval) * 2670177)        code = "#" ++ (String.padLeft 6 '0' (Hex.toString val))        fore =            if truval < 127 then                "#ffffff"            else                "#000000"    in        div            [ class "box"            , style                [ ("background-color", code)                , ("color", fore)                ]            ]            [ text (toString n) ]collatzSteps : Int -> IntcollatzSteps n =    let        inner (n, c) =            case n of                1 ->                    (n, c)                _ ->                    if (rem n 2) == 0 then                        inner ((n // 2), (c + 1))                    else                        inner ((n * 3 + 1), (c + 1))        (one, steps) = inner (n, 0)    in        stepscollatzPath : Int -> List IntcollatzPath n =    let        helper n p =            case n of                1 ->                    (n :: p)                _ ->                    if (rem n 2) == 0 then                        helper (n // 2) (n :: p)                    else                        helper (n * 3 + 1) (n :: p)    in        helper n []view : Model -> Html Msgview model =    div        []        <|        List.map (\n -> (box n (collatzPath n))) (List.range 1 777)update : Msg -> Model -> (Model, Cmd Msg)update msg model =    ( model, Cmd.none )--subscriptions : Model -> Sub Msg--subscriptions model =--    Sub.batch--        [--        ]main =    Html.program        { init = (initModel, Cmd.none)        , view = view        , update = update        , subscriptions = \_ -> Sub.none        }
 |