Grr.. I've been trying to figure this out for a few days now, but I can't figure it out. I've been into PHP for about 6 months now, so I know the functions needed. I just can't convert it into code.
Here is a function I made to return the first pair of factors that isn't 1 or the number. 20 would return 2-10
I also made a function to check if a number is prime, a decimal, and a function that returns all factors.
Can you help me out a bit? Please, no PHP code. I would rather just have a hint pointing me in the right direction mentally. Thanks!
Here is a function I made to return the first pair of factors that isn't 1 or the number. 20 would return 2-10
Code:
<?
function firstfactor($num) {
for ($i=2; $i <= $num/2; $i++) {
if (($num/$i) == floor($num/2)) {
return $i . '-' . $num/$i;
}
}
}
?>
I also made a function to check if a number is prime, a decimal, and a function that returns all factors.
Can you help me out a bit? Please, no PHP code. I would rather just have a hint pointing me in the right direction mentally. Thanks!