PHP Classes

As for examples, I rated "insufficient" because only one exam...

Recommend this page to a friend!

      Composite Factoring  >  All threads  >  As for examples, I rated...  >  (Un) Subscribe thread alerts  
Subject:As for examples, I rated...
Summary:Package rating comment
Author:James Lehmann
Date:2014-01-20 20:02:34

James Lehmann rated this package as follows:

Utility: Bad
Consistency: Good
Examples: Insufficient

  1. As for examples, I rated...   Reply   Report abuse  
Picture of James Lehmann James Lehmann - 2014-01-20 20:02:34
As for examples, I rated "insufficient" because only one example is given: Factoring 10 into 2*5.

As for the program overall, a quick read through the code reveals that it is horrendously inefficient. The primality test used is a "clever" regular expression that creates a string the size of the number in question. If you try to find out if 2147483647 is prime, it will attempt to create a string 2147483647 characters long and then run a regular expression against it. This may be the slowest primality test ever attempted in computing. It factors a number using recursion instead of a loop, meaning that if a particular number has seven factors, it calls itself recursively seven times. Also, every time though the loop, it starts over, attempting to divide by 2, then 3, then 4, etc, even after those have been eliminated as possibilities. In short, this is the worst factoring algorithm I have ever come across.

It does, for small enough numbers, produce correct results.