I need to create a equation to assign a number of phrases (variable A) to a a defined number of groups (variable B) and repeat these assignment each day, and repeat this operation along of time with the smallest (or most distant) repetition possible.
Some info: the start date is 01/01/1970. The language is PHP, but the question is the mathematical formula.
The big problem is when the phrases number is not a multiple of groups.
Example of results to 5 phrases to 3 groups. (remember that the groups and phrases is a variable)
|date |G1 |G2 |G3 |
|:-------:|:-:|:-:|:-:|
|22/01/14 | 1 | 2 | 3
|23/01/14 | 4 | 5 | 1
|24/01/14 | 2 | 3 | 4
|25/01/14 | 5 | 1 | 2
|26/01/14 | 3 | 4 | 5
|27/01/14 | 1 | 2 | 3
|28/01/14 | 4 | 5 | 1
|29/01/14 | 2 | 3 | 4
|30/01/14 | 5 | 1 | 2
|31/01/14 | 3 | 4 | 5
Example of results to 8 phrases to 3 groups.
|date |G1 |G2 |G3 |
|:-------:|:-:|:-:|:-:|
|22/01/14 | 1 | 2 | 3
|23/01/14 | 4 | 5 | 6
|24/01/14 | 7 | 8 | 1
|25/01/14 | 2 | 3 | 4
|26/01/14 | 5 | 6 | 7
|27/01/14 | 8 | 1 | 2
|28/01/14 | 3 | 4 | 5
|29/01/14 | 6 | 7 | 8
|30/01/14 | 1 | 2 | 3
|31/01/14 | 4 | 5 | 6
|01/02/14 | 7 | 8 | 1
|02/02/14 | 2 | 3 | 4
|03/02/14 | 5 | 6 | 7
|04/02/14 | 8 | 1 | 2
|05/02/14 | 3 | 4 | 5
|06/02/14 | 6 | 7 | 8
Example of results to 6 phrases to 2 groups.
|date |G1 |G2 |
|:-------:|:-:|:-:|
|22/01/14 | 1 | 2
|23/01/14 | 3 | 4
|24/01/14 | 5 | 6
|22/01/14 | 2 | 3
|23/01/14 | 4 | 5
|24/01/14 | 6 | 1
Example of results to 5 phrases to 2 groups.
|date |G1 |G2 |
|:-------:|:-:|:-:|
|22/01/14 | 1 | 2
|23/01/14 | 3 | 4
|24/01/14 | 5 | 1
|22/01/14 | 2 | 3
|23/01/14 | 4 | 5
|24/01/14 | 1 | 2
|25/01/14 | 3 | 4
|26/01/14 | 5 | 1
|27/01/14 | 2 | 3
|28/01/14 | 4 | 5