mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Lucas series added (#399)
This commit is contained in:
parent
89f15bef0a
commit
559951c181
13
Maths/lucasSeries.py
Normal file
13
Maths/lucasSeries.py
Normal file
@ -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))
|
Loading…
Reference in New Issue
Block a user