Skip to content

Instantly share code, notes, and snippets.

@fidel-karsto
Last active December 20, 2015 17:29
Show Gist options
  • Save fidel-karsto/6169455 to your computer and use it in GitHub Desktop.
Save fidel-karsto/6169455 to your computer and use it in GitHub Desktop.
some calculations that might come in handy some time.
/*
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