not_IO@lemmy.blahaj.zone to Programmer Humor@programming.devEnglish · edit-2il y a 5 moiso(1) statistical prime approximationlemmy.blahaj.zoneimagemessage-square45linkfedilinkarrow-up1844arrow-down10file-text
arrow-up1844arrow-down1imageo(1) statistical prime approximationlemmy.blahaj.zonenot_IO@lemmy.blahaj.zone to Programmer Humor@programming.devEnglish · edit-2il y a 5 moismessage-square45linkfedilinkfile-text
minus-squareKairos@lemmy.todaylinkfedilinkarrow-up4·il y a 5 moisThat would make it less accurate. It’s much more likely to return true on not a prime than a prime
minus-squareBoomer Humor Doomergod@lemmy.worldlinkfedilinkEnglisharrow-up2·il y a 5 moisCode proof or it didn’t happen. Extra credit for doing it in Ruby
minus-squarethemusicman@lemmy.worldlinkfedilinkarrow-up2·il y a 5 moisCorrect. Not are why people are upvoting. If 10% of numbers are prime in a range, and you always guess false, you get 90% right. If you randomly guess true 10% of the time, you get ~80% right.
minus-squareKairos@lemmy.todaylinkfedilinkarrow-up1·il y a 5 moisMore random means more towards 50% correctness.
minus-squareptu@sopuli.xyzlinkfedilinkarrow-up3·il y a 5 moisAnd 2,3,5,7 are primes of the first numbers, making always false 60% correct and random chance 50%
That would make it less accurate. It’s much more likely to return true on not a prime than a prime
Code proof or it didn’t happen.
Extra credit for doing it in Ruby
Correct. Not are why people are upvoting. If 10% of numbers are prime in a range, and you always guess false, you get 90% right. If you randomly guess true 10% of the time, you get ~80% right.
More random means more towards 50% correctness.
And 2,3,5,7 are primes of the first numbers, making always false 60% correct and random chance 50%