https://projecteuler.net/problem=1 solved in Java