Skip to content

Instantly share code, notes, and snippets.

@PeYceBall
Created September 14, 2018 13:36
Show Gist options
  • Save PeYceBall/2b68a825618ff5f173019bf892689d7e to your computer and use it in GitHub Desktop.
Save PeYceBall/2b68a825618ff5f173019bf892689d7e to your computer and use it in GitHub Desktop.
Unilecs task 126
open System
let s = Seq.unfold (fun (f, g) -> Some( (f, g), (f + g, f + 2 * g) ) ) (1, 1)
let foo n =
let (f_n, g_n) = s |> Seq.take n |> Seq.last
printfn "for n = %d the result is %d" n (f_n + 2 * g_n)
[<EntryPoint>]
let main argv =
foo 1
foo 2
foo 3
foo 5
let n = int (System.Console.ReadLine())
foo n
System.Console.ReadLine() |> ignore
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment