PHP Classes

PHP Find Prime Factors: Get the prime factors of a number upto 100 billion

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 72%Total: 244 All time: 7,969 This week: 381Up
Version License PHP version Categories
prime-factors 1.0Free for non-comm...4.0Algorithms, Math
Description 

Author

This class can get the prime factors of a number upto 100 billion.

It takes a number and decomposes it into factor numbers that are prime.

The class returns the prime factors in an array variable. Optionally it can output all the prime factors as it finds them.

It uses a data file to extract the lowest prime factors faster.

Picture of Abhishek Shukla
  Performance   Level  
Name: Abhishek Shukla <contact>
Classes: 5 packages by
Country: India India
Age: ???
All time rank: 65840 in India India
Week rank: 44 Up4 in India India Up

Example

<html>
<head>
<title>Prime Factors</title>
</head>
<body style="background-color:#0CCCCC;">
<h1>Prime Factors</h1>
<?php
$script
='
//Test of prime factorization class by abhishek shukla

include("primefactors.php");

$test=new prime_factors;

$test->factorize(13);
$test->factorize(99999999999);
$test->factorize(100000000000);
$test->factorize(100000000001);
$test->factorize(1000000000000);

//test for getting factors as array
$test->echo=0;
$factors=$test->factorize(1024);
echo "<br/>Factors of 1024 =".implode(",",$factors);
$factors=$test->factorize(13);
echo "<br/>Factors of 13 =".implode(",",$factors);
if(count($factors)==1)echo " (prime).";
'
;

echo
"<h3>Script</h3><pre>$script</pre><h3>Output</h3>";
eval(
$script);


?>
</body>
</html>


Screenshots  
  • primefactors.jpg
  Files folder image Files  
File Role Description
Accessible without login Plain text file pdata Data Data Set for prime factorization
Plain text file primefactors.php Class Class Prime Factors
Accessible without login Plain text file readme.txt Doc. readme
Accessible without login Plain text file test.php Example test page

 Version Control Unique User Downloads Download Rankings  
 0%
Total:244
This week:0
All time:7,969
This week:381Up
 User Ratings  
 
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:83%StarStarStarStarStar
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:72%StarStarStarStar
Rank:278