Advertisement
Guest User

Untitled

a guest
May 25th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.31 KB | None | 0 0
  1. let rec Lucas x =
  2.     match x with
  3.     | x when x <= 0 -> failwith "Errore! x <= 0"
  4.     | 1 -> 1
  5.     | 2 -> 3
  6.     | x -> Lucas (x - 1) + Lucas (x - 2)
  7.  
  8. [<EntryPoint>]
  9. let main argv =
  10.     printfn "Lucas (2) = %i" (Lucas 2)
  11.     printfn "Lucas (3) = %i" (Lucas 3)
  12.     printfn "Lucas (5) = %i" (Lucas 5)
  13.     0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement