Re: interview question on primes
- From: "1787" <nobody@xxxxxxxx>
- Date: Tue, 26 Feb 2008 14:11:13 -0800
"Digital Puer" <digital_puer@xxxxxxxxxxx> wrote in message
news:94748b13-14f3-42ba-9ef8-1843d73f11e9@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Feb 25, 8:13 pm, "1787" <nob...@xxxxxxxx> wrote:
The useful answer then would
be to suggest algorithms that will actually find the primes for values of
A
and B appropriate to their absolute and relative magnitudes.
Can you explain this approach or give me a URL for
further reference?
--------------------------
I do agree with other replies that the interviewer should obviously
investigate the basic skill set of the programmer, which you demonstrated.
However, in all of my experience, the most successful cantidate has extended
the basic answer to approach the constraints and boundaries of a practical
application. In this case, the values of A and B are absolutely essential
components of actually finding the desired primes. Here, it is as important
to know that you can't currently factor a 1,000,000 digit number as it is to
know how to factor those that you can. The questions a cantidate poses can
be as insightful to an interviewer as the answers he or she provides.
The guidelines suggested in Peter Webb's response are good and of an
appropriate level for a response to an interview question. From his
posting:
The "correct" answer is heavily dependent on the range of values of A and
B,
and if this is all the question states, its a pretty poor question.
If A=1,000,000 and B=1,000,100 your approach is viable but probably
inefficient.
If A=7 and B=1,000,000 a sieve would be far more efficient.
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.
.
- References:
- interview question on primes
- From: Digital Puer
- Re: interview question on primes
- From: Peter Webb
- Re: interview question on primes
- From: quasi
- Re: interview question on primes
- From: 1787
- Re: interview question on primes
- From: Digital Puer
- interview question on primes
- Prev by Date: Re: JSH factoring
- Next by Date: Re: -- Rational -> Rational , real to real and f(f(x)) = x
- Previous by thread: Re: interview question on primes
- Next by thread: Re: interview question on primes
- Index(es):
Relevant Pages
|