Problem 54620. List the Euclid numbers
Euclid proved that the number of primes is infinite with the following argument. Suppose the primes form a finite set 
, 
, 
. Compute 
. This number N is either prime or composite. 
If it is prime, then the original supposition that the primes form a finite set is false. For example, if we assume that the only primes are 2, 3, and 5, then 
, which is prime. Therefore, 31 should be in the set of primes. 
If N is composite, then there must be another prime number because N is not divisible by any of the primes in the original set. For example, if we assume the only primes are 2, 3, 5, and 31, then 
. Therefore, 7 and 19 should be in the set as well. 
Either way, a contradiction is reached, and the set of primes must be infinite. In other words, we can always add another prime to the set. 
Write a function to return the nth Euclid number 
 as a character string, where 
 is the nth prime. Take the zeroth Euclid number to be 2. 
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems
- 
         
Find state names that end with the letter A
1189 Solvers
 - 
         
Construct a string from letters and counts
144 Solvers
 - 
         
         
847 Solvers
 - 
         
         
86 Solvers
 - 
         
         
176 Solvers
 
More from this Author314
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!