Thayer Watkins
Silicon Valley,
Tornado Alley
& BB Island

Digit Sum Arithmetic for Integral Powers
of Terminating Decimal Numbers

The integral powers of numbers are just special cases of products so

DigitSum(nm) = (DigitSum(n))m

But the computation of DigitSum(nm) can be further simplified through a simplification of the exponent.

The DigitSum(nm) follows cycles or some even simpler pattern; i.e.,


The patterns in the above table could be represented as

DigitSum(nm) = fn(m)

but a better representation would be

DigitSum(nm) = (DigitSum(n))hn(m)

where for example h2(m)= remainder after division of m by 6 = (m mod 6) = m%6 and


For the digits with a cyclical pattern

h2(m)m mod 6
h4(m)m mod 3
h5(m)m mod 6
h7(m)m mod 3
h8(m)m mod 2

For 3, 6 and 9 the functions are even simpler; i.e.,

h3(0) = h6(0) = h9(0) = 0
h3(1) = h6(1) = h9(m≥1) = 1
h3(m≥2) = h6(m≥2) = 2

The nature of hn(m) depends upon whether for a digit n there exists a nonzero solution to the equation nq=1 or if there instead exists a solution to nq=9. If there exists a solution to nq=1 then hn(m) = m mod q. If instead there exists a solution to nq=9 then hn(m) = {0,1,...,q,q,...}.

The relationships between the solutions to nq=1 for n={2,4,8} is very simple. If qn is the solution for n, then

4q4 = (22)q4 = 22q4 =1
2q4 = q2
and hence
q4 = q2/2 = 6/2 = 3

Likewise q8 = q2/3 = 6/3 = 2.

Furthermore, since DigitSum(2*5)=1, DigitSum((2*5)q2=1 and hence 5q2=1 and therefore q5=q2=6. Likewise DigitSum(7*4)=1 so q7=q4=3.

Negative Powers

The patterns found above for the powers of integers carries over to the negative powers to some extent. For example, 2−1=0.5 so the DigitSum(2−1)=5 and DigitSum(2−1)=DigitSum(0.25)=7, etc. However the DigitSum(3−1) is not defined.

A limited tabulation of the digit sums of the negative powers of digits is shown below:


Although the reciprocal of 7 is a nonterminating decimal a digit sum may be defined for it of 4. This is possible because 7 has multiplicative inverse of 4 modulo 9; i.e., 7*4=1 mod 9. See Digit sums for repeating decimals. With DigitSum(7−1)=4 the pattern for the negative powers of 7 is the same pattern as the positive powers of 4; i.e., {1,4,7,1,4,7,....}.

Nonintegral But Terminating Decimal Base for a Power

If a is a terminating decimal then DigitSum(am) follows the same pattern as for DigitSum(nm). The decimal point is shifted but that does not affect the digit sum. For example, if a=0.4 then am=4m/10m and hence DigitSum(0.4m)=DigitSum(4m).

(To be continued.)

HOME PAGE OF applet-magic
HOME PAGE OF Thayer Watkins