# Are there any formulas or rules that utilize the digits of a number? [closed]

I am interested in whether there are any formulas, proofs or rules that use the digits of a number. I want to know whether it is important for math to be written in base 10 or whether that doesn't matter at all.

• Casting out nines works in base $10$ Jun 16, 2020 at 18:46
• See the Bailey-Borwein-Plouffe formula : en.wikipedia.org/wiki/… Jun 16, 2020 at 18:47
• Yes there are things which make use of the digits in a number. No it is not necessary that numbers are written in base 10. Generally, the radix is made to match the context. For instance, base-$p$ in $p$-adic expansion. Jun 16, 2020 at 18:50
• Note that testing divisibility by $9$ is easy in base $10$, but that general feature isn't specific to base $10$: It's similarly easy to check divisibility by $b - 1$ in base $b$, as $b \equiv 1 \pmod {(b - 1)}$. Jun 16, 2020 at 18:55
• "I want to know whether it is important for math to be written in base 10" ... Members of the Dozenal Society have some strong opinions on that. :) It's worth taking a look at Wikipedia's "Duodecimal" entry in that regard. ... That said, a number's value tends to matter more than its representation, but representations can be fun to study, too. Eg, recreational math includes investigations of repunits and palindromic numbers.
– Blue
Jun 16, 2020 at 19:46

This is a very specific example, but still a fun and relevant one. I was tasked with a problem where, given a number $$n$$, you must find the minimum number of steps that it takes to reduce $$n$$ to $$1$$ if you are only allowed to perform the following operations:

1. Add $$1$$.
2. Subtract $$1$$
3. Divide by $$2$$ (this is only allowed if you have an even number).

So suppose we have $$n=5$$, you could subtract $$1$$, then divide by $$2$$ twice, for a total of $$3$$ actions. This becomes increasingly difficult and time consuming as we begin working with longer numbers, and clearly recursion is out of the question.

In about 27 lines of python code, I solved the entire problem in general for very large numbers: the solution by examining the binary representation is $$O(m)$$ where $$m$$ is the number of binary digits in $$n$$. For $$10^{301}$$, $$m$$ is about $$1000$$. This is near the upper limit of numbers that python can handle, but $$1000$$ is incredibly small. Thus, my solution will work incredibly fast well beyond the limit of numbers that most languages can handle. I solved this problem entirely by examining the binary representation of the number $$n$$.

I could not have solved the problem without using the binary representation of the numbers (not to say that a solution does not exist, but mine would not work in any base other than base 2). Thus, yes, some problems really can be solved by actually examining the digits (granted in this case, the digits are binary).

Not really. In fact, the numerical representation of numbers is unimportant for most mathematical results and only arises as a necessity when doing numerical computations.

Our positional numeration system bears some resemblance to the finite polynomial rings, but this is never used.

Anyway, numerations do play an important role in recreational mathematics.

• What about p-adics? Jun 16, 2020 at 21:38

There are quite a few recreational mathematical properties which involve digits. Such as Kaprekar's constant, the 10,958 problem (https://www.youtube.com/watch?v=-ruC5A9EzzE), friedman numbers, the fact that every number can be written as three palindromic numebers, etcetera. However, there are no good application or significance to these that I know of.

Concatenation (a function based on combining digits of two or more numbers) can be defined with more established, real functions such as log, exponentation, and addition, so if there is a formula that has concatenation's definition in it then you could say that it involves digit combining.

(See https://www.youtube.com/watch?v=LgnoYsbI7Uc for more details on that)

As for your question on whether the base we use affects math, as far as my knowledge goes the answer is no. The only way I could see base affecting mathematics is in terms of arithmetic. For example, there are some addition and multiplication tricks you can use in binary specifically.

There is a formula which relates the highest power of a prime $$p$$ that divides $$n!$$ (denoted as $$v_p(n!)$$) for any positive integer $$n$$ and the sum of digits of $$n$$ when represented in base $$p$$ (denoted as $$S_p(n)$$).

The following identify holds

$$v_p(n!)=\frac{n-S_p(n)}{p-1}$$

Two of its consequences are widely used in Mathematical Olympiad problem solving. $$\color{red}{\text{Try to prove it! Food for thought!!}}$$

Corollary 1: Since any positive integer has at least one non-zero digit in its expansion in any base, $$S_p(n)\geq1$$. Hence we get the following estimate $$v_p(n!)\leq\left\lfloor\frac{n-1}{p-1}\right\rfloor$$

In particular for $$p=2$$ we get $$v_2(n!)\leq n-1$$ and hence we conclude that $$2^n\nmid n!$$.

Corollary 2: For $$p=2$$ we get $$v_2(n!)=n-S_2(n)$$ Hence we get an easy expression for the maximum exponent of $$2$$ in $$n!$$ in terms of $$S_2(n)$$ which is nothing but the number of distinct powers of $$2$$ needed to represent $$n$$ as a sum of distinct powers of $$2$$.