PHP Classes

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

Recommend this page to a friend!
  Info   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 223 All time: 8,220 This week: 131Up
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: 35
All time rank: 1815256 in United States United States
Week rank: 312 Up38 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  
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  /  Exception  
File Role Description
  Plain text file FailRequirementException.php Class Class source

  Files folder image Files  /  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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:223
This week:0
All time:8,220
This week:131Up
User Comments (1)
good
10 years ago (Rahul Shambharkar)
70%StarStarStarStar