Puzzle of the Week #79 - Cumulative Unrepetitiousness

This is really quite a tough one, so I wouldn’t blame you for sitting this one out. I promise to be gentler next week!

I have invented a function of a number, let’s call it the ‘cumulative unrepetitiousness’, C(n). The function looks at all the positive whole numbers up to and including n, and splits them into two categories: into category A go all of the numbers which contain some identical consecutive digits (such as 113 or 3457335), and into category B go all of the numbers that contain no identical consecutive digits (such as 34567 of 2323). C(n) is the size of category B minus the size of category A.

The value of C(n) either goes up or down by 1 as n goes up by 1:

C(1) = 1

C(2) = 2

C(3) = 3

C(4) = 4

C(5) = 5

C(6) = 6

C(7) = 7

C(8) = 8

C(9) = 9

C(10) = 10

C(11) = 9

C(12) = 10


As you can see, for small values of n, C(n) is always positive.

When n gets big enough, C(n) is always negative.

For a brief time in the middle, C(n) crosses the zero line several times. In fact there are a total of 35 positive values of n for which C(n) = 0, before it heads off into the negative zone for ever more.

Your task is simply to find the first of these.