# Large Prime number unable to compute

#### Kruidnootje

##### New member
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

#### Ackbach

##### Indicium Physicus
Staff member
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).

#### Kruidnootje

##### New member
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.