Update prime.py

added loop function.