2 0 1 7 What is the 2 0 1 6 t h prime number ending with 7 ?
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.
Simple standard approach.
Well ... can you explain the logic behind that ?
Log in to reply
Miller-Rabin test or the brute force part?
Log in to reply
Yes... please elaborate your logic in that solution.
Log in to reply
@Zeeshan Ali – Miller-Rabin is a probabilistic primality test. I think you should read this and this to get a better idea about it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
What language is that?
Log in to reply
python, I did it that way because it was easier than in c++ (I'm getting started in c++)
Log in to reply
Oh! I just got confused to see so much underscores ( _ ) :P
Log in to reply
@Zeeshan Ali – oh, sorry, that's because I hadn't found how to write codes here as you do xD May you explain it to me, please?
Log in to reply
@Hjalmar Orellana Soto – Just folow the way below:
‘ ‘ ‘ p y t h o n
//code
‘ ‘ ‘
You can just copy and paste your code between " ‘ ‘ ‘ p y t h o n " a n d " ‘ ‘ ‘ "
Log in to reply
@Zeeshan Ali – Untill I could!! Thank you
Here is a C++ code to find whether a number is prime or not.
1 2 3 4 5 6 7 8 |
|
I leave the further work on you all, if you don't mind :)
A solution using Python 2:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
That is an admirable efficient effort... :)
The function to find if a number is prime could be more efficient :)
Problem Loading...
Note Loading...
Set Loading...
Miller-Rabin + Brute force