same as primefactorization but without storing the actual prime factorization