Solutions for Project Euler problems. Java and Python