478
you are viewing a single comment's thread
view the rest of the comments
[-] xthexder@l.sw0.com 11 points 10 months ago* (last edited 10 months ago)

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.
[-] sukhmel@programming.dev 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

this post was submitted on 22 Jan 2024
478 points (98.6% liked)

Science Memes

11189 readers
3077 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