3 people like it.

Project Euler Problem 14

Project Euler Problem 14

1: 
Seq.init 999999 (fun i -> Seq.unfold (fun i -> if (i > 1L) then Some(i, if i % 2L = 0L then i / 2L else i * 3L + 1L) else None) (int64(i))) |> Seq.sortBy (fun x -> -(Seq.length  x) - 1) |> Seq.head |> Seq.head
module Seq

from Microsoft.FSharp.Collections
val init : count:int -> initializer:(int -> 'T) -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.init
val i : int
val unfold : generator:('State -> ('T * 'State) option) -> state:'State -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.unfold
val i : int64
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
Multiple items
val int64 : value:'T -> int64 (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int64

--------------------
type int64 = System.Int64

Full name: Microsoft.FSharp.Core.int64

--------------------
type int64<'Measure> = int64

Full name: Microsoft.FSharp.Core.int64<_>
val sortBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> (requires comparison)

Full name: Microsoft.FSharp.Collections.Seq.sortBy
val x : seq<int64>
val length : source:seq<'T> -> int

Full name: Microsoft.FSharp.Collections.Seq.length
val head : source:seq<'T> -> 'T

Full name: Microsoft.FSharp.Collections.Seq.head
Next Version Raw view Test code New version

More information

Link:http://fssnip.net/ha
Posted:8 years ago
Author:Jon Canning
Tags: euler