0 randFromArray([true, false]) randRange(10000, 1000000)

Is \large{NUMBER} divisible by FACTOR?

DIVISIBLE ? "Yes" : "No"

• Yes
• No
2

Any even number is divisible by 2.

NUMBER is even, so yes, it is divisible by 2.

NUMBER is odd, so it is not divisible by 2.

3 (function(){ var steps = []; var colors = [PINK, PURPLE, GREEN, BLUE]; var num = NUMBER; var numColor = colors.pop(); while (num > FACTOR * 11) { var sumColor = colors.pop(); var digits = integerToDigits(num); var sum = _.reduce(digits, function(m, v) { return m + v; }, 0); steps.push({ num: "\\color{" + numColor + "}{" + num + "}", digits: _.map(digits, function(digit) { return "\\color{" + numColor + "}{" + digit + "}"; }), sum: "\\color{" + sumColor + "}{" + sum + "}", }); num = sum; numColor = sumColor; } return steps; })()

A number is divisible by FACTOR if the sum of its digits is divisible by FACTOR. [Why?]

First, we can break the number up by place value:

 \qquad\begin{eqnarray} \blue{NUMBER}= integerToDigits(NUMBER).map(function(v, p) { var placeValue = pow(10, integerToDigits(NUMBER).length - p - 1); return "&&\\blue{" + v + "}\\cdot" + placeValue; }).join("+ \\\\") \end{eqnarray} 

Next, we can rewrite each of the place values as 1 plus a bunch of 9s:

 \qquad\begin{eqnarray} \blue{NUMBER}= integerToDigits(NUMBER).map(function(v, p) { var placeValue = pow(10, integerToDigits(NUMBER).length - p - 1); if (placeValue === 1) { return "&&\\blue{" + v + "}"; } return "&&\\blue{" + v + "}(" + (placeValue - 1) + "+1)"; }).join("+ \\\\") \end{eqnarray} 

Now if we distribute and rearrange, we get this:

 \qquad\begin{eqnarray} \blue{NUMBER}= integerToDigits(NUMBER).map(function(v, p) { var placeValue = pow(10, integerToDigits(NUMBER).length - p - 1); if (placeValue === 1) { return ""; } return "&&\\gray{" + v + "\\cdot" + (placeValue - 1) + "}"; }).join("+ \\\\")&& \blue{integerToDigits(NUMBER) .join("}+\\blue{")} \end{eqnarray} 

Any number consisting only of 9s is a multiple of FACTOR, so the first cardinal(integerToDigits(NUMBER) .length - 1) terms must all be multples of FACTOR.

That means that to figure out whether the original number is divisible by FACTOR , all we need to do is add up the digits and see if the sum is divisible by FACTOR. In other words, \blue{NUMBER} is divisible by FACTOR if \blue{ integerToDigits(NUMBER).join("}+\\blue{") } is divisible by FACTOR!

Add the digits of STEP.num:

 STEP.digits.join("+") = STEP.sum 

If STEP.sum is divisible by FACTOR, then STEP.num must also be divisible by FACTOR.

_.last(STEPS).sum is divisible by FACTOR, therefore \blue{NUMBER} must also be divisible by FACTOR.

_.last(STEPS).sum is not divisible by FACTOR, therefore \blue{NUMBER} must not be divisible by FACTOR.

4

A number is divisible by 4 if the last two digits are divisible by 4. [Why?]

We can rewrite the number as a multiple of 100 plus the last two digits:

\qquad \gray{NUMBER.toString().slice(0, -2)} \blue{("00" + (NUMBER % 100)).slice(-2)} = \gray{NUMBER.toString().slice(0, -2)} \gray{00} + \blue{("00" + (NUMBER % 100)).slice(-2)} 

Because NUMBER.toString().slice(0, -2) 00 is a multiple of 100, it is also a multiple of 4.

So as long as the value of the last two digits, \blue{NUMBER % 100}, is divisible by 4, the original number must also be divisible by 4!

Is the value of the last two digits, NUMBER % 100, divisible by 4?

Yes, \blue{NUMBER % 100 \div 4 = NUMBER % 100 / 4}, so NUMBER must also be divisible by 4.

No, NUMBER % 100 is not divisible by 4, so NUMBER is also not divisible by 4.

5

A number is divisible by 5 if the last digit is a 0 or a 5.

The last digit of NUMBER is NUMBER % 10, so yes NUMBER is divisible by 5.

The last digit of NUMBER is NUMBER % 10, so no NUMBER is not divisible by 5.

9
10

A number is divisible by 10 if the last digit is a 0.

The last digit of NUMBER is NUMBER % 10, so yes NUMBER is divisible by 10.

The last digit of NUMBER is NUMBER % 10, so no NUMBER is not divisible by 10.