0

In Uspensky's text 'Elementary Number Theory' on pg. 131 there are 3 rules given for division by $9, 3, 11$. I am detailing below, with the exercise part for the same for $7$:

Let a number $N$ be represented in the decimal notation as :
$$N = a + 10b + 10^2c + 10^3d + ...$$

(i) Rule for divisibility by $9$:
Notice that :
$$10 \equiv 1, 10^2 \equiv 1, 10^3 \equiv 1,...\pmod 9 $$

So, if the sum of digits ($a+b+c+..$) is divisible by $9$, then divisible by $9$.

-- same for divisibility by $3$, as $10 \equiv 1, 10^2 \equiv 1, 10^3 \equiv 1,...\pmod 3$. .

(ii) Rule for divisibility by $11$:
Notice that :
$$10 \equiv -1, 10^2 \equiv 1, 10^3 \equiv -1,...\pmod {11} $$

So, if the sum of alternating sign digits ($a-b+c-d+e...$ ) is divisible by $11$, then number is divisible by $11$.


But, how to find such modulo based division rule for $7$, which has no easy pattern.
$$10 \equiv 3, 10^2 \equiv 2, 10^3 \equiv 6, 10^4 \equiv 4, 10^5 \equiv 5, 10^6 \equiv 1, ...\pmod 7 $$ This cycle repeats after every 6 digits.

So my incomplete attempt is:
$n = 1\cdot g + 5\cdot f + 4\cdot e + 6\cdot d + 2\cdot c + 3\cdot b + a$
for first 7 digits, so need consider only groups of $6$ digits:
$n = 5\cdot f + 4\cdot e + 6\cdot d + 2\cdot c + 3\cdot b + a$ for first 6 digits.

jiten
  • 4,524
  • 2
    What's the question? Yes, the rule for checking divisibility by $7$ looks like what you wrote...as you see, it's not terribly practical. At least, it's nowhere near as handy as the rules for $3,9,11$. – lulu Jan 17 '18 at 01:52
  • 2
    As with $11$, it is computationally simpler to write the remainders of $10^i \pmod 7$ as ${1,3,2,-1,-3,-2}$ . That makes it look a little simpler, no? – lulu Jan 17 '18 at 01:54
  • 1
    @lulu So, this is the rule! Very strange, and happy too. – jiten Jan 17 '18 at 01:54
  • 2
    Look at my second comment...I think the rule looks better with negative residues. – lulu Jan 17 '18 at 01:54
  • 1
    @lulu It is better to have negative residues to form a sort of pattern, but is it possible for all numbers(modulus) that have a set of repeating residues. If so, give me proof. As can be seen here, there are $6$ residues for modulus as $7$, with range from : $-3$ to $3$ . – jiten Jan 17 '18 at 01:56
  • 2
    Of course it is. Assuming $\gcd(10,n)=1$ then there has to be some minimal exponent such that $10^i\equiv 1 \pmod n$. The period of the residues is then $i$. – lulu Jan 17 '18 at 01:59
  • 1
    @lulu It has become very interesting, as seems to do with group theory. – jiten Jan 17 '18 at 02:00
  • 2
    Sure, my $i$ is just the order of $10$ as an element of the group of units $\pmod n$ – lulu Jan 17 '18 at 02:01
  • 1
    @jiten, See also : https://math.stackexchange.com/questions/328562/divisibility-criteria-for-7-11-13-17-19 – lab bhattacharjee Jan 17 '18 at 05:05

2 Answers2

1

Let's take a number $x = \overline{abcde}$

Now, $x = 10 \cdot \overline{abcd} + e$. Note that multiplying $x$ by values that are not $7$ change its value $\mod 7$ but do not change its divisibility.

$$5x = 50\cdot \overline{abcd} + 5e \equiv \overline{abcd} + 5e\mod7 $$

This process can continue onwards, where you add all digits except the last, then add $5$ times the last.

I'll give an example to help out

$$x=7142835$$ Clearly this is divisible by $7$ by quick inspection. $$x = 10(714283) + 5$$ Now we can take this modulo $7$ $$x = 10(714283) + 5 \equiv \ ? \mod 7$$ Assume this is divisible by $7$ $$x \equiv 0 \mod 7$$ Then, $$5x \equiv 5 \cdot 0 \equiv 0\mod 7$$ However, if $x$ is anything else $\mod 7$, then itwill NEVER become zero if you keep multiplying by $5$

Therefore,

$$\text{if } 10(714283) + 5 \equiv 0 \mod 7$$ $$10(714283) + 5 \equiv 50(714283) + 25 \equiv (714283) + 25 \equiv714308 \mod 7$$ $$714308 \equiv 10(71430) + 8\equiv 71430 + 40 \equiv71470$$ $$71470 \to 7147$$ $$7147 \to 714 + 35 = 749$$ $$749 \to 74+9 = 63$$ Which you should now know is divisible by $7$

John Lou
  • 2,388
  • 13
  • 16
0

Let the number N be written as $N=10a+b$.

If N is divisible by 7, then $10a+b (mod 7)=0$ Also $k(10a+b) (mod 7)=0$ where $k$ is an integer.

Write down the multiples of 7. (7, 14, 21, ... ). Find a multiple that ends with 9 or 1. In this case it's 21. So the k you would choose would be int(21/10+0.5) = 2.

Then we have, $$20a +2b (mod7) = 0$$ $$\implies -a + 2b (mod 7) = 0$$ $$\implies a-2b (mod 7)=0 $$

Example: N=8638

Check if $863-2(8)=847$ is divisible by 7.

Check if $84-2(7)=70$ is divisible by 7.

So 8638 is divisible by 7

You can do this for other numbers as well, such as 13. Multiples of 13 are 13, 26, 39, ..., so k=int(39/10+0.5)=4

$$40a+4b (mod 13)=0$$ $$\implies a+4b (mod 13)=0$$