From 559951c181d880140a7a11d57b6c54d50018d8aa Mon Sep 17 00:00:00 2001 From: victoni <32034171+victoni@users.noreply.github.com> Date: Sun, 26 May 2019 18:42:55 +0200 Subject: [PATCH] Lucas series added (#399) --- Maths/lucasSeries.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Maths/lucasSeries.py diff --git a/Maths/lucasSeries.py b/Maths/lucasSeries.py new file mode 100644 index 000000000..91ea1ba72 --- /dev/null +++ b/Maths/lucasSeries.py @@ -0,0 +1,13 @@ +# Lucas Sequence Using Recursion + +def recur_luc(n): + if n == 1: + return n + if n == 0: + return 2 + return (recur_luc(n-1) + recur_luc(n-2)) + +limit = int(input("How many terms to include in Lucas series:")) +print("Lucas series:") +for i in range(limit): + print(recur_luc(i))