Peeter Joot's (OLD) Blog.

Math, physics, perl, and programming obscurity.

A condition for divisibility by three

Posted by peeterjoot on November 26, 2012

[Click here for a PDF of this post with nicer formatting]

Motivation

My daughter told me that any number that any number who’s digits add up to a multiple of three are divisible by three. I’d never heard of such a thing, and was suprised by it. In the spirit of a true geek dad, I had to figure out why it works.

Guts

Let’s represent our number by a sum of digits

\begin{aligned}n = \sum_{k = 0}^N a_k 10^k,\end{aligned} \hspace{\stretch{1}}(1.2.1)

and the condition for digits adding up to a multiple of three (say m times 3) is

\begin{aligned}\sum_{k = 0}^N a_k = 3 m.\end{aligned} \hspace{\stretch{1}}(1.2.2)

We can pull that out of the sum, and sure enough, the remainder (in base 10) is divisible by three

\begin{aligned}\begin{aligned}n&= \sum_{k = 0}^N a_k +\sum_{k = 1}^N a_k (10^k - 1) \\ &=3m +9 a_1 + 99 a_2 + 999 a_3 + \cdots \\ &= 3 ( m + 3 a_1 + 33 a_2 + 333 a_3 + \cdots )\end{aligned}\end{aligned} \hspace{\stretch{1}}(1.2.3)

Aurora also mentioned that this works for 9 too, which we can see by inspection. Pretty cool (just like my daughter).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: