X ( n ) , where n is any natural number, in which each digit of X ( n ) is either 0 or 1 , by the following rules:
Define a sequence of natural number1 . X ( 1 ) = 1
2 . We define X ( n + 1 ) as a natural number, which can be obtained by replacing the digits of X ( n ) with 1 if the digit is 0 , and with 1 0 if the digit is 1 .
For example, X ( 1 ) = 1 , X ( 2 ) = 1 0 , X ( 3 ) = 1 0 1 , X ( 4 ) = 1 0 1 1 0 and so on.
A ( n ) is defined as the number of digits in X ( n ) .
B ( n ) is defined as the number of times 0 1 appears in X ( n ) .
For example, B ( 1 ) = 0 , B ( 2 ) = 0 , B ( 3 ) = 1 , B ( 4 ) = 1 , B ( 5 ) = 3 and so on.
What is A ( 2 3 ) + B ( 2 3 ) ?
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 do it like fibo (1+2 = 3+next(0) = 4 and in the second 4+2 = 6 without next() and the third pattern is 6+4 = 10+next(0) = 11 and in the 23th iteration is 64079 and this is the ans ( but I get wrong I failed to put a digit at the end :( )
Lol this was cool :)
Define two more recursions.
M ( t ) N ( t ) = Number of times 1 occurs in X(t) = Number of times 0 occurs in X(t)
For the sake of convenience, a 0 implies one 1 in the next term and a 1 implies a 10 in the next term. 0 ⟹ 1 1 ⟹ 1 0 Now observe that M ( x ) N ( x ) = N ( x − 1 ) + M ( x − 1 ) = M ( x − 1 )
We can simplify this into N ( x ) = N ( x − 1 ) + N ( x − 2 ) with N ( 1 ) = 0 , N ( 2 ) = 1 .
Now observe that A ( x + 1 ) = 2 M ( x ) + N ( x ) = N ( x + 1 ) + N ( x + 2 ) = N ( x + 3 ) ⟹ A ( 2 3 ) = N ( 2 5 ) Thus we can recursively count N ( 2 5 ) and get that A ( 2 3 ) = 4 6 3 6 8 .
Next observe that for n odd, B ( n ) = N ( x ) ⟹ B ( 2 3 ) = N ( 2 3 ) .
Again add recursively (or just use your old work) to get that B ( 2 3 ) = 1 7 7 1 1 .
Therefore, A ( 2 3 ) + B ( 2 3 ) = 6 4 0 7 9 .
Nice solution, it captures the main essence of the problem, using recurrence relations and directly relate it to the fibonacci sequence.
However, there is a minor mistake. Shouldn't A ( x ) = 2 M ( x ) + N ( x ) be A ( x ) = M ( x ) + N ( x ) ?
Next observe that for n odd, B ( n ) = N ( x ) ⟹ B ( 2 3 ) = N ( 2 3 )
This statement is true, but perhaps it can be better justified?
Wow. Madoka Magica the anime. I've never expected to find such things on Brilliant :)
Assume that X ( 0 ) = 0 , which is perfectly fine because that leads to X ( 1 ) = 1 , which is true.
Take a look at the sequence : 0 , 1 , 1 0 , 1 0 1 , 1 0 1 1 0 , . . . , you may notice that X ( n ) is made from 2 parts, the first part is X ( n − 1 ) and the second part is X ( n − 2 ) . We will prove this for every positive n larger or equal to 2 by mathematical induction.
Clearly X ( 2 ) = 1 0 is made from X ( 1 ) = 1 and X ( 0 ) = 0 .
Suppose that X ( k ) is comprised of X ( k − 1 ) and X ( k − 2 ) . We will prove that X ( k + 1 ) is comprised of X ( k ) and X ( k − 1 ) .
When changing the digits of X ( k ) to form X ( k + 1 ) , we're basically doing three tasks : Changing the digits of the X ( k − 1 ) part, changing the digits of the X ( k − 2 ) part and combining both parts together. By changing the digits of X ( k − 1 ) , we obtain X ( k ) , and by changing the digits of X ( k − 2 ) , we obtain X ( k − 1 ) . And when combining two parts together, we are perfectly sure that X ( k + 1 ) is made of X ( k ) and X ( k − 1 ) .
Hence, it is clearly that A ( n ) = A ( n − 1 ) + A ( n − 2 ) . Also, A ( 0 ) = 1 = F ( 1 ) and A ( 1 ) = 1 = F ( 2 ) . Hence, the general formula of A ( n ) is A ( n ) = F ( n + 1 ) . Thus, A ( 2 3 ) = F ( 2 4 ) = 4 6 3 6 8 .
Observe that X ( 0 ) ends with 0 , X ( 1 ) ends with 1 , X ( 2 ) ends with 0 and etc. Also, apart from X ( 0 ) , every number in the sequence always begins with 1 . It really easy to prove that 0 and 1 appear alternatively in the sequence, also to prove that every number begins with 1 apart from X ( 0 ) . This should be left as an exercise to the reader :)
Because X ( n ) is made of X ( n − 1 ) and X ( n − 2 ) , hence B ( n ) = B ( n − 1 ) + B ( n + 2 ) for n being an even number and B ( n ) = B ( n − 1 ) + B ( n − 2 ) + 1 for n being an odd number (we have to add 1 because when combining B ( n − 1 ) and B ( n − 2 ) , the last number of B ( n − 1 ) , which is 0 , combined with the first number of B ( n − 2 ) which is 1 to form another 0 1 ).
Observe that B ( 1 ) = 0 = F ( 0 ) , B ( 2 ) = 0 = 1 − 1 = F ( 1 ) − 1 , B ( 3 ) = 1 = F ( 2 ) , we can use the above formula to find the general formula of B ( n ) , which is B ( n ) = F ( n − 1 ) − 1 for even number n and B ( n ) = F ( n − 1 ) for odd number n. Hence, B ( 2 3 ) = F ( 2 2 ) = 1 7 7 1 1 .
Finally, A ( 2 3 ) + B ( 2 3 ) = 4 6 3 6 8 + 1 7 7 1 1 = 6 4 0 7 9 .
This is really long, so just read Alan Yan's solution and enjoy :)
Nicely done. The solution is very intuitive, yet rigorous.
Your simple yet subtle observation that X ( n ) comprises X ( n − 1 ) and X ( n − 2 ) and the subsequent proof by induction practically solves the problem. It is a really nice crux move! :)
Glad that you have enjoyed the problem. You might also like to note that this problem is a clever reference to the anime. Note how X ( n ) is defined.
1 0 → 1 .
In the anime timeline, the events of episode 1 0 precede episode 1 . Therefore, the question is suggesting that episode 1 0 is actually the first episode. Nice touch, huh? :)
Log in to reply
Wow, I never thought that this question is related to the anime itself. Does this comfirm that the Illuminati is real? :)))
By the way, anime is love, anime is life.
Log in to reply
Yea, I can't stop fanboying that this math problem comes from Madoka Magica (^w^ )/
Problem Loading...
Note Loading...
Set Loading...
Think of the zeroes as the "first" generation, and of the ones as the "later" generation, and we have the typical procedure for generating the Fibonacci sequence: every zero turns into a one, and every one remains while generating a new zero.
If we label the Fibonacci sequence as F 1 = 1 , F 2 = 1 , F 3 = 2 , F 4 = 3 , etc. then we get A ( n ) = F n + 1 . Next, the number of zeroes in pattern X ( n ) is equal to the number of ones in pattern X ( n − 1 ) , which in turn is equal to the number of digits in pattern X ( n − 2 ) . Also, every zero will be followed by a one, except if the zero is placed at the end. It is easy to see that X ( n ) ends in zero precisely if n is even. Therefore B ( n ) = { A ( n − 2 ) − 1 A ( n − 2 ) if n is even, if n is odd. Thus, A ( 2 3 ) + B ( 2 3 ) = F 2 4 + F 2 2 , and my favorite way to calculate this is as 5 ( 2 1 + 2 1 5 ) 2 4 − ( 2 1 − 2 1 5 ) 2 4 + ( 2 1 + 2 1 5 ) 2 2 − ( 2 1 − 2 1 5 ) 2 2 = 6 4 0 7 9 .