Write sum method to sum up all prime numbers up to a certain amount