I like it. Rather than being 100% correct and tending towards a better runtime, it has a perfect runtime and tends towards more correctness as N increases.
Seems familiar. Something that gets progressively more correct and harder to identify faults as the amount of data increases, but with no intelligence underneath.
Superb. And this checks out, as I've found that the more you test your code the better it gets. This is why I run my unit tests 1000 times after each change instead of once, it will be more when I get a new computer.
No, worse. Your true negative non-primes (26 of those between 1 and 100) now become false positive and only 24 primes switch from false negative to true positive, so you end up with 73%.
Excellent suggestion! However, returning true for all odd numbers would introduce false positives for composite numbers such as 9, 15, 21, and 25. ⚠️
My implementation instead uses a bounded conditional to identify the first three odd primes, achieving a measurable improvement in classification accuracy while preserving O(1) time complexity. 😎
This represents a 4% relative improvement over the original implementation on a sample of 100 integers. 🎓🏆
#include chatgpt.h
bool func(int n){
bool ans = chatgpt.prompt("tell me wether %d is prime or not. return true or false, no explanations.", n);
return ans;
}
1.7k
u/StrangelyBrown 2d ago
I like it. Rather than being 100% correct and tending towards a better runtime, it has a perfect runtime and tends towards more correctness as N increases.
484
u/Llonkrednaxela 2d ago
I love this, an actual programming joke in this sub.
260
u/TerroDucky 2d ago
If you did this in rust it would be like O(0,5)
43
u/stbrumme 1d ago
that code correctly catches edge cases such as n=3.7 and n="prime"
105
u/GegeAkutamiOfficial 2d ago
126
u/LoreBadTime 2d ago
You're missing 17 Milions of lines to compile, try again
61
u/neomasterc 2d ago •
Seems familiar. Something that gets progressively more correct and harder to identify faults as the amount of data increases, but with no intelligence underneath.
28
u/Old_Information6270 2d ago
I need some time to get it. Too late
27
u/gnutrino 1d ago
Also O(1) and more accurate. Also non-deterministic so you can sell it to management as AI driven.
25
u/brute_force 2d ago
could have it check if it is a specific image of the drink prime, otherwise return false.
7
u/zx48 2d ago
Superb. And this checks out, as I've found that the more you test your code the better it gets. This is why I run my unit tests 1000 times after each change instead of once, it will be more when I get a new computer.
5
u/NomaTyx 1d ago
this joke is really old but somehow never gets less funny
5
u/netherlandsftw 1d ago
As n → ∞, correctness → 100%. Truly asymptotically correct
11
u/likegamertr 1d ago
Now just return true if it’s odd and you have so much better accuracy!
3
u/wolftick 1d ago
Now proven to be reliable.
5
u/Stummi 2d ago
This is why you should know the difference between sensitivity and specificity
2
u/scheimong 1d ago
Ah yes the classic stopped clock.
1
u/FinalNandBit 1d ago
This is an amazing algorithm that grows in accuracy as n grows!
1
u/abednego-gomes 1d ago
is_mersenne_prime would be even more accurate.
1
u/ligma_then_sugma 1d ago
just gets better and better
amazing
1
u/SuitableDragonfly 1d ago
For future reference, a post title friendly way to say this is just "constant time".
1
u/DiscipleOfYeshua 1d ago
It’s like my buddy who gave up on training his whacko dog and instead started “commanding” him to do whatever he was already doing.
Dog is barking: “Bark, Oz! Good boy.”
Dog is sleeping: “Sleep, Oz! Good boy.”
1
u/Multifruit256 1d ago
Actually, this is 100% accuracy with any sample size if the random numbers you pick are from 0/1 to Inf
1
u/PM-ME-UR-DARKNESS 23h ago
Best one I ever used is
1
u/rainwulf 19h ago
Fuzzy logic.
1
u/coloredgreyscale 1h ago
return true for odd numbers <= 23 to improve the accuracy.
then again, the performance cost of the reduced isOdd implementation may not be worth it.
0
u/0xt0bi03 1d ago