Project Euler problem 5 in C