You're reading: cp's mathem-o-blog

A lullaby sequence

A baby in a pram rolling over a sequence of numbers

My son was born last September. While he doesn’t hate sleep as much as his sister did, he still needs a bit of help to drop off.

I’m not at all musically inclined, and I seem unable to remember more than a couple of lines from wordy songs (my version of “Papa’s gonna buy you a mockingbird” rapidly veers into nonsense as I try to think of a rhyme for the next line), so when the girl was little I hit upon the strategy of singing counting songs to lull her off to sleep.

At first, I went through the standards: “one man went to mow”, “ten green bottles on the wall”, and so on. The first problem I encountered is that when you start singing a counting-backwards song, you have to pick a number to start at.

The second problem is that they’re really, really boring, and it’s the baby I want to go to sleep, not me.

One day my wife the primary teacher taught me a song she uses at school:

Let’s count back in ones from 10,


10, 9, 8 and 7,


6, 5, 4 and 3,


2 and 1 and don’t forget the zero,


It’s another counting backwards song, but the great thing about it is that once you’re finished, you start again counting back in twos, then threes, and so on for as long as you need until the baby is asleep.

Let’s count back in \(N\)s from \(10N\),


\(10N\), \(9N\), \(8N\), \(7N\), …

My record for the girl is “let’s count back in twenty-twos”. I did say she doesn’t like going to sleep.

Eventually, I got bored of that too, so I started counting back in different sequences: squares, triangular numbers, fibonacci numbers, primes, binary, ternary.

Let’s count back in fibonacci numbers from 89,


89, 55, 34, 21,


13, 8, 5 and 3,


2 and 1 and don’t forget the other 1,


These didn’t quite work: if I take a while to work out the next number it disrupts the rhythm of the song. It’s also very easy to make an off-by-one error: while the normal song starts at \(10N\), you sing 11 numbers including the zero (which you mustn’t forget!)

So I wanted a counting-forwards song that had a bit of complexity to it, but not too much.

A few months ago, while pushing the boy around the block, I came up with a nice rule for an integer sequence:

For each \(N\), repeatedly subtract the largest power of 2 dividing \(N\) until you get to 0 (but don’t include the zero!)

It goes like this:



3, 2


5, 4

6, 4

7, 6, 4


9, 8

This works beautifully! It’s open-ended, so I can keep going if he takes a while to drop off, but the rule is just hard enough to keep my brain occupied without making me break the rhythm.

He’s normally asleep by the time I get to 64, but sometimes I keep going just for fun.

Last night he had a horrible time with teeth coming through, so he was ready for his first nap at 6am! I recorded myself singing the lullaby sequence as I pushed him around the block:

Of course, as a fan of the Online Encyclopedia of Integer Sequences, I checked if it was already in. It wasn’t! So I submitted it, and it’s now entry A343934.

(will not be published)

$\LaTeX$: You can use LaTeX in your comments. e.g. $ e^{\pi i} $ for inline maths; \[ e^{\pi i} \] for display-mode (on its own line) maths.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>