Let $A=\frac{a}{7}+\frac{b}{7^2}+\frac{c}{7^3}+\frac{d}{7^4}$ where $a$, $b$, $c$, and $d$ are non-negative integers less than or equal to $6$. If you list out the possible values of $A$ in descending order, what is the $2018$th number on the list.
I didn't bother finding the exact values of $A$. I just grouped together the digits $a,b,c,d$ into a single number $\overline{abcd}$, and then tried ordering them like this:
- $6666$
- $6665$ and so on...
Serials: $1,2,3,4,5,6 \rightarrow 666-$ Numbers ($6-1$) fill the blank.
$7, 8, 9, 10, 11, 12 \rightarrow665-$
I'm confused whether $0$ is a possible value for the variables and I need to add another element into my current set of 6 numbers. There also was a Bengali version of this problem, and that seems to say these are counting numbers.
Anyways, then I did $2018/6=336$ and $2018\mod6=2$,
which means $d$ is $5$.
The last digit of $336$ subtracted from 6 from probably gives $c$, the second last subtracted from 6 giving $b$, and so on...
But I'm not really sure and I need some help on this one.
Simplifying the given expression, we see that
$$A=\frac{7^3a+7^2b+7c+d}{7^4}$$
Clearly, the numerator can be any integer from $0$ to $7^4-1$. In fact, for any integer $n$ in this range, just set $a,b,c,d$ according to the unique representation of $n$ in base $7$. And this is also a bijection since any values of $a,b,c,d$ from $0-6$ will give you an integer in the desired range.
Importantly, this bijection between integers in $[0,7^4-1]$ and values of $A$ preserves the ordering. Therefore in descending order, the $n$th value of $A$ is just $\frac{7^4-n}{7^4}$. Simply plug in $n=2018$ to get your answer.