Last active
December 20, 2015 17:29
-
-
Save fidel-karsto/6169455 to your computer and use it in GitHub Desktop.
some calculations that might come in handy some time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Problem: how many collectible packets need to be bought to achieve a complete set, | |
when you don't know which one is in the packet. | |
i.e. There are 16 unique trading cards to complete a set. Each is sold in a sealed enclosing. | |
How many of them would it take to collect all 16? | |
answer: about 54! | |
https://plus.google.com/u/0/104223386721240823159/posts/goRYigJ4RGB | |
*/ | |
var countCollectibles = function (collectibleCount) { | |
var eulerConstant = 0.5772156649; | |
return (collectibleCount * Math.log(collectibleCount) + eulerConstant * collectibleCount + 0.5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment