-
-
Save PeYceBall/2b68a825618ff5f173019bf892689d7e to your computer and use it in GitHub Desktop.
Unilecs task 126
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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