Created
October 31, 2013 14:06
-
-
Save fwolf/7250392 to your computer and use it in GitHub Desktop.
Number equal or larger than 100000000000000(1.0E+14) will represent by Scientific Notation(科学记数法), cause base_convert() loose precision. So for larger number, use BC Math or GMP. This array is used to check number string length per base, if string is longer than the array value, it should not use build-in base_convert(). Un-formatted for run usi…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ($j = 2; $j < 63; $j ++) { | |
$x = $j; $i = 1; $y = $x; | |
while ($y < 100000000000000) { | |
$i ++; | |
$y = pow($x, $i); | |
} | |
$i --; | |
$y = pow($x, $i); | |
echo "$x^$i = $y, length " . strlen($y) . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment