this post was submitted on 22 Feb 2026
857 points (99.1% liked)

Programmer Humor

31090 readers
87 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] frank@sopuli.xyz 26 points 2 months ago (1 children)

No, it's always guessing false and 99991 is prime so it isn't right. This isn't the output of the program but the output of the program compared with a better (but probably not faster) isprime program

[–] BradleyUffner@lemmy.world 36 points 2 months ago (2 children)

Yes, that's what I said. They wrote another test program, with a correct implementation of IsPrime in order to test to make sure the pictured one produced the expected output.

[–] GalacticSushi@lemmy.blahaj.zone 43 points 2 months ago (2 children)

Plot twist: the test just checks to see if the input exists in a hardcoded list of all prime numbers under 100000.

[–] AI_toothbrush@lemmy.zip 21 points 2 months ago (1 children)

I mean people underestimate how usefull lookup tables are. A lookup table of primes for example is basically always just better except the one case where you are searching for primes which is more maths than computer programming anyways. The modern way is to abstract and reimplement everything when there are much cheaper and easier ways of doing it.

[–] ozymandias@sh.itjust.works 4 points 2 months ago (1 children)

more maths than computer programming anyways

Computer programming is a subset of maths and was invented by a mathematition, originally to solve a maths problem...

[–] AI_toothbrush@lemmy.zip 3 points 2 months ago (2 children)

Yeah but they slowly develop to be their own fields. You wouldnt argue that physics is math either. Or that chemistry could technically be called a very far branch of philosophy. Computer programing, physics, etc are the applied versions of math. You are no longer studying math, you are studying something else with the help of math. Not that it matters much, just makes distinguising between them easier. You can draw the line anywhere but people do generally have a somewhat shared idea of where that lies.

[–] ozymandias@sh.itjust.works 1 points 2 months ago (1 children)

Chemistry is a branch of alchemy

[–] MajorasTerribleFate@lemmy.zip 2 points 2 months ago (1 children)

I suppose, but only about insofar as the U.S. is a branch of the British Empire.

[–] ozymandias@sh.itjust.works 1 points 2 months ago

You're a branch of your mom

[–] frank@sopuli.xyz 3 points 2 months ago (1 children)

Ah gotcha. Or a known list yeah

[–] draco_aeneus@mander.xyz 3 points 2 months ago

For prime numbers, since they're quite difficult to calculate and there's not that many of them, that's what's most common.