this post was submitted on 03 Jul 2023
447 points (98.3% liked)

Programmer Humor

19555 readers
1346 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 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] kman@lemm.ee 19 points 1 year ago* (last edited 1 year ago) (1 children)

Prime numbers become less frequent as the numbers get larger, so if you want to implement a function that tests whether a number is prime, just always returning false will get more and more accurate as you count up. The console output is just saying whether it was correct to say the number isn't prime, and the percent is the accuracy over the previous numbers

[–] quickpen@sh.itjust.works 10 points 1 year ago

Ohhhh, so there isn’t anything crazy going on here.

It’s just literally running that function and tallying up how accurate it is as a prime number checker.

…and it gets more accurate the longer it runs. Okay, I see now. Thanks, lol.