Massive Prime Number!

Computer Science Level pending

Let a a be the 10 0 th 100^\text{th} largest prime number that is less than 1 0 7 10^7 . What are the last 4 digits of a a ?


The answer is 8279.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

First Last
Mar 2, 2017
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
bool prime ;
int count = 0 ;
for(int i = pow(10,7) - 1 ; ; i -= 2){ //list numbers possibly prime
   prime = true ;
     for(int a = 3 ; a < sqrt(i) ; a += 2){ //check relevant factors
         if(i%a == 0){
             prime = false ;
             break ;
         }
     }
     if(prime) count ++ ;
     if(count == 100){
         cout << i << endl ;
         break ;
     }
 }

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...