OK, all you math types....
Aug. 14th, 2008 03:42 pmHere's a math problem I've been struggling with. Well, I've been struggling with its practical application, and I'm going to write an Excel spreadsheet to solve it by brute force, but I wonder if it would fall to an elegant algorithm.
Given a number N and two smaller numbers a and b, find x such that x ∊ [a, b] and N mod x is maximized.
(Practical application: Given 2,711 squares, each color-coded to indicate the status of one member of a sequence, arrange them in a rectangle whose width is between 70 and 90 such that there are the fewest number of unused squares in the lower right-corner. Excel tells me that the answer is width 80, which has 9 leftover squares.)
Given a number N and two smaller numbers a and b, find x such that x ∊ [a, b] and N mod x is maximized.
(Practical application: Given 2,711 squares, each color-coded to indicate the status of one member of a sequence, arrange them in a rectangle whose width is between 70 and 90 such that there are the fewest number of unused squares in the lower right-corner. Excel tells me that the answer is width 80, which has 9 leftover squares.)