Re: Math Question....
| From: | tedd | Date: | Fri, 23 Apr 2010 14:43:45 +0000 |
| Subject: | Re: Math Question.... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304477@lists.php.net to get a copy of this message | ||
At 10:17 AM -0400 4/22/10, Dan Joseph wrote:
On Thu, Apr 22, 2010 at 10:12 AM, Stephen <stephen-d@rogers.com> wrote:_Dan: As I see it -- you are asking is "What would be the 'optimum' group size for 1,252,398?" "Optimum" here meaning: 1. A group size of 30 or under; 2. All groups being of equal size. Is that correct? There may not be an exact solution, but a first order attempt would be to divide the total number by 30 and check the remainder (i.e., MOD), the do the same for 29, 28, 27... and so on. The group size "solution" would be a number with a zero remainder OR with a remainder closest to your group size. That would be my first blush solution. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com1,252,398 DIV 30 = 41,746 groups of 30. 1,252,398 MOD 30 = 18 items in last groupWell, the only problem with going that route, is the one group is not equally sized to the others. 18 is ok for a group in this instance, but if it was a remainder of only 1 or 2, there would be an issue. Which is where I come to looking for a the right method to break it equally. -- -Dan Joseph