#native_company# #native_desc#
#native_cta#

Prime factorization

By Hpkon Broten
on May 13, 2008

Version: 1

Type: Function

Category: Algorithms

License: GNU General Public License

Description: Factorizes a given number.

<?
function factorize ($number) {
	for ($i=2; $i < $number; $i++) {
		if (0 == ($number % $i)) {
			$factors[] = $i;
			$number = $number / $i;
			$i = 1;
		}
	}
	$factors[] = $number;
	return $factors;
}
print_r(factorize(2342342));
?>