from Hacker News

Optimal denominations to split a dollar

by zjonsson on 8/5/14, 10:54 PM with 3 comments

  • by daveloyall on 8/6/14, 12:00 AM

    Recently, I learned (via HN) that prime numbers are the magical building blocks of numbers.

    By using that fact (without understanding it), I was able to beat the author's scores slightly by only including prime coins in the list of candidates.

    http://jsfiddle.net/JY648/

    Oh, the author still wins on the 4- and 5-coin variations.

    When I try to include more than X candidates, it crashes. Help?