not_IO@lemmy.blahaj.zone to Programmer Humor@programming.devEnglish · edit-22 天前o(1) statistical prime approximationlemmy.blahaj.zoneimagemessage-square48fedilinkarrow-up1760arrow-down17file-text
arrow-up1753arrow-down1imageo(1) statistical prime approximationlemmy.blahaj.zonenot_IO@lemmy.blahaj.zone to Programmer Humor@programming.devEnglish · edit-22 天前message-square48fedilinkfile-text
minus-squareKairos@lemmy.todaylinkfedilinkarrow-up4·23 小时前That would make it less accurate. It’s much more likely to return true on not a prime than a prime
minus-squarethemusicman@lemmy.worldlinkfedilinkarrow-up2·17 小时前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.
minus-squareKairos@lemmy.todaylinkfedilinkarrow-up0·14 小时前More random means more towards 50% correctness.
minus-squareptu@sopuli.xyzlinkfedilinkarrow-up3·13 小时前And 2,3,5,7 are primes of the first numbers, making always false 60% correct and random chance 50%
minus-squareBoomer Humor Doomergod@lemmy.worldlinkfedilinkEnglisharrow-up2·23 小时前Code proof or it didn’t happen. Extra credit for doing it in Ruby
That would make it less accurate. It’s much more likely to return true on not a prime than a prime
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%
Code proof or it didn’t happen.
Extra credit for doing it in Ruby