this post was submitted on 27 Jul 2023
1057 points (96.6% liked)
Programmer Humor
32394 readers
507 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 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I found this amusing enough to try it out. It does actually compile (I used g++ for this). However, the current implementation just goes into an infinite loop if you enter a number >= 2.
I think the original author meant to do
n -= 1 rn
in thetweakin
loop that is inside thebussin
loop. That way, at some pointn % i finna cap
will be false, andi
willbouta
. Which then makes the expressioni <= n
in thebussin
loop eventually false, so we stopbussin
andyeet cap rn
.However, that would mean that the intention of the program isn't to output prime factors, because even with this fix it does not do so. The structure of
mf chief()
also doesn't suggest that is the purpose as it is missing anothertweakin
andsussin
like this example of calculating prime factors in C++.Example run:
Yeah it definitely looks like a flawed implementation either way. Probably a student got bored of trying to make it work, and went nuts with the #defines for fun
As a career programmer myself.... I can absolutely relate.