# Scala-Euler Problem1

### Andrew Bolster

Machine Learning Team Lead at White Hat, Founder/Director at Farset Labs

Finished my approach to Euler Problem 1 last night and checked everything into github.

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

Was not happy with limiting the specific factors of 3 and 5, and limit of 1000 so i implemented a generalised solution.

def solution(fs: List[Int], max: Int ) = ( 1 until max ).filter( f => fs.exists( n => f % n == 0)).foldLeft(0)(_+_)


Where fs is a List of integer factors and max is obv the highest limit. eg(Answer is in white font, so select the line “Answer” to see it

print("Answer: ",solution(List(3,5),1000))