exercism fetch php prime-factors

Prime Factors

Compute the prime factors of a given natural number.

A prime number is only evenly divisible by itself and 1.

Note that 1 is not a prime number.


What are the prime factors of 60?

Our successful divisors in that computation represent the list of prime factors of 60: 2, 2, 3, and 5.

You can check this yourself:

Running the tests

  1. Go to the root of your PHP exercise directory, which is <EXERCISM_WORKSPACE>/php. To find the Exercism workspace run

    % exercism debug | grep Workspace
  2. Get PHPUnit if you don't have it already.

    % wget --no-check-certificate https://phar.phpunit.de/phpunit.phar
    % chmod +x phpunit.phar
  3. Execute the tests:

    % ./phpunit.phar prime-factors/prime-factors_test.php


The Prime Factors Kata by Uncle Bob http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata

Submitting Incomplete Solutions

It's possible to submit an incomplete solution so you can see how others have completed the exercise.