Advertisement
B1KMusic

Python sequence thingamajig

Sep 10th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.20 KB | None | 0 0
  1. def pow(a,b):
  2.     tot = a
  3.     if b == 0:
  4.         return 1
  5.     while b > 1:
  6.         b -= 1
  7.         tot *= a
  8.     return tot
  9.  
  10. def f(n):
  11.     return pow(2,n) - 1
  12.  
  13. for i in range(0,100):
  14.     print f(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement