prime factorization of numbers upto 10^7 using sieve.This is faster than naive factorization