diff options
Diffstat (limited to 'progs/a137.py')
-rw-r--r-- | progs/a137.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/progs/a137.py b/progs/a137.py new file mode 100644 index 0000000..ff0d667 --- /dev/null +++ b/progs/a137.py @@ -0,0 +1,5 @@ +def geometric_sum(n):
+ if n < 0:
+ return 0
+ else:
+ return 1 / (pow(2, n)) + geometric_sum(n - 1)
\ No newline at end of file |