note 103765 deleted from function.gmp-pow by danbrown
| From: | danbrown@php.net | Date: | Tue, 03 May 2011 13:39:31 +0000 |
| Subject: | note 103765 deleted from function.gmp-pow by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179364@lists.php.net to get a copy of this message | ||
Note Submitter: roland at mxchange dot org
----
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.