Comma pumps often arise from a sequence of just intervals that combine to almost, but not exactly, a unison (1:1 ratio).
Ascending by two tones and then descending by a major third shifts pitch upwards by 81:80, and similarly for other progressions (up a fifth, down a fourth, up a fifth, down a fourth, down a major third: C G D A E C).
Study of the comma pump dates back at least to the sixteenth century when the Italian scientist Giovanni Battista Benedetti composed a piece of music to illustrate syntonic comma drift.
In 12-tone equal temperament, going up three major thirds or four minor thirds takes one back to the original note in both cases, since adjacent accidentals (such as F♯ and G♭) are enharmonically equivalent.
However, in flatter meantone tunings such as 31-tone equal temperament, this results in a pump by one diesis—three major thirds end up slightly lower than the original key, while four minor thirds end up slightly higher than the original key, since adjacent accidentals are not enharmonically equivalent.