Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3.  
  4. from sys  import argv
  5.  
  6.  
  7. n = int(argv[1])
  8. partialSum = 0
  9. terms = 0
  10. denominator = 1
  11.  
  12. while partialSum < n:
  13.     terms += 1
  14.     partialSum = partialSum + 1/ denominator
  15.     denominator +=2
  16.  
  17. print(partialSum)
  18. print (terms)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement