Test if a number is prime or not.

@param int $number
The number to test

@return bool
The true if the number is prime, false otherwise
518367
protected function isPrimeNumber($number)
    {
        $number = \abs($number);

        // 2 is an exception.
        if (2 === $number) {
            return true;
        }

        // Check if number is even.
        if (!($number & 1)) {
            return false;
        }

        $sqrtNumber = \sqrt($number);
        for ($divisor = 3; $divisor <= $sqrtNumber; $divisor += 2) {
            if (0 === $number % $divisor) {
                return false;
            }
        }

        return true;
    }
427680
public function getIsDecimal( $number = false )
	{
		return	strpos( $number === false ? $this->_value : $number, "." ) !== false &&
				trim( substr( $number === false ? $this->_value : $number, strpos( $number === false ? $this->_value : $number, "." ) + 1 ), "0" );
	}
934761
public function isNumeric()
    {
        return in_array($this->type, [
            PropelTypes::NUMERIC,
            PropelTypes::DECIMAL,
            PropelTypes::TINYINT,
            PropelTypes::SMALLINT,
            PropelTypes::INTEGER,
            PropelTypes::BIGINT,
            PropelTypes::REAL,
            PropelTypes::FLOAT,
            PropelTypes::DOUBLE,
        ]);
    }
89463
private static function executeStep2($number) {
        $byteArray = str_pad(self::bcdecuc($number), 13, chr(0), STR_PAD_LEFT);

        $generatorPolynomial = 0x0f35;
        $frameCheckSequence = 0x07ff;
        $data = 0;
        $byteIndex = 0;
        $bit = 0;

        $data = (ord($byteArray[$byteIndex]) << 5) & 0xffff;
        for ($bit = 2; $bit < 8; $bit++) {
            if (($frameCheckSequence ^ $data) & 0x400) {
                $frameCheckSequence = ($frameCheckSequence << 1) ^ $generatorPolynomial;
            } else {
                $frameCheckSequence = ($frameCheckSequence << 1);
            }

            $frameCheckSequence &= 0x7ff;
            $data <<= 1;
            $data &= 0xffff;
        }

        for ($byteIndex = 1; $byteIndex < 13; $byteIndex++) {
            $data = (ord($byteArray[$byteIndex]) << 3) & 0xffff;
            for ($bit = 0; $bit < 8; $bit++) {
                if (($frameCheckSequence ^ $data) & 0x0400) {
                    $frameCheckSequence = ($frameCheckSequence << 1) ^ $generatorPolynomial;
                } else {
                    $frameCheckSequence = ($frameCheckSequence << 1);
                }

                $frameCheckSequence &= 0x7ff;
                $data <<= 1;
                $data &= 0xffff;
            }
        }

        return $frameCheckSequence;
    }
514780
private static boolean isInteger( Number n ) {
      if( n instanceof Integer ){
         return true;
      }
      try{
         Integer.parseInt( String.valueOf( n ) );
         return true;
      }catch( NumberFormatException e ){
         return false;
      }
   }
972082
public static function isPrime( $number )
	{
		Deprecation::getInstance()
			->setErrorVersion( '0.8.5' )
			->setExceptionVersion( '0.9' )
			->message( sprintf(
				'Please use %s (%s) instead',
				'public library "CeusMedia/Math"',
			 	'https://packagist.org/packages/ceus-media/math'
			) );
		if( $number < 2 )
			return false;
		$edge = floor( sqrt( $number ) );
		for( $i=2; $i<=$edge; $i++ )
			if( $number % $i == 0 )
				return false;
		return true;
	}
252644
public static function ordinal($number)
    {
        $test_c = abs($number) % 10;
        $ext = ((abs($number) % 100 < 21 && abs($number) % 100 > 4) ? 'th' : (($test_c < 4) ? ($test_c < 3) ? ($test_c < 2) ? ($test_c < 1) ? 'th' : 'st' : 'nd' : 'rd' : 'th'));

        return $number . $ext;
    }
1363960
public static function isInteger( $input ): bool {
    return self::is( $input ) && (string) (int) $input === (string) $input;
  }
140075
private static function isPrime($n)
    {
        if ($n === 1) {
            return false;
        }

        if ($n === 2) {
            return true;
        }

        if ($n % 2 === 0) {
            return false;
        }

        for ($i = 3; $i <= ceil(sqrt($n)); $i += 2) {
            if ($n % $i === 0) {
                return false;
            }
        }
        return true;
    }
186724
public function removeIssueLabels(int $number): bool
    {
        $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels',
            $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_DELETE);

        if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
            return true;
        }

        return false;
    }
1121055
public function lt($number)
    {
        return (bool) (bccomp($this->number, static::validateInputNumber($number), $this->precision) === -1);
    }
166011
public static function isPrime($number): bool
    {
        preg_match('/^1?$|^(11+?)\1+$/', implode(1, array_fill(0, $number, null)), $matches);

        return isset($matches[1]);
    }
1225090
protected function _calculateRefMod10v5($number)
    {
        $number = preg_replace("/\D/", "", $number);

        // The seed number needs to be numeric
        if (!is_numeric($number)) {
            return false;
        }

        // Must be a positive number
        if ($number <= 0) {
            return false;
        }

        // Get the length of the seed number
        $length = strlen($number);

        $total = 0;

        // For each character in seed number, sum the character multiplied by its one
        // based array position (instead of normal PHP zero based numbering)
        for ($i = 0; $i < $length; $i++) {
            $total += $number{$i} * ($i + 1);
        }

        // The check digit is the result of the sum total from above mod 10
        $checkDigit = fmod($total, 10);

        // Return the original seed plus the check digit
        return $number . $checkDigit;
    }
120098
private function parseNumber($number) {

        try {
            $this->numberParsed = $this->instance->parse($number, $this->defaultRegion);
        } catch (\libphonenumber\NumberParseException $e) {
            $this->numberParsed = null;
        }
    }
277585
protected function validOrderNumber($number = null)
    {
        $number = (isset($number)) ? $number : $this->Ref;

        $existing = Estimate::get()
            ->filter(
                [
                    "ClassName" => self::class,
                    "Ref" => $number
                ]
            )->first();

        return !($existing);
    }
1270010
protected function assertChecksum($number)
    {
        $map = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 1, 3, 5, 7, 9);
        $sum = 0;
        $last = strlen($number) - 1;
        for ($i = 0; $i <= $last; $i++) {
            $sum += $map[$number[$last - $i] + ($i & 1) * 10];
        }

        return ($sum % 10 == 0);
    }
1248638
public function eq($number)
    {
        return (bool) (bccomp($this->number, static::validateInputNumber($number), $this->precision) === 0);
    }