this post was submitted on 22 Jan 2024
468 points (98.5% liked)

Science Memes

11253 readers
4221 users here now

Welcome to c/science_memes @ Mander.xyz!

A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.



Rules

  1. Don't throw mud. Behave like an intellectual and remember the human.
  2. Keep it rooted (on topic).
  3. No spam.
  4. Infographics welcome, get schooled.

This is a science community. We use the Dawkins definition of meme.



Research Committee

Other Mander Communities

Science and Research

Biology and Life Sciences

Physical Sciences

Humanities and Social Sciences

Practical and Applied Sciences

Memes

Miscellaneous

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 11 points 10 months ago* (last edited 10 months ago) (1 children)

Ah yes, my favorite recurring lemmy post! It even has the same incorrect test output.

Last time I saw this I did a few calculations based on comments people made:
https://l.sw0.com/comment/32691 (when are we going to be able to link to comments across instances?)

  • There are 9592 prime numbers less than 100,000. Assuming the test suite only tests numbers 1-99999, the accuracy should actually be only 90.408%, not 95.121%
  • The 1 trillionth prime number is 29,996,224,275,833. This would mean even the first 29 trillion primes would only get you to 96.667% accuracy.

In response to the question of how long it would take to round up to 100%:

  • The density of primes can be approximated using the Prime Number Theorem: 1/ln(x). Solving 99.9995 = 100 - 100 / ln(x) for x gives e^200000 or 7.88 × 10^86858. In other words, the universe will end before any current computer could check that many numbers.
[–] [email protected] 1 points 10 months ago

But you can use randomised test-cases. Better yet, you can randomise values in test-cases once ~~and throw away the ones you don't like~~ and get arbitrarily close to 100% with a reasonable amount of tests