src/Alg/Math/Prime.php
public static function getPrimes( $max )
	{
		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'
			) );
		$primes = $numbers = array();
		for( $i=2; $i<=$max; $i++ )
			$numbers[$i] = true;

		$edge = floor( sqrt( $max ) );
		for( $i=2; $i<=$edge; $i++ )
			if( $numbers[$i] )
				foreach( $numbers as $key => $prime )
					if( $key > $i )
						if( $prime )
							if( $key % $i == 0 )
								$numbers[$key] = false;

		foreach( $numbers as $key => $prime )
			if( $prime )
				$primes[] = $key;
		return $primes;
	}
public static function getPrimes( $max )
	{
		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'
			) );
		$primes = $numbers = array();
		for( $i=2; $i<=$max; $i++ )
			$numbers[$i] = true;

		$edge = floor( sqrt( $max ) );
		for( $i=2; $i<=$edge; $i++ )
			if( $numbers[$i] )
				foreach( $numbers as $key => $prime )
					if( $key > $i )
						if( $prime )
							if( $key % $i == 0 )
								$numbers[$key] = false;

		foreach( $numbers as $key => $prime )
			if( $prime )
				$primes[] = $key;
		return $primes;
	}
public static function getPrimes ( $ max ) { 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' ) ) ; $ primes = $ numbers = array ( ) ; for ( $ i = 2 ; $ i <= $ max ; $ i ++ ) $ numbers [ $ i ] = true ; $ edge = floor ( sqrt ( $ max ) ) ; for ( $ i = 2 ; $ i <= $ edge ; $ i ++ ) if ( $ numbers [ $ i ] ) foreach ( $ numbers as $ key => $ prime ) if ( $ key > $ i ) if ( $ prime ) if ( $ key % $ i == 0 ) $ numbers [ $ key ] = false ; foreach ( $ numbers as $ key => $ prime ) if ( $ prime ) $ primes [ ] = $ key ; return $ primes ; }
Returns all Primes from 2 to a given Number
@access		public
@static
@param		int			$max	Greatest Number to get Primes for
@return		array
Returns all Primes from 2 to a given Number