+ 1

PROGRAME TO FIND OUT THE "N"TH PTIME NUMBER

first give any integer value as input and print the corresponding prime number on that number position. Test cases : input n = 5, output will be 11. because on 5 the position prime number 11 exists.

3rd Oct 2017, 1:12 AM
Karan Agrawal
Karan Agrawal - avatar
6 Antworten
+ 3
Create a prime checker then iterate from 1 to infinity
3rd Oct 2017, 1:20 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
on which language please? CPP or java or .....
3rd Oct 2017, 1:16 AM
Nura Programmer
Nura Programmer - avatar
+ 1
Java or cpp
3rd Oct 2017, 1:16 AM
Karan Agrawal
Karan Agrawal - avatar
+ 1
Pseudo-code then... (You didn't specify, not even when others asked you to) variable current_number=1 variable count_prime=1 while count_prime is lower than input do variable aux=1 while aux lower or equal to (current_number/2) round down do if current_number mod (aux) = 0 do continue done aux=aux+1 done current_number = current_number+1 done print count_prime This is a not too accurate way, but it's the code itself. Next time, please provide some more info, or a bit of what you tried before.
3rd Oct 2017, 1:32 AM
myenemy
+ 1
got it now :-)
3rd Oct 2017, 2:26 AM
Nura Programmer
Nura Programmer - avatar
0
@myenemy.. there is no need for such type of information. i already mention everything into the question. prime numbers start from 2,3,5,7,11..... so on. if I give the input 3.. output will be 5. because at 3rd position prime number is 5
3rd Oct 2017, 1:58 AM
Karan Agrawal
Karan Agrawal - avatar