Large Prime number unable to compute

  • MHB
  • Thread starter Kruidnootje
  • Start date
  • Tags
    Prime
In summary, Chris found a prime number that is too large for the PrimePi function. He is trying to find out where it fits in a series of prime numbers.
  • #1
Kruidnootje
24
0
Using Wolfram I was able to make certain that the following number was a Prime:

123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901

However finding its position in Wolfram was not possible, (Unless I should have left my computer on all night but I don't know if that would work either I did sit there for 10 minutes or so). Also I have no idea how to ascertain whether this prime is truly the first in this particular series. I believe it is. It is 171 digits long and has 17 rows of 1-0 ending in a 1.

Does anyone have any suggestions please?
Kind regards
Chris
 
Mathematics news on Phys.org
  • #2
What do you mean by "finding its position"? You want to find out which prime it is? As in, $2$ is the first prime, $3$ is the second, ..., $127$ is the thirty-first, and yours is the $n$th?

Also, I'm not sure what you mean by "this particular series". Can you please expand on that?

Assuming that by "finding its position", you mean finding out how many primes are smaller than it, your prime number is certainly very large. It's too large for the
Code:
PrimePi
function. You might consider enclosing the Wolfram command
Code:
CurrentPrime=NextPrime[CurrentPrime]
in a loop, and count the number of iterations until CurrentPrime gets to your number. That is, your code would look like this:
Code:
MyPrime=123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901;
LoopCounter=1;
CurrentPrime=2;
While[CurrentPrime<MyPrime,CurrentPrime=NextPrime[CurrentPrime];LoopCounter++;];
LoopCounter
I've tested this code on smaller primes, and it's correct. I have no idea how long it will take, though. You could test it out gingerly on some much lower primes (which you can get with the
Code:
Prime
function).
 
  • #3
Ackbach said:
What do you mean by "finding its position"? You want to find out which prime it is? As in, $2$ is the first prime, $3$ is the second, ..., $127$ is the thirty-first, and yours is the $n$th?

Yes.

Also, I'm not sure what you mean by "this particular series". Can you please expand on that?

Well this obviously not the first prime. So I had to clarify this as the first prime by the use of the word 'series' ie. 12345678901234567890 and so on.

Assuming that by "finding its position", you mean finding out how many primes are smaller than it, your prime number is certainly very large. It's too large for the
Code:
PrimePi
function. You might consider enclosing the Wolfram command
Code:
CurrentPrime=NextPrime[CurrentPrime]
in a loop, and count the number of iterations until CurrentPrime gets to your number. That is, your code would look like this:
Code:
MyPrime=123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901;
LoopCounter=1;
CurrentPrime=2;
While[CurrentPrime<MyPrime,CurrentPrime=NextPrime[CurrentPrime];LoopCounter++;];
LoopCounter
I've tested this code on smaller primes, and it's correct. I have no idea how long it will take, though. You could test it out gingerly on some much lower primes (which you can get with the
Code:
Prime
function).

Thankyou I will give this a bash. But I now know that this is the first prime ever in this 'series' so just need to find out in what position it is, ie what nth prime is this overall. Thanks though for the tip.
 

Related to Large Prime number unable to compute

1. What is a large prime number?

A large prime number is a number that is only divisible by 1 and itself, and has a value greater than 1. The exact definition of what is considered a "large" prime number can vary, but generally it is considered to be a number with hundreds or thousands of digits.

2. Why are large prime numbers important in computing?

Large prime numbers are important in computing for a variety of reasons. They are used in encryption algorithms to secure sensitive information, such as credit card numbers and personal data. They are also used in generating random numbers for simulations and games. Additionally, large prime numbers are an important area of study in mathematics and are used in various mathematical proofs and theories.

3. How are large prime numbers calculated?

Calculating large prime numbers is a complex process that involves specialized algorithms and techniques. One common method is the Sieve of Eratosthenes, which is an ancient method for finding prime numbers. Another method is the Miller-Rabin primality test, which is used in modern computer programs to quickly determine if a number is likely to be a prime number.

4. What makes a prime number unable to be computed?

There are a few reasons why a large prime number may be unable to be computed. One possibility is that the number is simply too large for current computing technology to handle. Another reason could be that the number is a special type of prime known as a "Mersenne prime", which can be difficult to compute due to their special properties.

5. Can large prime numbers be broken or hacked?

While it is possible for a large prime number to be "broken" or discovered through brute force methods, it is highly unlikely. The security of encryption algorithms and other applications that rely on large prime numbers is based on the fact that it would take an impractically long time to find the prime number through trial and error. However, as computing technology advances, it is important for researchers to continue studying and finding new prime numbers to ensure the security of these applications.

Similar threads

Replies
5
Views
453
  • Programming and Computer Science
Replies
14
Views
2K
Replies
3
Views
1K
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
32
Views
3K
Replies
4
Views
3K
  • Linear and Abstract Algebra
Replies
2
Views
818
  • General Math
Replies
1
Views
1K
Replies
20
Views
3K
Back
Top