this post was submitted on 22 Feb 2026
235 points (98.4% liked)
Programmer Humor
41092 readers
335 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm confused, shouldn't this be printing false no matter what the input is?
The output is not the output of the algorithm, it's the output of the unit test.
95% of numbers up to that point at not prime. Testing the algorithm that only says "not prime" is therefore correct 95% of the time. The joke is that, similar to AI, the algorithm is being presented as a useful tool because it's correct often but not always.
that's the joke, since most numbers aren't prime, this function is technically highly accurate despite being completely useless.
The test suite probably looks something like this:
Ah that makes more sense thanks. So the bottom one is a unit test and not the code being run itself