# What comes next in the sequence? (Counting sheep)

My roommate has insomnia so he was counting sheep to help him sleep.

He started with 2986, then continued with 47786, 764586, and 12233386.

What sequence is he following, and what was the next number?

• We see a champion rising; congrats on becoming the #1 puzzler of the month! Commented Mar 15, 2020 at 3:56

The next number in the sequence is:

195 734 186

The sequence he is following is:

BAA = 2 986
BAAA = 47 786
BAAAA = 764 586
BAAAAA = 12 233 386
BAAAAAA = 195 734 186

• Yep, you got it. Commented Mar 11, 2020 at 19:57
• ... black sheep? Commented Mar 12, 2020 at 14:20
• I didn't think of it. It's so obvious now when I have to count sheep as well. Commented Mar 13, 2020 at 1:32
• Normally, I don't like sequence puzzles like this, but this answer is great. Commented Mar 13, 2020 at 17:02

I found it's

195734186

It's sequence where

k(n+1) = k(n) * 16 + 10

• your solution is equivalent to the others :)
– daw
Commented Mar 13, 2020 at 12:21
• It's true, it's also "less right" because of "counting sheep" hint but is also different than "right one", it shows that there can be different way to solve the same problem. Commented Mar 14, 2020 at 21:31

The sequence is: $$k(n+1) = 16 \cdot k(n) + 10$$ for the initial condition $$k(1) = 2986$$.

This recurrence equation can be solved as follows: $$k(n) = \frac{70 \cdot 2^{4 n + 3}}{3} - \frac{2}{3}$$ This formula can be used to calculate the $$n^{th}$$ value in this sequence for any value of $$n$$.

$$k(1) = 2986$$ $$k(2) = 47786$$ $$k(3) = 764586$$ $$k(4) = 12233386$$ $$k(5) = 195734186$$ $$\dots$$
The pattern of multiplying by 16 and adding 10 is the same as (in binary) performing a right-shift operation 4 times and then adding 1010. In hexadecimal, 4 bits is one digit and 1010 = A. In other words, $$16\cdot k(n)+10\$$ takes the representation of $$k(n)$$ in hexadecimal and appends $$\text{A}$$.

$$2986$$ = $$\text{BAA}$$.
$$47786 = \text{BAAA}$$.
$$764586 = \text{BAAAA}$$.
$$12233386 = \text{BAAAAA}$$.
$$195734186 = \text{BAAAAAA}$$.

It makes sense that he would be using this sequence to count sheep since $$\text{BAA}\dots$$ is the sound the sheep make.

• While this is correct, and thorough, it misses the funny part, which is that expressed in hexadecimal these spell (rot13) "ONN", "ONNN", ONNNN" ... fbhaqf gung furrc znxr -- naq pbhagvat furrc vf n genqvgvbany npgvivgl sbe bpphclvat lbhe zvaq gb uryc lbh snyy nfyrrc. Commented Mar 13, 2020 at 17:49