sum of prime numbers code in scala