Program that gets factors

Alright guys so im trying to write a program that gets all the factors of a number.but the catch is for all of the not prime factors, i would like to break that number down into its factors as well. and for all of that numbers factors for any that are not prime id like to break that number down into its factors as well. For example 50: 2 5 10 25. 10 and 25 are not prime so
10< 5,2 25< 5,5 now the final catch is, i need to be able to access each of the factors for each number. so for example if i had 50 i put all of its factors into an array (2,5,10,25) and the factors of 10 into an array(2,5) and the factors of 25 into an array (5,5). Can anybody help me out? I've tried many times.

(Yes i know im leaving out 1 and the number itself, i dont want those numbers)
How about
1
2
3
using std::vector;
vector<vector<unsigned> > factoredNumbers;
// factoredNumbers[x][y] is yth factor of x. 

Topic archived. No new replies allowed.