Re: Solving the Google "prime number in e" challenge

From: Phil Carmody (thefatphil_demunged_at_yahoo.co.uk)
Date: 07/26/04


Date: 26 Jul 2004 20:50:48 +0300

jrdahlman2@netscape.net (John Dahlman) writes:
> Ouch. You knocked out in one minute what took me a week-and-a-half to do. (Of
> course, I don't have much free time.)
>
> Still, I wonder what the "gp" program is.

It's the interpreted language interface to, or the 'calculator'
front end to, the Pari library. Mostly number-theoretically oriented.

http://pari.math.u-bordeaux.fr/

> Now, I do have UBASIC, and I could have
> written the whole thing in UBASIC a lot simpler and quicker. But that felt like
> cheating to me--the whole point was if I could do solve it in assembly language.

To me the whole point would be either
- to get the answer as quickly as possible
- to get the answer with as little effort as possible.

If Pari/GP had been 10^6 times slower, my 52 seconds of coding
would still have satisfied the latter. However, CPU cycles are
precious to me, and the former was a more appropriate criterion.
Fortunately GMP is pretty swift for small numbers, probably no
more than a factor of a several off the maximal possible. (It's
half the speed of some of my dedicated fixed-precision libraries,
for example.)

> Are you supposed to try it out on the high-powered math packages
> first, before going low-level? It sure seemed doable in assembly
> before I started, and it turned out that way.

Are you "supposed to" to anything in particular apart from get the
right answer? I set my own criteria to evaluate the different
options, others (google) set theirs. I believe I used the right
tool for the job. I don't care if google recruiters would count my
decision against me, but I'd guess that they wouldn't - they seem
to like the ability to get the job done efficiently, even if it's
uncoventional or unexpected.

Phil

-- 
1st bug in MS win2k source code found after 20 minutes: scanline.cpp
2nd and 3rd bug found after 10 more minutes: gethost.c
Both non-exploitable. (The 2nd/3rd ones might be, depending on the CRTL)


Relevant Pages

  • Re: can you find the bug?
    ... In the following implementation of Binary Insertion Sort, ... bug or I might be embarrassed). ...
    (comp.lang.c)
  • Re: can you find the bug?
    ... In the following implementation of Binary Insertion Sort, ... bug or I might be embarrassed). ...
    (comp.lang.c)
  • Re: can you find the bug?
    ... might overflow ?? ... bug or I might be embarrassed). ...
    (comp.lang.c)