# How many digits are there in a number($x$) that contains only $3$,$4$,$5$ & $6$ when the sum of digits of $x$ and $2x$ is 900?

$$x$$ is a positive integer such that its digits can only be $$3,4,5,6$$. $$x$$ contains at least one copy of each of these four digits. The sum of the digits of $$x$$ is $$900$$ and the sum of the digits of $$2x$$ is also $$900$$.

Now how many digits are there in the product of maximum and minimum values of $$x$$?

To get the minimum & maximum numbers we need the minimum & maximum possible digits that produce 900 by addition.

The minimum number contains $$1$$ THREE, $$1$$ FOUR, $$1$$ FIVE and $$(900-3-4-5)\div6 = 148$$ SIXs. So the minimum number is $$345666......(148 SIXs)$$.

The maximum number contains $$1$$ FOUR, $$1$$ FIVE, $$1$$ SIX and $$(900-4-5-6)\div3 = 295$$ ONEs. So the maximum number is 654333...(295 THREEs).

This is how we can determine the minimum and maximum number where the sum of digits is 900. But how can we get the numbers when the sum of digits of $$2x$$ is also 900?

Then how can we determine the number of digits are there in the product of maximum and minimum values of $$x$$

Denote the number of 3s, 4s, 5s, 6s with $$a,b,c,d$$. Obviously:

$$3a+4b+5c+6d=900\tag{1}$$

Consider what happens when you double the number. Each digit 3 becomes 6 (ignore carryovers for a moment) and increases the sum of digits by 3. Each digit 4 becomes 8 and increases the sum of digits by 4. Each digit 5 becomes 0 but adds 1 as a carryover thus reducing the sum of digits by 4. And each digit 6 becomes 2 but adds 1 as a carryover thus reducing the sum of digits by 3. Because the sum of digits cannot change, increases and decreases must cancel out:

$$3a+4b-4c-3d=0\tag{2}$$

Subtract (2) from (1) and you get:

$$9c+9d=900$$

or:

$$c+d=100\tag{3}$$

Multiply (3) by 5 and subtract from (1). You get:

$$3a+4b+d=400\tag{4}$$

Equations (3) and (4) are sufficient to find the minimum and maximum value of $$x$$.

Minimum value: Minimum value should have the smallest number of digits. Start from (4) and make $$d$$, than $$b$$ as big as possible. This gives you:

$$a=3, \ b=73, \ c=1, \ d=99$$

The smallest number has 176 digits and looks like this:

$$x_{\min}=333\underbrace{44\dots44}_\text{73 digits}5\underbrace{66\dots66}_\text{99 digits}$$

Maximum value: Maximum value should have as many digits as possible. Start from (4) and maximize $$a$$. This gives you:

$$a=131, \ b=1, \ c=97, \ d=3$$

The biggest number has 232 digits and looks like this:

$$x_{\max}=666\underbrace{55\dots55}_\text{97 digits}4\underbrace{33\dots33}_\text{131 digits}$$

Notice that:

$$3\times 10^{175}\lt x_{\min}\lt 4\times 10^{175}$$

$$6\times 10^{231}\lt x_{\max}\lt 7\times 10^{231}$$

Therefore:

$$18\times 10^{406}\lt x_{\min} x_{\max}\lt 28\times 10^{406}$$

...so the product of minimum and maximum value of $$x$$ must have exactly 408 digits.