note 109334 deleted from function.gmp-prob-prime by danbrown
| From: | danbrown@php.net | Date: | Mon, 16 Jul 2012 15:43:35 +0000 |
| Subject: | note 109334 deleted from function.gmp-prob-prime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189214@lists.php.net to get a copy of this message | ||
Note Submitter: Yaron
----
The previous note shouldn't have converted the number to a string. Here's how to use GMP
more correctly, and go past 64:
<?php
for ($idx = 0; $idx <= 100; $idx++) {
$pow = gmp_sub(gmp_pow('2', $idx), 1);
$prop = gmp_prob_prime($pow);
if ($prop > 0) {
echo 'idx=' . $idx . "\n--------\n";
echo 'pow=' . gmp_strval($pow) . "\n";
echo 'prop=' . $prop . "\n------\n";
}
}
?>