PHP Classes

PHP Prime Number Test: Check if a number is prime in several ways

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (9 months ago) RSS 2.0 feedNot enough user ratingsTotal: 225 All time: 8,216 This week: 126Up
Version License PHP version Categories
prime-tester 1.0GNU General Publi...5.3Algorithms, PHP 5, Math
Description 

Author

This class can check if a number is prime in several ways.

It can take a given number and check if it is prime using different methods.

Currently it tests the numbers using the methods: Standard test, Miller-Robin, Fermat Littler Theorem and GMP Library.

The class can also find the next and previous prime numbers near a given number.

Innovation Award
PHP Programming Innovation award nominee
August 2013
Number 6
Prime numbers are numbers that have special properties and are useful for several types of math operations and algorithms.

This class can help not only checking if a number is prime using several possible algorithms, but also can find the next and the previous prime number near a given number.

Manuel Lemos
Picture of Carlos Sosa
  Performance   Level  
Name: Carlos Sosa <contact>
Classes: 5 packages by
Country: United States United States
Age: 36
All time rank: 1815256 in United States United States
Week rank: 214 Up28 in United States United States Up
Innovation award
Innovation award
Nominee: 1x

Details

Prime tester class ================== This class check if number is prime. Using: - Standard test - Miller-Robin - Fermat Littler Theorem - GMP Library

  Files folder image Files (13)  
File Role Description
Files folder imageException (1 file)
Files folder imageTest (5 files)
Plain text file index.php Example Example script
Plain text file LICENSE Data Auxiliary data
Plain text file PrimeTester.php Class Class source
Plain text file prime_list.php Example Example script
Plain text file prime_next.php Example Example script
Plain text file README.md Data Documentation
Plain text file RESULTS Output Sample output

  Files folder image Files (13)  /  Exception  
File Role Description
  Plain text file FailRequirementException.php Class Class source

  Files folder image Files (13)  /  Test  
File Role Description
  Plain text file FermatLittleTheoremTest.php Class Class source
  Plain text file GMPLibraryTest.php Class Class source
  Plain text file MillerRobinTest.php Class Class source
  Plain text file SimpleTest.php Class Class source
  Plain text file TestInterface.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:225
This week:0
All time:8,216
This week:126Up
User Comments (1)
good
11 years ago (Rahul Shambharkar)
70%StarStarStarStar