(In reply to
Jump Start by Richard)
Measure of efficiency
From your hint, I suspect that the solution has a residual number of Floor/ Ceiling calculations.
Assuming that Floor and Ceiling have the same computational complexity, this residual number can be used to measure the efficiency.
As a base we can use m+1, the number of calculations in the problem and record an efficiency as the reduction from this base.
As a test of my last algorithm I took samples of random values < 10000 for a,b and m, with no constraints other than that they be positive and recorded an average reduction of 40%. With the constraint a<b<m, this increased to 65%. Naturally there are variations, some quite large, in the individual results but all are at least as efficient as the original problem.
Following your hint, the obvious rearrangement s(a, b, m) = (a+1)(m+1) - Sum( for k =0 to a+1) Ceiling[k b/a] works for s (5, 17,23) but for few other values, so I am probably missing something. In the meantime though, can you confirm that the solution gives better results than those above.
|
Posted by goFish
on 2005-12-30 02:41:38 |