Page 1 of 1 [ 2 posts ] 

Variadic
Hummingbird
Hummingbird

User avatar

Joined: 15 Oct 2014
Age: 55
Gender: Male
Posts: 18
Location: Dublin, CA

08 Nov 2014, 5:05 pm

Sort the square roots of the integers between 1 and 50 into two bins so as to minimize the difference between the sums of the bins.

Problem courtesy of Don Knuth. Solution appears (IIRC) in his paper "Are Toy Problems Useful?", published in his _Selected Papers on Computer Science_.


_________________
"We are tied down to a language that makes up in obscurity what it lacks in style." --Tom Stoppard


Duckbat
Hummingbird
Hummingbird

User avatar

Joined: 24 May 2012
Age: 35
Gender: Male
Posts: 19
Location: Estonia

10 Nov 2014, 2:51 pm

Best result I could find is 0.0000117092118046003 difference, there probably can be better ones. I used genetic algorithm so I guess I can never know. :D

first group: 1, 2, 3, 5, 6, 9, 12, 14, 16, 18, 21, 22, 23, 24, 28, 29, 32, 33, 34, 36, 37, 38, 41, 46, 48, 49
second group: 4, 7, 8, 10, 11, 13, 15, 17, 19, 20, 25, 26, 27, 30, 31, 35, 39, 40, 42, 43, 44, 45, 47, 50