About Counting primes in a range whose digits are all prime.
My code had a bug, the bug was an edge case that only manifested in literally one of the test cases, (I identified it by completing the problem with linear search, then downloading the test cases and then working through them to figure out which one broke it). The answer: Due to me misinterpreting/misremembering the bound, I used >
instead of >=
when checking for values above the upper bound, which led to an infinite loop (somehow, I didn't get as far as figuring out how exactly the wrong bounds check caused my problem).
My code has no answers yet, and is unlikely to get any answers (unless someone goes through the same process as I do to figure out the edge case that broke it/someone wizzy enough to connect binary search timing out with an infinite loop, and identify what caused the infinite loop checks out the problem), so I'm wondering if I should delete my question or answer it. The reasons I didn't auto answer are:
- The question has no upvotes (or downvotes), comments (or even views) by other users or answers as of now, so deleting it wouldn't have much of an impact.
- The problem was a very niche, very specific problem and may not generalise well. Stack Overflow wants solutions to be broadly applicable and helpful to future programmers who encounter your breed of problem. This isn't SO (in retrospect my question is probably a better fit for SO all things considered, and if I knew the cause I would have posted it to SO, but if I knew the cause I would have fixed it, so it's moot), but I thought it's a sensible policy.
I didn't auto delete because I'd rather not delete my content than do so ceteris paribus, and because site policy may want me to keep my content here? So I decided to ask around here.