Josh has only 10 days to cram for an olympiad. On each of these 10 days he practices exactly 1 topic of either algebra, combinatorics or number theory. However, he never practices algebra the day after he practices combinatorics, and he never practices combinatorics the day after he practices algebra. What are the last 3 digits of the number of ways that he can cram for these 10 days?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
I am getting an answer 13858 in the following way: On the first day he has 3 choices, A,C or N. If he choose to study A or C on the first day, he has two choices each for A and C left for the next day (since A and C cannot come next to each other). If he chooses N on the first day, then he can choose any of the three on the next day. Working this way, I got a fractal tree kind of pattern, which initially branches into three (A,C and N). A and C branches to two each and N branches to three. In this way, after 10 steps the total number turns out to be the above. Where have I made mistake? Hope what I am trying to say is clear.
Log in to reply
Can you paste here the actual sequence you got? For example, what does your method give for 3 days instead of 1 0 ?
Let's call
n the lenght of the combination.
a n the number of combination ending with Nuber Theory the nth day.
b n the number of combination ending with Algebra or Combinatorics the nth day.
The n + 1 -th day, we have
1 combination ending with NT, every combination the previous day;
2 combination ending with Algebra or Combinatorics, every ending with NT the n -th
1 combination ending with Algebra or Combinatorics, every combination that ends with either A or C., the n -th day. So:
{ a n + 1 = a n + b n b n + 1 = 2 a n + b n
Computing, a 1 1 = 8 1 1 9 . The answer is 1 1 9
your solution is most understandable here but i still confuse with the equation. From where did you got that, would you explain it with simpler(maybe the language)?
First, We formulate a function that generates all sequences of length n:
>>> def strings(n):
... if n==1:
... return ['A','B','C']
... else:
... newlist=[]
... for i in strings(n-1):
... newlist.append('A'+i)
... newlist.append('B'+i)
... newlist.append('C'+i)
... return newlist
...
Then, we count the number of strings in which we have AB or BA:
>>> d=0
>>> for i in strings(10):
... if not (i.count('AB') or i.count('BA')):
... d += 1
...
Let's ask for d
>>> d
8119
The problem can be computed easily using recursion as below: (code written in Boo)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
I got the recurrence relation for this problem, a n = 5 a n − 2 + 2 a n − 3 , where the initial conditions are a 1 = 3 , a 2 = 7 , a 3 = 1 7 .
After that, I almost became crazy with finding the general solution! In addition, I failed at the the first try, then I cheated with using Wolfram Alpha. :\
I couldn't figure out a fast way to do it, but I thought the long shot is the only way in my grasp, so, I made a sort of flowchart. This is not a long solution, but I decided to explain it elaborately.
So, I took A = Algebra, B = Number Theory, C = Combinatorics. Clearly, we can't have a sequence with either CA or AC in it. So let us arbitrarily begin said sequence with A. Notice that we can only follow by either A or C. So 2 ways are possible, till now.
A A C
Now, A again will yield two combinations, and C will yield three.
A A C A C A B C
And So on. To make my work simpler, I wrote down the number of ways each letter gives.
A will give 2 combinations, B and C, which give 2 or 3 respectively themselves. So on.
A
2 3
2 3 2 2 3
2 3 2 2 3 2 3 2 3 2 2 3
And so on. Note that each 2 gives rise to one 2 and one 3, and each 3 gives rise to two 2s and one 3.
I will re-write as:-
A
II III
3 x II 2 x III
7 x II 5 x III
Again, note that the sum of the co-efficients i.e. the number of 2's and 3's together, make up the number of 3's in the next step, as both 2 and 3 give rise to only one 3 in the next step.
On the other hand, as one 3 gives rise to two 2s, and one 2 gives rise to one 2, the number of 2s in the next step is equal to twice the (number of 3s + number of 2s)
If you continue my procces-ish flowchart.
[1] A
[2] II III
[3] 3 x II 2 x III
[4] 7 x II 5 x III
[5] 17 x II 12 x III
[6] 41 x II 29 x III
[7] 99 x II 70 x III
[8] 239 x II 169 x III
[9] 577 x II 408 x III
[10] 1393 x II 985 x III
Thus, if you start with A, there are 1 3 9 3 + 9 8 5 = 2 3 7 8 C, there are 1 3 9 3 + 9 8 5 = 2 3 7 8
For B, it's a bit different, work it out similarly, you get 3 3 6 3
Therefore, (2378 + 2378 + 3363 = 8119)\
Therefore \boxed{119} is the answer.
sighs It's actually a easy method, but my poor descriptive skills made me type an essay, nevertheless, it's easy to understand.
Edit:- Crap, my flowcharts messed up. Any genius out here can help me with it?
Thanks again :)
\( ... \)
Ah, the most important flowchart is understandable, the largest one, you should have no problem comprehending this solution.
Problem Loading...
Note Loading...
Set Loading...
After trying some early casework it becomes clear that this is not going to be particularly fruitful. However, a recurrence relationship seems possible. So let f(n) denote the number of possible sequences after n days. f(n) = Sequences with algebra in position n , sequences with combinatorics in position n and sequences with number theory in position n , a A , a C and a N respectively. a A = the number of sequences of length n-1 which have algebra or number theory on day n-1 , a C = the number of sequences of length n-1 which have Combinatorics or number theory on day n-1 , a N = the number of sequences of length n-1 which have algebra or combinatorics or number theory on day n-1 . Clearly a N = f(n-1) . Also a A + a C = f(n-1) .+ f(n-2) . Therefore f(n) = 2 f(n-1) + f(n-2) . f(0) = 1 and f(1) = 3. Quicky building up this relation we get f(10) = 8119. So the last 3 digits are 119