A number is formed by writing the numbers 1 to 30 in order as shown.
Simeon removed 45 of these 51 digits leaving 6 in their original order to make the largest 6-digit number possible. What is the this number?
n=123456789101112131415161718192021222324252627282930;s=0;p=0;cycle: s=s+(n%10);p=p+1;n=int(n/10);if(n!=0, goto cycle,0);print"Total Sum =",s;print"Total Num =",p
920,212 - is the largest such number.
We want the earliest digits to be the biggest. Let's start with 9 since that's the biggest number.
Now, the only numbers left we can use are 10, 11, 12, etc. all the way to 30.
30 is the biggest one, so let's use that next.
BUT WAIT! There are no digits greater than 30. So let's do 29.
Here, we run into a problem. The last digit must be a single digit, but there is no single-digit remaining.
If we choose two one-digit numbers in the beginning, then it will work out.
Obviously, 8 and then 9 is the best option.
Then, since 30 cannot be used after these two numbers, we must use 29 and then 30.
Therefore, 892930 is the answer.
You are very welcome!