In music we generally don't think in terms of absolute duration, but more about relative durations. I've made a small notation example to illustrate (no pitch, only rhythm):
We generally divide music into measures (also known as bars) which divide the music into segments of equal duration. This example contains 5 such measures, divided by vertical lines, which I've numbered.
At the very beginning of the music you will see the time signature (the two fours stacked on top of each other). This tells us that each measure of this piece of music will be equal to four so-called quarter notes (this is the most common time signature, you've probably heard someone count to four along with a piece of music).
In the first measure this is exactly what you see: four quarter notes. Every measure needs to equal this duration, but music would be very boring if every note was the same length. In the second measure we instead have two half notes - since one half is equal to two quarters, two half notes are the same as four quarter notes, and this measure satisfies the 4/4 time signature. The same principle applies to measure three, which contains a single whole note, which alone accounts for a full measure.
To perform these three measures you would repeatedly count to four (maintaining an even rhythm) and for the first measure you would clap/sing on every beat: 1 2 3 4. For measure two, count to four again, but since the half notes take up two quarter notes each, you would only clap on beats 1 and 3: 1 2 3 4 (if you're were playing/singing a note, you would let it ring out for the full two beats). And for measure three you would again count to four, but since the whole note takes up the full measure, you only clap on beat one: 1 2 3 4 (again, a sung note would ring for the full four beats, but that doesn't work if we're only clapping).
Apart from merely doubling the quarter note we can go the other way and divide it. In measure four you see four eight notes and eight sixteenth notes, which all add up to our signature of 4/4 (you can divide even further if you wish). If you wanted to perform this you would have to count to four, clap twice for the first two beats, and four times each for the last two; making sure that the two eight notes and four sixteenth notes are of equal duration to one quarter note each.
As you mention in your post, we also need some kind of "do nothing", which in notation we call a "rest". Measure five contains, in order, a half rest, quarter rest, eighth rest and two sixteenth rests. They each correspond to the duration of the notes we've already mentioned but tell the performer to not do anything for the affected beats. You will also notice that the rests in measure five also add up to four quarter notes.
Using these notes and rests you could thus notate a rhythmic sequence of the kind you describe in your question. You'll notice however that nowhere does it specify how long one quarter note is in terms of seconds (or milliseconds or whatever). In actual notation this is usually written somewhere in the form of "Quarter note = 100 BPM"; where BPM stands for Beats Per Minute, but if there's no such indication you can just decide for yourself how long a quarter note is (which in turn determines how fast the music will be).
In terms of programming this, I suppose you would need to determine the duration of your "base" quarter note/rest, multiply/divide that duration by factors of two to obtain your other notes and rests, and then group them together so they add up to measures of equal length (starting with 4/4 would be a good idea, but you can choose any number of notes per measure if you want). The only problem remaining is which rhythms to actually make it play, but that's up to your personal taste I suppose.