Simple mode description: 7 note Cmajor with semitones indicated between notes = C2D2E1F2G2A2B1C. 2 for tone = 2 semitones, and 1 for a semitone. Take out the letters to get semitone sequence intervals = 2 2 1 2 2 2 1 (sum = 12 semitones per octave). There are always 2 tones between the two semitone intervals, so cyclic permutation of the sequence generates all 7 normal mode semitone sequences. [That means take the front number and put it at the back for the 2nd semitone sequence, and continue doing that until you start to repeat. Then put note letters sequence starting with one before the 1st number and end when it repeats at the octave.] Keynote/Mode 7 note scales with no sharps or flats are F-Lydian; C-ionian/major; G-mixolydian; D-dorian; A- Aeolian/minor; E-phrygian; B-locrian [these are now just convential names, and it makes no difference whether the Greeks ever heard them, so I put them in lower case.] (Bronson has pointed out that if you don't transpose these modes to a common keynote, it's not all that obvious what the difference is.)
You can do the same for hexatonic and pentatonic tunes. Start with 2 2 3 2 2 1 for lydian/ionian hexatonic, and 2 2 3 2 3 for pi1 pentatonic.
[There are rare oddball tunes of 7, 6, or 5 notes, that aren't normal heptatonic, hexatonic, and pentatonic tunes.]
l in the equation, l = -1 + (n+1) modulo (3) is the number of semitones off from the normal note for the keynote/mode scale you are in. It's -1, 0, or +1.