o(1) statistical prime approximation

https://lemmy.blahaj.zone/post/38950495

Blåhaj Lemmy - Choose Your Interface

I’m struggling to follow the code here. I’m guessing it’s C++ (which I’m very unfamiliar with)

bool is_prime(int x) { return false; }

Wouldn’t this just always return false regardless of x (which I presume is half the joke)? Why is it that when it’s tested up to 99999, it has a roughly 95% success rate then?

Because only 5% of those numbers are prime