I do know there exixts a simple soln like yours.
I am not asking abt Primality testing.
When i am talking abt such a high range, the primes are obviously very sparse. So selecting 100000 wont do.

On 11/29/05, Arunachalam <[EMAIL PROTECTED]> wrote:
I think it is simple,
      The ratio of prime numbers to the normal number is quite high. ( may be 10 : 1). so loop backwards. and check whether a number is prime or not using Miller Rabin Test.(If you dont know about this test just google it). If it passes for randomly selected numbers( use some 100000) then there is a 99% chance that it is prime.  for better result run the miller rabin test with prime numbers.
 
On 11/29/05, SUDARSHAN IYENGAR <[EMAIL PROTECTED] > wrote:

primality testing is a very very very tough topic to discuss...


There is no single algorithm for primality testing... and all that is known
so far is nothing but intelligent brute forcing...

try peeping through http://primepages.org more like a bible for prime number
lovers.

-Sudarshan



The hardest thing to understand is why we can
understand anything at all
                                     - Einstein
----- Original Message -----
From: "Venkatesh Dayalan" < [EMAIL PROTECTED]>
To: <algogeeks@googlegroups.com>
Sent: Tuesday, November 29, 2005 7:53 PM
Subject: [algogeeks] Re: how to find Previous Prime number?


thanks for the info....
but i am looking into the logic of finding the previous prime number...


On 11/29/05, SUDARSHAN IYENGAR < [EMAIL PROTECTED]> wrote:
>
>
> hey well... you must have a look at this package "pari gp"
>
> try googling and you can download this package, its very small and is the
> best of its kind available till date... You can also get the code for the
> same...
>
> -Sudarshan
>
>
> ----- Original Message -----
> From: < [EMAIL PROTECTED]>
> To: "Algorithm Geeks" < algogeeks@googlegroups.com>
> Sent: Tuesday, November 29, 2005 7:45 PM
> Subject: [algogeeks] how to find Previous Prime number?
>
>
> >
> > Hi everbody
> > Given a number which can be as long as 10000 digits, is there a method
> > to find the previous prime number to it?
> >
> > ~venkatesh
> >
>
>


--
"There is no Spoon"

"asato ma sad gamaya     - From delusion lead me to truth
tamaso ma jyotir gamaya  - From darkness lead me to light
mrtyor mamrtam gamaya" - From death lead me to immortality




--
===================================
want to know more about me
http"//ww.livejournal.com/users/arunachalam



--
"There is no Spoon"

"asato ma sad gamaya     - From delusion lead me to truth
tamaso ma jyotir gamaya  - From darkness lead me to light
mrtyor mamrtam gamaya" - From death lead me to immortality

Reply via email to