mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-02 10:48:44 +00:00
Add comments
This commit is contained in:
parent
449c88cc32
commit
1bdeb7967d
|
|
@ -72,7 +72,7 @@ class Prime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn
|
* @author Dennis Eichhorn
|
||||||
*/
|
*/
|
||||||
public static function rabinTest(int $n, int $k) : bool
|
public static function rabinTest(int $n, int $k = 10000) : bool
|
||||||
{
|
{
|
||||||
if ($n == 2) {
|
if ($n == 2) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -117,6 +117,16 @@ class Prime
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create prime numbers
|
||||||
|
*
|
||||||
|
* @param int $n Primes to generate
|
||||||
|
*
|
||||||
|
* @return int[]
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn
|
||||||
|
*/
|
||||||
public static function sieveOfEratosthenes(int $n) : array
|
public static function sieveOfEratosthenes(int $n) : array
|
||||||
{
|
{
|
||||||
$number = 2;
|
$number = 2;
|
||||||
|
|
@ -138,6 +148,16 @@ class Prime
|
||||||
return $primes;
|
return $primes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is prime?
|
||||||
|
*
|
||||||
|
* @param int $n Number to test
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn
|
||||||
|
*/
|
||||||
public function isPrime(int $n) : bool
|
public function isPrime(int $n) : bool
|
||||||
{
|
{
|
||||||
$i = 2;
|
$i = 2;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user