# Decimal digits multiplied by powers of 2: leads to mod 8? [closed]

This is more a puzzle than a research question, a puzzle to me. Perhaps it is straightforward for others.

Imagine Repeatedly interpreting a number expressed with the usual base-$10$ digits as "digits" multiplying powers of $2$ rather than powers of $10$. For example, interpret $n=27$ as $2\cdot 2^1 + 7\cdot 2^0 = 11$. Call this mapping $f(n)$. $f(n)=n$ when $n$ is a single (decimal) digit.

Let $g(n)$ be repeated application of $f(n)$, $g(n) = f^k(n)$ until a single digit is reached. For example, for $g(17355)=3$: $$1\cdot 2^4 + 7\cdot 2^3 + 3\cdot 2^2 + 5\cdot 2^1 + 5\cdot 2^0 = (1,7,3,5,5)\cdot(16,8,4,2,1) = 99$$ $$(9,9)\cdot(2,1) = 27$$ $$(2,7)\cdot(2,1) = 11$$ $$(1,1)\cdot(2,1) = 3$$

$g(17356)=4$: $$(1,7,3,5,6)\cdot(16,8,4,2,1) = 100$$ $$(1,0,0)\cdot(4,2,1) = 4$$

It is easy to see that $g(n)$ is well-defined, in that it does eventually reach a single digit: $f(n) < n$ for all $n \ge 10$ because $2^k < 10^k$ for $k \ge 1$.

It appears that $g(n)$ is essentially $({n}\mod 8)$. More precisely, let $m= ({n}\mod 8)$. Then I think that: $$g(n) = m \;\; \mathrm{if} \;\; m > 1$$ $$g(n) = m+8 \;\; \mathrm{if} \;\; m \le 1$$ But I do not see a proof.

Q1. Is the above mod-$8$ formula for $g(n)$ correct? Is there a simple proof?

Q2. What is the generalization with base $10$ and base $2$ replaced with base $b_1$ and $b_2$, $b_1 > b_2$?

-

## closed as off-topic by Felipe Voloch, Stefan Kohl, Qiaochu Yuan, Lucia, S. Carnahan♦Jul 6 '14 at 14:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question does not appear to be about research level mathematics within the scope defined in the help center." – Felipe Voloch, Stefan Kohl, Qiaochu Yuan, Lucia, S. Carnahan
If this question can be reworded to fit the rules in the help center, please edit the question.

Just a simple proof of the formula for $2$ and $10$. The remainder modulo $8$ is unchanged under the operation $f$, since $2^k=10^k$ modulo $8$. On the other hand, you will never reach $0$ or $1$ if you did not start with them.
I think the same argument will work for any $b_1,b_2$. You will get the same result modulo $b_1-b_2$, but can never get a number less than $b_2$ unless you start with it. – Lev Borisov Jul 6 '14 at 12:41