Third exercise from the first assignment (prime numbers)