At 10:17 AM -0400 4/22/10, Dan Joseph wrote:
On Thu, Apr 22, 2010 at 10:12 AM, Stephen <> wrote:

 1,252,398 DIV 30 = 41,746 groups of 30.

 1,252,398 MOD 30 = 18 items in last group

Well, 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


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.




PHP General Mailing List (
To unsubscribe, visit:

Reply via email to