You are here:

Basic Math/Logical Maths

Advertisement


Question
Find an 8 digit no. whose 1st digit tells how many zero(s)are there, 2nd tells how many one(s)are there, 3rd digit tells how many two(s) are there and so on in the number.
For example:
In 21200, 2 tells there are 2 zeros, 1 tells there is 1 one, 2 tells there are 2 twos, 0 tells that there are no three(s) and last zero tells that there are no four(s) in the number. This was a 5-digit number but you have to find an 8-digit number.
I figured out many numbers but i wasn't aable to fulfill all the conditions...

Answer
Hello Moksh,

If we write the number as "abcdefgh", for this to be a legitimate number, at the very least, the sum of the digits in the prefix substring (for instance, consider "ab" for the purpose of our discussion) must not exceed the length of the suffix substring (in this particular case, this will be "cdefgh" which has a length of 6).

We can try generating numbers from 70000000 by changing the digits incrementally.

The problem with "70000000" is that the last digit (which denotes the number of seven's in the string) should be 1. However, if this was one it would contradict the condition referred to by a=7 (seven zeros are expected in the string).

If we change "a" from 7 to 6, we can set "g" to 1 for consistency -- to ensure that we have six zeros. We have "60000010". The presence of a "1" in the string requires b=1; now we have "61000010". This in turn produces two one's. To remedy this situation, we replace "bc" with "21". Hence, we have "62100010".

Now, we have less than six zeros, four to be exact. Thus, we should set "a"=4. This gives "42100010".

Next, we move the 1 from "g" to "e" since a four is present. This produces "42101000".

In the following, the notation "x => y" is read "x implies y".

a=4 => four zeros in string, this is certainly true.
b=2 => two one's in string, again, this is true.
c=1 => one two in the string.
e=1 => one four in the string.
d=f=g=h=0 balance out the rest.

Basic Math

All Answers


Answers by Expert:


Ask Experts

Volunteer


Josh

Expertise

When I work through problems, I like to emphasize concepts which I believe are worth noting. I will try to answer questions in the following areas, but not at the advanced level. Algebra. Sequences & Series. Trigonometry. Functions & Graphs. Coordinate Geometry. Quadratic Polynomials. Exponential & Logarithms. Basic Calculus. Probability, Permutation and Combination. Mathematical Induction. Complex numbers. Physics problems.

Experience

I have worked as a teaching assistant in college. My hope is that more people will share knowledge without boundary, give help without seeking recognition or monetary rewards.

Education/Credentials
Bachelor degree in Engineering Science

©2012 About.com, a part of The New York Times Company. All rights reserved.