# Mathematics

**URL:** https://boards.straightdope.com/t/mathematics/619411
**Category:** Factual Questions
**Created:** [April 20, 2012, 2:19pm UTC](https://boards.straightdope.com/t/mathematics/619411 "2012-04-20T14:19:13Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![pdunderhill](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pdunderhill](https://boards.straightdope.com/u/pdunderhill)
#### Post date: [April 20, 2012, 2:19pm UTC](https://boards.straightdope.com/t/mathematics/619411/1 "2012-04-20T14:19:13Z")

</div>

Good day everyone.  
A simple idea, it’s possible to look at positive whole integers and work out their primes for several numbers, example: 1331, is divisible by 11, add altenate digits 1 and 3 and 1 and 3 if they are identical or the sum is divisible by 11 then the original is divisible by 11.  
2’s are easy, is the last digit even, similar with 5’s, ( 0 or 5).  
So I remember a ‘rule of 7’s’ in other words a way of looking at an integer and discovering if it’s directly divisible by 7, sadly age and extraneous brain fluff have pushed out this proof. Anyone remember?  
Peter

---

<div class="post-metadata">

### Author: ![iamnotbatman](https://avatars.discourse-cdn.com/v4/letter/i/858c86/32.png) [@iamnotbatman](https://boards.straightdope.com/u/iamnotbatman)
#### Post date: [April 20, 2012, 2:44pm UTC](https://boards.straightdope.com/t/mathematics/619411/2 "2012-04-20T14:44:41Z")

</div>

They aren’t as simple as the other examples you listed, but there are a number of ways. Wikipedia’s [entry](http://en.wikipedia.org/wiki/Divisibility_rule#Divisibility_by_7).

---

<div class="post-metadata">

### Author: ![CalMeacham](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/calmeacham/32/35_2.png) [@CalMeacham](https://boards.straightdope.com/u/CalMeacham)
#### Post date: [April 20, 2012, 2:45pm UTC](https://boards.straightdope.com/t/mathematics/619411/3 "2012-04-20T14:45:17Z")

</div>

Here’s the Wikipedia page on divisibility tests. There are plenty of others out there on the web:

> **[Divisibility rule](https://en.wikipedia.org/wiki/Divisibility_test)**
>
> A divisibility rule is a shorthand and useful way of determining whether a given integer is divisible by a fixed divisor without performing the division, usually by examining its digits. Although there are divisibility tests for numbers in any radix, or base, and they are all different, this article presents rules and examples only for decimal, or base 10, numbers. Martin Gardner explained and popularized these rules in his September 1962 "Mathematical Games" column in Scientific American.
> The ...

I don’t complain about your asking something that’s easily looked up on the internet – it’s often not clear what to type into your search engine.  
But you really should try to be a bit more specific in your thread title. “Mathemsatics” covers a helluva lot of ground.

---

<div class="post-metadata">

### Author: ![John\_Mace](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/john_mace/32/185_2.png) [@John\_Mace](https://boards.straightdope.com/u/John_Mace)
#### Post date: [April 20, 2012, 2:48pm UTC](https://boards.straightdope.com/t/mathematics/619411/4 "2012-04-20T14:48:14Z")

</div>

Wikipedia: Trying it’s damnedest to put QG out of business since 2000. 🙂

---

<div class="post-metadata">

### Author: ![Saint\_Cad](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saint_cad/32/18907_2.png) [@Saint\_Cad](https://boards.straightdope.com/u/Saint_Cad)
#### Post date: [April 20, 2012, 2:50pm UTC](https://boards.straightdope.com/t/mathematics/619411/5 "2012-04-20T14:50:19Z")

</div>

> [@John\_Mace](#):
>
> Wikipedia: Trying it’s damnedest to put QG out of business since 2000. 🙂

It’s taking longer than we thought.

---

<div class="post-metadata">

### Author: ![Exapno\_Mapcase](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/exapno_mapcase/32/1051_2.png) [@Exapno\_Mapcase](https://boards.straightdope.com/u/Exapno_Mapcase)
#### Post date: [April 20, 2012, 3:50pm UTC](https://boards.straightdope.com/t/mathematics/619411/6 "2012-04-20T15:50:10Z")

</div>

> [@John\_Mace](#):
>
> Wikipedia: Trying it’s damnedest to put QG out of business since 2000. 🙂

It’s not doing a good enough job.

> [@](#):
>
> QG may mean:  
> Quantum gravity, a physics theory unifying relativity (gravity) and quantum mechanics  
> Queen’s Gambit, a chess opening move  
> Quasigeostrophic, an atmospheric dynamics theory - see Geostrophic wind  
> Quadrature Generator, see Quadrature amplitude modulation  
> Quake God, a level in the PC game  
> Nissan QG engine series  
> ATCvet code QG Genito-urinary system and sex hormones, a section of the Anatomical Therapeutic Chemical Classification System for veterinary medicinal products  
> quod google, an internet-era term meaning “google it”, similar to ‘qv’ (quod vide (q.v.)

---

<div class="post-metadata">

### Author: ![mcgato](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@mcgato](https://boards.straightdope.com/u/mcgato)
#### Post date: [April 20, 2012, 10:16pm UTC](https://boards.straightdope.com/t/mathematics/619411/7 "2012-04-20T22:16:49Z")

</div>

> [@iamnotbatman](#):
>
> They aren’t as simple as the other examples you listed, but there are a number of ways. Wikipedia’s [entry](http://en.wikipedia.org/wiki/Divisibility_rule#Divisibility_by_7).

I just read that, and I think a simpler rule to those is “to determine if a number is divisible by 7, divide the number by 7 and see.” It has been my belief that there is no simple rule for determining if a number is divisible by 7. I maintain that belief.

---

<div class="post-metadata">

### Author: ![Little\_Nemo](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/little_nemo/32/3120_2.png) [@Little\_Nemo](https://boards.straightdope.com/u/Little_Nemo)
#### Post date: [April 20, 2012, 11:59pm UTC](https://boards.straightdope.com/t/mathematics/619411/8 "2012-04-20T23:59:17Z")

</div>

> [@](#):
>
> QG may mean:  
> Quantum gravity, a physics theory unifying relativity (gravity) and quantum mechanics  
> Queen’s Gambit, a chess opening move  
> Quasigeostrophic, an atmospheric dynamics theory - see Geostrophic wind  
> Quadrature Generator, see Quadrature amplitude modulation  
> Quake God, a level in the PC game  
> Nissan QG engine series  
> ATCvet code QG Genito-urinary system and sex hormones, a section of the Anatomical Therapeutic Chemical Classification System for veterinary medicinal products  
> quod google, an internet-era term meaning “google it”, similar to ‘qv’ (quod vide (q.v.)

He must have meant _Questions Général_, a forum on _le Dopé Droit_.

---

<div class="post-metadata">

### Author: ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)
#### Post date: [April 21, 2012, 1:07am UTC](https://boards.straightdope.com/t/mathematics/619411/9 "2012-04-21T01:07:34Z")

</div>

The “Add digits in such and such a fashion…”-type rule for checking decimal numbers for divisibility by 7 is this: split the numbers digits into triplets, from right to left. For each triplet ABC, compute the value (2 x A + 3 x B + C) mod 7. Alternately add and subtract these remainders, from right to left. The result is the original number’s remainder mod 7.

---

<div class="post-metadata">

### Author: ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)
#### Post date: [April 21, 2012, 1:15am UTC](https://boards.straightdope.com/t/mathematics/619411/10 "2012-04-21T01:15:24Z")

</div>

Actually, let me rephrase that more modularly:

The “Add digits in such and such a fashion…”-type rule for checking decimal numbers for divisibility by 7 is this: split the number’s digits into triplets, from right to left. Alternately add and subtract the triplets, mod 7, from right to left. The result is the original number mod 7.

If one wants further help: As for how to handle a particular triplet ABC, its value mod 7 is the same as that of 2 x A + 3 x B + C.

If one wants further help: As for how to handle a particular digit, remember that mod 7 we may treat 7 as 0, 8 as 1, 9 as 2, 6 as -1, etc. The decimal digits can be taken to go from -3 to 3.

Putting all these together, it’s not that bad. Indeed, even ignoring the further help and just doing the first bit, it’s not that bad.

---

<div class="post-metadata">

### Author: ![Giles](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/giles/32/60_2.png) [@Giles](https://boards.straightdope.com/u/Giles)
#### Post date: [April 21, 2012, 1:41am UTC](https://boards.straightdope.com/t/mathematics/619411/11 "2012-04-21T01:41:31Z")

</div>

> [@Indistinguishable](#):
>
> Putting all these together, it’s not that bad. Indeed, even ignoring the further help and just doing the first bit, it’s not that bad.

It may be slightly easier for human calculation, but I think that the most practical algorithm is just to divide by 7 and see what the remainder is. With decimal notation, there are only a few prime numbers with easy algorithms: 2, 3, 5, 11 and 37. (37 has one because 111=37\*3.)

---

<div class="post-metadata">

### Author: ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)
#### Post date: [April 21, 2012, 2:03am UTC](https://boards.straightdope.com/t/mathematics/619411/12 "2012-04-21T02:03:19Z")

</div>

The divisibility test for 37 (split into triplets, add mod 37) isn’t so very different from that for 7; 7 just has the alternation between addition and subtraction.

---

<div class="post-metadata">

### Author: ![AaronX](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@AaronX](https://boards.straightdope.com/u/AaronX)
#### Post date: [April 21, 2012, 7:15am UTC](https://boards.straightdope.com/t/mathematics/619411/13 "2012-04-21T07:15:02Z")

</div>

If you’re going to mod it, isn’t that already a divisibility test? You might as well go mod(number,7) and see if it’s 0.

---

<div class="post-metadata">

### Author: ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)
#### Post date: [April 21, 2012, 7:41am UTC](https://boards.straightdope.com/t/mathematics/619411/14 "2012-04-21T07:41:48Z")

</div>

Modding 3 digit numbers in order to mod arbitrary digit numbers. Just like the test for divisibility by 3 is “Add up the digits, mod 3”.

---

<div class="post-metadata">

### Author: ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)
#### Post date: [April 21, 2012, 9:46am UTC](https://boards.straightdope.com/t/mathematics/619411/15 "2012-04-21T09:46:16Z")

</div>

(Also, FWIW, when I say “add mod X”, I don’t necessarily mean you have to reduce to remainders right now. I just mean you can replace anything by anything it is equivalent to mod X as you go along, as frequently or as rarely as you like. In practice, it is often convenient to reduce everything to remainders as early as possible (why deal with additions of increasingly large numbers?), but it’s up to you.)

---

<div class="post-metadata">

### Author: ![Andy\_L](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Andy\_L](https://boards.straightdope.com/u/Andy_L)
#### Post date: [April 21, 2012, 10:22pm UTC](https://boards.straightdope.com/t/mathematics/619411/16 "2012-04-21T22:22:14Z")

</div>

> [@pdunderhill](#):
>
> Good day everyone.  
> A simple idea, it’s possible to look at positive whole integers and work out their primes for several numbers, example: 1331, is divisible by 11, add altenate digits 1 and 3 and 1 and 3 if they are identical or the sum is divisible by 11 then the original is divisible by 11.  
> 2’s are easy, is the last digit even, similar with 5’s, ( 0 or 5).  
> So I remember a ‘rule of 7’s’ in other words a way of looking at an integer and discovering if it’s directly divisible by 7, sadly age and extraneous brain fluff have pushed out this proof. Anyone remember?  
> Peter

Take the ones digit, double it and subtract that from the portion of the number excluding the ones digit. Repeat until you get a number obviously divisible by 7 or obviously not divisible by 7 (you can ignore signs).

Example: Is 1253 divisible by 7? The ones digit is 3 - so we double that and subtract 6 from 125 to get 119. The ones digit of that number is 9, so we double that and subtract 18 from 11 - and get -7, which is obviously divisible by 7, meaning that 1253 is divisible by 7 (1253 is 179\*7).

That’s the simplest method I know of, and it’s pretty quick. You can determine that 98765 is not divisible by 7 in a few moments, by subtracting 10 from 9876 to get 9866, subtract 12 from 986 to get 974, subtract 8 from 97 to get 89, and subtract 18 from 8 to get -10 which is obviously not divisible by 7. If anyone is curious I can explain why this works.

---

<div class="post-metadata">

### Author: ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)
#### Post date: [April 21, 2012, 10:53pm UTC](https://boards.straightdope.com/t/mathematics/619411/17 "2012-04-21T22:53:06Z")

</div>

It works because 10x + y is divisible by 7 just in case x - 2y is divisible by 7.

Why is that? Because 10x + y = 7(3(x - 2y)/7 + x + y), and, conversely, x - 2y = 7(-2(10x + y)/7 + 3x). So if either one divided by 7 is an integer, the other is also 7 times an integer.

---

<div class="post-metadata">

### Author: ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)
#### Post date: [April 21, 2012, 11:05pm UTC](https://boards.straightdope.com/t/mathematics/619411/18 "2012-04-21T23:05:55Z")

</div>

Eh, for aesthetic symmetry, I should have written that as (10x + y)/7 = 3(x - 2y)/7 + x + y and (x - 2y)/7 = -2(10x + y)/7 + 3x.

(Also, sorry I stole your thunder, **Andy L**.)

---

<div class="post-metadata">

### Author: ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)
#### Post date: [April 21, 2012, 11:26pm UTC](https://boards.straightdope.com/t/mathematics/619411/19 "2012-04-21T23:26:13Z")

</div>

I would phrase the reason as “you’re subtracting off a multiple of 21, and then dividing by ten”.

---

<div class="post-metadata">

### Author: ![Indistinguishable](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@Indistinguishable](https://boards.straightdope.com/u/Indistinguishable)
#### Post date: [April 21, 2012, 11:40pm UTC](https://boards.straightdope.com/t/mathematics/619411/20 "2012-04-21T23:40:39Z")

</div>

That’s a much nicer way to put it, yes. [With, of course, the understanding that the division by 10 won’t undo divisibility by 7 on the grounds that 10 and 7 are coprime]

[Next page](https://boards.straightdope.com/t/mathematics/619411.md?page=2)
