Download the PHP package macocci7/php-math-integer without Composer
On this page you can find all versions of the php package macocci7/php-math-integer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macocci7/php-math-integer
More information about macocci7/php-math-integer
Files in macocci7/php-math-integer
Package php-math-integer
Short Description PHP Math Library of the subjects of number theory(only natural number).
License MIT
Informations about the package php-math-integer
PHP-Math-Integer
1. Features
PHP-Math-Integer
is a PHP library which treats the subjects of number theory (only natural number).
Available Subjects:
- basic matters of Numbers
- basic matters of Primes
- basic matters of Divisors
- basic matters of Multiples
- basic matters of Euclidean Algorithm
- basic matters of Common Fractions
- basic matters of Bezout's Identities
2. Contents
- 1. Features
- 2. Contents
- 3. Requirements
- 4. Installation
- 5. Usage
- 5.1. Macocci7\PhpMathInteger\Number
- 5.2. Macocci7\PhpMathInteger\Prime
- 5.3. Macocci7\PhpMathInteger\Divisor
- 5.4. Macocci7\PhpMathInteger\Multiple
- 5.5. Macocci7\PhpMathInteger\Euclid
- 5.6. Macocci7\PhpMathInteger\Fraction
- 5.7. Macocci7\PhpMathInteger\Bezout
- 6. Examples
- 7. LICENSE
3. Requirements
- PHP 8.1 or later
- Composer
4. Installation
5. Usage
- 5.1. Macocci7\PhpMathInteger\Number
- 5.2. Macocci7\PhpMathInteger\Prime
- 5.3. Macocci7\PhpMathInteger\Divisor
- 5.4. Macocci7\PhpMathInteger\Multiple
- 5.5. Macocci7\PhpMathInteger\Euclid
- 5.6. Macocci7\PhpMathInteger\Fraction
- 5.7. Macocci7\PhpMathInteger\Bezout
5.1. Macocci7\PhpMathInteger\Number
This class treats basic matters of numbers.
-
PHP:
-
Result:
-
Methods:
Method Detail isInt(mixed $n)
judges if the param is integer or not isIntAll(array $ns)
judges if all of the param are integer or not isNatural(mixed $n)
judges if the param is natural number or not isNaturalAll(array $ns)
judges if all of the param are natural number or not isFloat(mixed $n)
judges if the param is float or not isFloatAll(array $ns)
judges if all of the param are float or not isNumber(mixed $n)
judges if the param is number or not (different from is_numeric()) isNumberAll(array $ns)
judges if all of the param are number or not isFraction(mixed $n)
judges if the param is decimal fraction or not isFractionAll(array $ns)
judges if all of the param are fraction or not sign(int\|float\|null $n)
returns the sign of the param as one of -1, 0 or 1 int(float $n)
returns the integral part of the param fraction(float $n)
returns the fractional part of the param nthDigit(int $n, int\|float $d)
returns the nth digit of the param numberOfDigits(int\|float $n)
returns the number of digits of the param numberOfFractionalDigits(float $n)
returns the number of fractional digits of the param
5.2. Macocci7\PhpMathInteger\Prime
This class treats basic matters of primes.
-
PHP:
-
Result:
-
Methods:
Method Detail isPrime(int $n)
judges if the param is prime or not isPrimeAll(array $elements)
judges if all of the param are prime or not previous(int $n)
returns a prime previous to the param next(int $n)
returns a prime next to the param between(int $a, int $b)
returns array of primes between the params factorize(int $n)
factorize the param and returns the process as an array factors(int $n)
returns the factorized factors of the param as an array factorizedFormula(int $n)
returns the factorized formula as an array
5.3. Macocci7\PhpMathInteger\Divisor
This class treats basic matters of divisors.
-
PHP:
-
Result:
-
Methods:
Method Detail count(int $n)
returns the number of divisors of the param value(array $factors)
converts the factorized array into an integer and returns it formula(int $n)
returns the factorized formula as strings list(int $n)
returns all of divisors of the param as an array commonFactors(int $n1, int $n2)
returns common factors of the params as an array greatestCommonFactor(int $n1, int $n2)
returns the greatest common factor of the params commonDivisors(int $n1, int $n2)
returns all of common divisors of the param as an array reduceFraction(int $n1, int $n2)
returns reduced fraction consisting of the params as an array
5.4. Macocci7\PhpMathInteger\Multiple
This class treats basic matters of multiples.
-
PHP:
-
Result:
-
Methods:
Method Detail leastCommonMultiple(int $n1, int $n2)
returns the least common multiple of the params
5.5. Macocci7\PhpMathInteger\Euclid
This class treats basic matters of Euclidean Algorithm.
-
PHP:
-
Result:
-
Methods:
Method Detail run(int $n1, int $n2)
runs the Euclidean Algorithm and returns the result as an array gcd(int $a, int $b)
returns the greatest common divisor of the params isGcdOf(int $c, int $a, int $b)
judges if the first param is gcd of the other params or not isCoprime(int $a, int $b)
judges if the params are coprime or not
5.6. Macocci7\PhpMathInteger\Fraction
This class treats basic matters of common fractions.
-
PHP:
-
Result:
-
Methods:
Method Detail set(string $s)
sets the properties of the fraction specified by the param isReduced()
judges if the fraction is reduced or not isProper()
judges if the fraction is a proper fraction or not isImproper()
judges if the fraction is a improper fraction or not isMixed()
judges if the fraction is a mixed fraction or not reduce()
reduces the fraction toCommonDenominator(Fraction &$f)
converts the fractions into a common denominator add(Fraction $f)
adds the param to the fraction substract(Fraction $f)
substracts the param from the fraction multiply(Fraction $f)
multiplies the fraction by the param divide(Fraction $f)
divide the fraction by the param improper()
converts the fraction into a improper fraction mixed()
converts the fraction into a mixed fraction int()
returns the value of the fraction as an integer float()
returns the value of the fraction as an float text()
returns the fraction as one-line-text
5.7. Macocci7\PhpMathInteger\Bezout
This class treats basic matters of Bezout's Identity.
-
PHP:
-
Result:
-
Methods:
Method Detail set(array $c = [])
sets the properties of a Bezout's Equation from the param clear()
clears the properties of the Bezout's Equation equation()
returns the Bezout's Equation as one-line-text isSolvable()
judges if the Bezout's Equation is solvable or not solution()
returns a set of solution as an array generalSolution()
returns the general solution as an array
6. Examples
- UseNumber.txt
- UsePrime.txt
- UseDivisor.txt
- UseMultiple.txt
- UseFraction.txt
- UseEuclid.txt
- UseBezout.txt
7. LICENSE
MIT
Copyright 2023 - 2025 macocci7.