1
0
mirror of https://github.com/danog/PrimeModule.git synced 2024-11-26 20:34:37 +01:00
This commit is contained in:
Daniil Gentili 2018-03-16 13:18:08 +01:00
parent cba74439df
commit 825826c051
2 changed files with 7 additions and 2 deletions

View File

@ -218,8 +218,11 @@ class PrimeModule
if ($res[0] == false) {
return false;
}
while (array_product($res) !== $what) {
$res[] = self::native_single_cpp($what / array_product($res));
while (($product = array_product($res)) !== $what) {
if ($product == 0) {
return false;
}
$res[] = self::native_single_cpp($what / $product);
}
return $res;

View File

@ -94,6 +94,7 @@ function gen_payload()
return chr(10).str_repeat(chr(0), 8).\danog\PHP\Struct::pack('<q', (int) (time() << 32)).pack('VV', 20, 1615239032).random_string(16);
}
echo PHP_EOL.'----------- HUGE SEMIPRIME TESTS (100 semiprimes) ----------'.PHP_EOL;
$GLOBALS['medium'] = ['python' => 0, 'python_alt' => 0, 'wolfram' => 0, 'native' => 0, 'native_cpp' => 0];
$tg = fsockopen('tcp://149.154.167.51:443');
@ -110,6 +111,7 @@ fclose($tg);
foreach ($medium as $type => $total) {
echo $type.': total time '.$total.', medium time '.($total / $tot).PHP_EOL;
}
echo PHP_EOL.'------------------- SMALL MULTIPLE FACTOR TESTS -------------------'.PHP_EOL;
$GLOBALS['medium'] = ['python' => 0, 'python_alt' => 0, 'wolfram' => 0, 'native' => 0, 'native_cpp' => 0];