Thursday, November 18, 2004

A New Way To Calculate The Number Of Primes

I got to thinking about Prime Numbers Again. A Prime Number is any number that can only be divided evenly by itself and 1. For instance the number 11 is a Prime Number because it can only be divided evenly by 1 or 11 without leaving any fractions. One of the problems associated with Prime Numbers is trying to figure out how many prime numbers come before any randomly chosen number. For instance, if we randomly chose the number 12, how many prime numbers come before 12??? The most popular method is taking any number (X) or 12 in this instance and dividing it by the number of times 2.718281828 or "e" as it is popularly known can be multiplied to make 12 (Ln 12). For instance Ln(12) is 2.48490665. In other words if we took 2.718281828 and multiplied it 2.48490665 times (2.718281828 X 2.718281828 X (2.718281828 X .48490665)) we would get 12.
Therefore (12/Ln(12)) or (12 / 2.48490665) = 4.829155253
This number 4.829155253 rounded to the next whole number (no fractions) is 5. Therefore there are 5 prime numbers before random number 12. The prime numbers before 12 are 1,2,3,5,7,11, or 6 in number. The formula appears to be quite accurate which it is for low numbers. The problem arises because as the numbers increase the Prime Numbers become less and less and this formula starts to really get inaccurate.
Here is a new method:
If you examine a Prime Number Table you will see that the number in the farthest right column of any prime number greater than 7 contains the digits 1,3,7,9. For example 11, 13, 17, 19.
To calculate the number of Primes up to that number take any random number and multiply by 10. For example (18 X 10 = 180) Add 1 or 3 or 7 or 9 to the random number multiplied by 10. For example I chose (180 + 1= 181).
Calculating Number Of Primes Up To number 181, the far right column ending in 1.
1 Divide 181 by Ln(181) =181 / 5.198497031 = 34.81775577.
2 Round (181 / 5.198497031 = 35 to the next whole number
3 Add the number found in the units position of 181 (1) to Round number (35) equals (35 + 1) 36. There are actually 42 primes up to 181.
This result may look a little ridiculous but tests have shown that the total number of primes up to any number will be within a range of +/- 7 numbers of the total number of prime numbers up to that number which is more accurate overall than the present system.
For the mathematically inclined:
Calculating Number Of Primes Up To number X with unit ending 1,3,5,7,9:
1 Divide X by Ln(X).
2 Round (X/Ln(X))
3 Add the number found in the units position of the number (1,3,7,9) to Round(X/Ln(X)).
4 The resulting number will be dead on or within +/- 7 numbers of the total number of prime numbers up to that number.

2 comments:

Anonymous said...

[B]NZBsRus.com[/B]
Dont Bother With Idle Downloads Using NZB Files You Can Hastily Search High Quality Movies, Console Games, Music, Software & Download Them at Flying Rates

[URL=http://www.nzbsrus.com][B]Usenet Search[/B][/URL]

Anonymous said...

You could easily be making money online in the undercover world of [URL=http://www.www.blackhatmoneymaker.com]blackhat blog[/URL], Don’t feel silly if you don't know what blackhat is. Blackhat marketing uses little-known or little-understood avenues to produce an income online.