note 103766 modified in function.gmp-prob-prime by danbrown

From: Date: Tue, 03 May 2011 13:39:49 +0000
Subject: note 103766 modified in function.gmp-prob-prime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179365@lists.php.net to get a copy of this message
Here is a simple demonstration code to fine prime possibilities. On my 64 bit Linux box I can only go until 61, larger numbers causes warnings due to the EXP number: <?php for ($idx = 0; $idx <= 61; $idx++) { $pow = (gmp_strval(gmp_pow('2', $idx)) - 1); $prop = gmp_prob_prime($pow); if ($prop > 0) { echo 'idx=' . $idx . "\n--------\n"; echo 'pow=' . $pow . "\n"; echo 'prop=' . $prop . "\n------\n"; } } ?> By 'pow' is the possible prime number. --was-- To repeat my posting again from gmp_pow() page because it doesn't belong there: ------------------------------------------- Here is a simple demonstration code to fine prime possibilities. On my 64 bit Linux box I can only go until 61, larger numbers causes warnings due to the EXP number: <?php for ($idx = 0; $idx <= 61; $idx++) { $pow = (gmp_strval(gmp_pow('2', $idx)) - 1); $prop = gmp_prob_prime($pow); if ($prop > 0) { echo 'idx=' . $idx . "\n--------\n"; echo 'pow=' . $pow . "\n"; echo 'prop=' . $prop . "\n------\n"; } } ?> By 'pow' is the possible prime number. http://php.net/manual/en/function.gmp-prob-prime.php

« previous php.notes (#179365) next »