The problems here have been taken from the Project Euler (www.projecteuler.net).
Taken from the site: "Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve."
I advice you to not straight up copy the answer as the fun part in the problems lie in figuring out the answers yourself! : )