Browse Source

updating readme.

master
Charles Reid 8 years ago
parent
commit
0205bb16e9
  1. 44
      051/README.md

44
051/README.md

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
## on the one hand...
...this is a badly-worded question, and that made the process a bit frustrating.
After hours of developing and implementing a solution and debugging it so it worked on the examples,
I still could not find a number with a pool of size 8. It took me a long time to realize that
the problem does not specify the number of `*` digits. I had been assuming 2.
'''
Find the smallest prime which, by replacing
part of the number (not necessarily adjacent
digits) with the same digit, is part of an
eight prime value family.
'''
So, whereas I wrote one program (the test program) to handle the one-star case `*3`,
then wrote an expanded version to handle the two-star case `X*X*XX`,
and one that used recursion and all kinds of complicated mechanisms,
instead, I should have just been writing a program to generate prime
numbers and look for patterns.
Fortunately, the fix was trivial in this case. But it was a good illustration
of why it's better not to waste a lot of time on the problems
you get stuck on. Often, there is ambiguity in the
problem statement that's entirely an artifact of the puzzle problem mentality.
## on the other hand...
...here are the timing comparisons for my own program, compared to a Python version from the web:
```
$ time java PrimeDigitReplacement3
real 0m0.938s
user 0m2.118s
sys 0m0.124s
$ time python from_the_internet.py
real 0m11.727s
user 0m11.335s
sys 0m0.130s
```
Factor of 10 better? Not bad.
Loading…
Cancel
Save