Re: interview question on primes
- From: Digital Puer <digital_puer@xxxxxxxxxxx>
- Date: Tue, 26 Feb 2008 13:00:39 -0800 (PST)
Well, I passed the interview, so I think the interviewer
at least thought my solution was reasonable. However, the
reason I'm asking sci.math this question (as opposed to
one of the programming newsgroups) is to get some insight
from mathematicians. Given my exhaustive search solution,
what's a better solution that could be presented in 5-10
minutes? I am not a number theorist.
On Feb 25, 5:28 pm, "Peter Webb"
<webbfam...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
If A=7 and B=1,000,000 a sieve would be far more efficient.
Are you referring to the Sieve of Eratosthenes algorithm?
That needs to start at 1, right?
If A= some 50 digit number and B=A+100, you would probably use a
pseudo-prime checking function with brute force used only for checking
possible pseudoprimes.
Can you give me a URL for further information on this approach?
.
- Follow-Ups:
- Re: interview question on primes
- From: Gerry Myerson
- Re: interview question on primes
- References:
- interview question on primes
- From: Digital Puer
- Re: interview question on primes
- From: Peter Webb
- interview question on primes
- Prev by Date: Re: expectation of truncated normal variables
- Next by Date: Re: interview question on primes
- Previous by thread: Re: interview question on primes
- Next by thread: Re: interview question on primes
- Index(es):
Relevant Pages
|