a solution in C to euler problem #1