Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2. $x = $argv[1];
  3. echo "$x = ";
  4. $f = array();
  5. $index = 0;
  6. $i = 3;
  7. if ($x == 1) {
  8.     $f[$index] = 1;
  9.     $index++;
  10. }
  11. while ($x % 2 == 0) {
  12.     $f[$index] = 2;
  13.     $index++;
  14.     $x = $x / 2;
  15. }
  16. while ($i <= $x) {
  17.     if ($x % $i == 0) {
  18.         $f[$index] = $i;
  19.         $index++;
  20.         $x = $x / $i;
  21.     } else {
  22.         $i = $i + 2;
  23.     }
  24. }
  25. for ($z = 0; $z < $index - 1; $z++) {
  26.     echo $f[$z];
  27.     echo "*";
  28. }
  29. echo $f[$index - 1];
  30. ?>