# Number of multiples of 7 in a certain range with digit restrictions

Find the amount of both positive and negative multiples of $$7$$ in the range of $$(-4,000,000, 4,000,000)$$ are there such that the only numbers that are used as digits are $$4, 2,$$ and $$0.$$ For example, one such number is $$42=6 \cdot 7.$$

I have not gotten much progress, but so far I realized that for the millions digit we can only have $$2$$ or $$0.$$ For all other digits we can have $$4, 2,$$ or $$0.$$ This gives $$2 \cdot 3^6=1458$$ possible numbers in the range of $$[0, 4,000,000).$$ We can later double the amount of numbers in this range then subtract $$2$$ (since we don't count $$0$$) for our desired outcome. However, I'm not sure how to compute how many of these $$1458$$ possible numbers are multiples of $$7$$ other than a large, messy casework bash. Can I have some help?

Edit: I still have not gotten much progress. I do understand how we may divide by 7 to get an estimation of $$208$$ for half the interval, but I am wondering if there is a way to rigorously show that this is indeed the correct amount of possible numbers instead of an estimation. Thanks in advance.

• You might guess without much justification that it could be about $1458/7 \approx 208.29$ (for the positive cases) and indeed it is Commented Sep 5, 2021 at 22:23
• @Henry How would we guess that around a seventh of the numbers in that form are a multiple of $7?$ Also, is there a more rigorous way to compute it other than approximation? Commented Sep 5, 2021 at 22:24
• The guess is simply that about a seventh of positive integers up to a limit are divisible by $7$ and so about a seventh of of a particular subset might also be. But this may be wrong either because the subset is extra special (suppose we were restricted to digits $0$ and $7$) or because this is only an approximation Commented Sep 5, 2021 at 22:31
• Oh I see. It seems that for our case the guess results with the correct amount. Do you think there a more rigorous, but not very messy strategy to doing this? Commented Sep 5, 2021 at 22:35
• Ask the same question for a modified base 3 Commented Sep 6, 2021 at 15:23

First we find the greatest $$7$$-multiple under $$8$$ million. The we factor it's cofactor of $$7$$. Then we express the result as sums, products, or differences of powers of $$2$$. $$4,000,000-(-4,000,000)\\ =8,000,000\\ =1+7,999,999\\ =1+7(1,142,857)\\ =1+7({199\cdot 5743})$$

\begin{align*} 1&=2^0\\ 7&=4+2+1\\ &=4+2+2^0\\ 199&=128\quad\space\space+64\quad\space+7\\ &=2^{(4+2+2^0)}+2^{(4+2)}+(4+2+2^0) \end{align*}

\begin{align*} 5743&=4096\quad+1024\quad+512\quad+128\quad-16\quad-1 \\&=2^{(2(4)+4)}+2^{(2(4)+2)}+2^{(2(4)+1)} +2^{(2(4)+4)}-2^{2(4)}-2^0 \end{align*}

If we now "write" the [binary] expression for the product of $$199$$ and $$5743$$ we should have the desired result..

• Is there a process on how you factored $1,142,857?$ Also is there motivation behind expressing the results as sums, products, or diferences of power of $2?$ Also, I'm a little confused on what you mean by the [binary] expression. Commented Sep 6, 2021 at 18:37
• @mathisfun Wolfram Alpha factored $1,142,857$ here. I expressed the results in terms of powers of $2$ because the only digits allowed were $4,\space 2,\space 0.\space$ By binary expression, I mean the collection of terms that are powers of $2$. Commented Sep 6, 2021 at 19:08
• Oh I see! Thanks very much. I will ask you any questions if I am still confused :) Commented Sep 6, 2021 at 19:39
• @mathisfun I think you will love Wolfram Alpha as is can do almost anything mathematical (like factoring or expanding or solving polynomial expressions) and many non-mathematical things you can imagine. Commented Sep 6, 2021 at 20:13
• Oh ok! I'll check it out. Thanks for the advice! Commented Sep 7, 2021 at 1:20