src/Convert-math.cpp
void Convert::primeFactors(vector<int>& output, int n) {
	output.clear();
	while (n%2 == 0) {
		output.push_back(2);
		n = n >> 1;
	}
	for (int i=3; i <= sqrt(n); i += 2) {
		while (n%i == 0) {
			output.push_back(i);
			n = n/i;
		}
	}
	if (n > 2) {
		output.push_back(n);
	}
}
//////////////////////////////
//
// Convert::primeFactors -- Return a list of prime factors of a number.
//
:primeFactors -- Return a list of prime factors of a number.
: primeFactors -- Return a list of prime factors of a number .
void Convert::primeFactors(vector<int>& output, int n) {
	output.clear();
	while (n%2 == 0) {
		output.push_back(2);
		n = n >> 1;
	}
	for (int i=3; i <= sqrt(n); i += 2) {
		while (n%i == 0) {
			output.push_back(i);
			n = n/i;
		}
	}
	if (n > 2) {
		output.push_back(n);
	}
}
void Convert :: primeFactors ( vector < int > & output , int n ) { output . clear ( ) ; while ( n % 2 == 0 ) { output . push_back ( 2 ) ; n = n >> 1 ; } for ( int i = 3 ; i <= sqrt ( n ) ; i += 2 ) { while ( n % i == 0 ) { output . push_back ( i ) ; n = n / i ; } } if ( n > 2 ) { output . push_back ( n ) ; } }
Convert::primeFactors -- Return a list of prime factors of a number.
Convert :: primeFactors -- Return a list of prime factors of a number .