40ÀÚ¸®¼ýÀÚ¸¦ ·£´ýÇÏ°Ô »ý¼ºÇßÀ»¶§ ¼Ò¼öÀÏ È®·üÀº ¾ó¸¶³ª µÉ±î¿ä?
¹Ú 2014-02 2014-02-26 12:00:43 Á¶È¸ 9639 Ãßõ 0
'1°ú ÀÚ±âÀڽŸ¸À» ¾à¼ö·Î °¡Áö´Â ¼ö'
ÀÏ°ÍÀ¸·Î º¸ÀÔ´Ï´Ù.
http://febris.blog.me/80072222411 ÀÌ·±°Ô ÀÖ±º¿ä
¼Ò¼öÀÇ ºÐÆ÷°¡ ·Î±×ÇÔ¼ö¿¡ ±Ù»çÇÑ´Ù°í´Â Çϴµ¥ ½ÇÁ¦ È®·üÀ» ±¸ÇϱⰡ ½±Áö¾Ê¾Æ ¿©ÂåºÃ½À´Ï´Ù.
¾Ë·ÁÁø ¾Ë°í¸®ÁòÀ¸·Î µ¹·Áº¸´Ï ¹é¸¸±îÁö´Â ¾à7%, ¹é¸¸~õ¸¸±îÁö´Â 6%·Î 1%Á¤µµ Â÷À̳ª´õ¶ó±¸¿ä.
Prime Number Theorem¿¡ µû¸£¸é nÀÌ Å« °æ¿ì, nº¸´Ù ÀÛÀº primeÀÇ ¼ö´Â p(n) =~ n/ln(n) À̴ϱî¿ä.
10^40ÀÎ °æ¿ì, 1.086% ³ª¿É´Ï´Ù¸¸, ¾îÂ÷ÇÇ ¿ÀÂ÷°¡ ´õ Å©°ÚÁÒ. ^^
http://mathworld.wolfram.com/PrimeNumberTheorem.html
https://www.wolframalpha.com/input/?i=number+of+prime+under+10000000000000000000000000000000000000000
Wolframalpha ÁÁ³×¿ä. ^^
$ cat 1.php
<?php
$primes = array();
for ($x = 2; $x <= 10000000; $x++) {
$xIsPrime = TRUE;
$sqrtX = sqrt($x);
foreach ($primes as $prime) if ($prime > $sqrtX || ((!($x % $prime)) && (!$xIsPrime = FALSE))) break;
if ($xIsPrime) echo ($primes[] = $x) . "\n";
}
$ time php 1.php |wc -l
664581
real 0m57.348s
user 0m56.309s
sys 0m2.448s