# Problem 4.3.5
def zombieApocalypse():
  """
  A zombie can convert two people into zombies every day.
  Starting with one zombie, how long does it take for 
  the entire world population (of 7 billion people)
  to become zombies?
  Produces a number of days.
  """
  people = 7e9
  zombies = 1
  days = 0
  while (people > 0):
    new_zombies = 2 * zombies
    zombies = zombies + new_zombies
    people = people - new_zombies
    days = days + 1
  return days

# Problem 4.3.7
def vampyreApocalypse(v, k, vampires, people):
  """
  Vampires can each convert v people a day into vamprires.
  However, there is a band of vampire hunters that can 
  kill k vampires. If a coven of vampires starts 
  with the given number, how long before a town with a 
  given population becomes a town with no people left 
  in it?
  """
  days = 0
  while (people > 0):
    new_vampires = v * vampires
    vampires = vampires + new_vampires - k
    people = people - new_vampires
    days = days + 1
  return days

#print(zombieApocalypse())
# How long will it take to kill WW?
# vampyreApocalypse(v, k, vampires, people):
print(vampyreApocalypse(2, 2, 5, 32e3))
