CODECHEF: Factorisation

http://www.codechef.com/SEPT14/problems/FACTORIZ/