Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Oh, thanks, this answer hits the nail in the head perfectly. Quite a number light bulbs lit up in my brain. By the way, the method you describe in the second half is hill climbing, isn't it? edit: Second by the way, I'm not trying to find maximum performance, since it's mostly about tradeoffs between quality and tradeoffs, and I'd like to discover how a certain parameter changes the performance. But that advice is worth gold anyways, will certainly be useful to someone reading this answer. Commented Feb 11, 2014 at 1:25
  • 3
    I think you dropped 1: [ 3, 2, 101 ]. This gives 2*2*101 = 404 - that should be a 3, resulting in 606, should it not? Commented Feb 11, 2014 at 4:51
  • Yes, sorry. I had started with the same parameters as the OP, but that gave me multiplicities of 2 and 2, and I thought it to be confusing. So I added an extra parameter to get 3. And forgot to update the numbers. Fixed -- and thanks! Commented Feb 11, 2014 at 10:20
  • Nice solution, but won't handle more than 2 billion combinations. Try Chase's Twiddle algorithm for really large problems. Commented Feb 11, 2014 at 11:10