mirror of
https://github.com/RustyRaptor/CS278.git
synced 2026-12-03 20:15:16 -07:00
11 lines
161 B
Python
11 lines
161 B
Python
def summation(n):
|
|
if n == 1:
|
|
return 2
|
|
inductive = summation(n - 1)
|
|
|
|
last_term = 2 * n
|
|
return inductive + last_term
|
|
|
|
|
|
print(summation(4))
|