Consider scheduling algorithm based on the results of the theory of congruences. We will use it to compile a playlist of music tracks by the following rules: one song may not sound more than once per hour, sets and order of play tracks in different clock must be different; per hour does not sound at least two tracks. Denote the number of tracks in a musical based on N. If N – odd, then we introduce fictitious composition T (or add another song in the database). Then we set out a timetable for N + 1 songs, including T (if fictitious composition falls in the play list, skip it). So we may assume that N – is an even number. yr r (modN – 1) (*) This comparison always has a solution, but if x = yr, then this option does not suit us (on the condition the same composition can not be played in one hour).
This is possible if x = r / 2 and r – even if either x = (r + N – 1) / 2 and r – odd. In this case, as we choose yr N. In 1, a rigorous mathematical justification of the algorithm. As an example, we construct a table for N = 6 tracks, using the technique described above. After spending a few simple calculations using the formula (*), we obtain the following result: Implementing the algorithm in the programming language Pascal, as well as tables for different values of N are given in Appendices A, B2.