Note: Before attempting this problem, note that leading zeroes are allowed.
Assume that you have created a huge number with 1024 digits, where 512 of the digits is 0 and the other 512 digits is 1.
Now, compare the digits, in groups of 2. (The 1st digit with the 2nd, the 3rd digit with the 4th, and so on)
If they are both 0, remove the digits and input 0
If they are both 1, remove the digits and input 0
If one of them is 0 and the other is 1, remove the digits and input 1
After you are done with the last 2 digits of the number, return back to the start, and compare the digits, in groups of 2 again.
Repeat the above actions over and over again until you result in a 1 digit number.
What is the 1 digit number?
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.
At the beginning we have even number of 1. After each step we get n-2 or n number of 1. So at the end we can get only 0 of ones.