## Neat Mental Arithmetic Tricks

**Moderators:** gmalivuk, Moderators General, Prelates

- Carlington
**Posts:**1588**Joined:**Sun Mar 22, 2009 8:46 am UTC**Location:**Sydney, Australia.

### Neat Mental Arithmetic Tricks

It took me a while, but I realised just the other day that if I internalised all of the algebra and geometry and other such things I've spent the last thirteen years learning, then I could use it to make manipulating numbers much easier to do mentally.

Since then, every time I come up against a problem that is tricky to do in my head, I've been working it out, then working out a general solution to problems of that type, and simplifying that solution as much as possible, so that next time I have to do a similar problem, I'll be able to do it much more quickly and efficiently.

As a direct result of this, I've started cataloguing neat tricks for making mental arithmetic much easier to do. Most (read: all) of them are probably well-known and have already been well-studied by mathematics, but they're new and interesting to me, and it's more fun to try and come up with solutions for myself than to go on a wikicrawl and find out that way.

This stated when, a while ago, I realised that I could use the distributive law to make multiplying numbers in my head easier. Then, more recently, I realised I could use the same thing (and FOIL) to make squaring two digit numbers easier (although I'm still trying to make it easy to extend this to larger numbers). Just the other day we learnt about infinite series (to go with learning Taylor series), which helped me to realise that dividing by 9 isn't nearly as hard as I thought. And one of my tutors in maths told us about "casting out nines", which can be used as a sanity check for whether a number is divisible by nine in the first place.

Does anybody else enjoy doing this sort of thing? What are some interesting and/or useful tricks you know, whether you've come up with them yourself or they were taught to you by somebody else?

Since then, every time I come up against a problem that is tricky to do in my head, I've been working it out, then working out a general solution to problems of that type, and simplifying that solution as much as possible, so that next time I have to do a similar problem, I'll be able to do it much more quickly and efficiently.

As a direct result of this, I've started cataloguing neat tricks for making mental arithmetic much easier to do. Most (read: all) of them are probably well-known and have already been well-studied by mathematics, but they're new and interesting to me, and it's more fun to try and come up with solutions for myself than to go on a wikicrawl and find out that way.

This stated when, a while ago, I realised that I could use the distributive law to make multiplying numbers in my head easier. Then, more recently, I realised I could use the same thing (and FOIL) to make squaring two digit numbers easier (although I'm still trying to make it easy to extend this to larger numbers). Just the other day we learnt about infinite series (to go with learning Taylor series), which helped me to realise that dividing by 9 isn't nearly as hard as I thought. And one of my tutors in maths told us about "casting out nines", which can be used as a sanity check for whether a number is divisible by nine in the first place.

Does anybody else enjoy doing this sort of thing? What are some interesting and/or useful tricks you know, whether you've come up with them yourself or they were taught to you by somebody else?

Kewangji: Posdy zwei tosdy osdy oady. Bork bork bork, hoppity syphilis bork.

Eebster the Great: What specifically is moving faster than light in these examples?

doogly: Hands waving furiously.

Eebster the Great: What specifically is moving faster than light in these examples?

doogly: Hands waving furiously.

Please use he/him/his pronouns when referring to me.

### Re: Neat Mental Arithmetic trickses

Cube roots of perfect cubes that are ≤9 digits long (so, start with a 1, 2, or 3-digit number, cube it, then tell me the result, and I’ll find the number you started with.) It makes use of the fast mod-11 trick.

wee free kings

- Carlington
**Posts:**1588**Joined:**Sun Mar 22, 2009 8:46 am UTC**Location:**Sydney, Australia.

### Re: Neat Mental Arithmetic trickses

That is impressive, and I know nothing of modular arithmetic so I don't know what the fast mod-11 trick is.

Kewangji: Posdy zwei tosdy osdy oady. Bork bork bork, hoppity syphilis bork.

Eebster the Great: What specifically is moving faster than light in these examples?

doogly: Hands waving furiously.

Eebster the Great: What specifically is moving faster than light in these examples?

doogly: Hands waving furiously.

Please use he/him/his pronouns when referring to me.

### Re: Neat Mental Arithmetic trickses

If you know a perfect square, you can find the next square above it by adding the number and then number +1. Follows directly from the algebra, and it's generally pretty quick to use. Eg. What's 41^2? Well 40^2 is 1600, then add 40 and add 41 to get 41^2 = 1681.

There's various tricks for divisibility beyond casting out 9s:

If the last digit is divisible by 2, so is the number.

If the last two digits are divisible by 4, so is the number. This can be extended for all powers of 2, though in practice it's probably only useful for 2, 4, maybe 8.

If the sum of the digits is divisible by 3, then it is divisible by 3. If the sum of the digits is divisible by 9, then so is the number. Extends to higher powers of 3.

Rules for 2s and 3s can be extended to any multiples of them, such as 6, 12, etc.

If the sum of the even digits minus the sum of the odd digits is either 0 or a multiple of 11, then it is divisible by 11.

Linear approximation of Taylor series is useful for a finding roots or powers of things if you don't need to be exact. Eg. (130)^(1/3) = (125+5)^(1/3) = 5(1 + 5/125)^(1/3) approx= 5(1 + (1/3)(1/25)) = 5 + 1/15. Cube root of 130 is actually 5.065797. This gives 5.066667. Close enough for most purposes and most of the steps can be done pretty quickly in your head with some practice.

[edit]An important, and useful one. Definite integrals of the form int(-a...a)f(x)dx are always zero if f(x) is an odd function.

You might be interested in checking out Street-Fighting Mathematics at MIT OpenCourseWare. Some of the topics might be a little advanced if you've only just seen infinite series, but it covers a lot of tricks and tools for approximating or simplifying various sorts of problems.

There's various tricks for divisibility beyond casting out 9s:

If the last digit is divisible by 2, so is the number.

If the last two digits are divisible by 4, so is the number. This can be extended for all powers of 2, though in practice it's probably only useful for 2, 4, maybe 8.

If the sum of the digits is divisible by 3, then it is divisible by 3. If the sum of the digits is divisible by 9, then so is the number. Extends to higher powers of 3.

Rules for 2s and 3s can be extended to any multiples of them, such as 6, 12, etc.

If the sum of the even digits minus the sum of the odd digits is either 0 or a multiple of 11, then it is divisible by 11.

Linear approximation of Taylor series is useful for a finding roots or powers of things if you don't need to be exact. Eg. (130)^(1/3) = (125+5)^(1/3) = 5(1 + 5/125)^(1/3) approx= 5(1 + (1/3)(1/25)) = 5 + 1/15. Cube root of 130 is actually 5.065797. This gives 5.066667. Close enough for most purposes and most of the steps can be done pretty quickly in your head with some practice.

[edit]An important, and useful one. Definite integrals of the form int(-a...a)f(x)dx are always zero if f(x) is an odd function.

You might be interested in checking out Street-Fighting Mathematics at MIT OpenCourseWare. Some of the topics might be a little advanced if you've only just seen infinite series, but it covers a lot of tricks and tools for approximating or simplifying various sorts of problems.

- Xenomortis
- Not actually a special flower.
**Posts:**1455**Joined:**Thu Oct 11, 2012 8:47 am UTC

### Re: Neat Mental Arithmetic trickses

Carlington wrote:That is impressive, and I know nothing of modular arithmetic so I don't know what the fast mod-11 trick is.

There's a trick to find out what the remainder is when you divide a number by 11 (i.e. what n mod 11 is)

You simply iterate through each digit, alternating between adding and subtracting digits, starting from the right.

Cube root of perfect cube < 10^9;

**Spoiler:**

### Re: Neat Mental Arithmetic trickses

Xenomortis wrote:The cubes of 0,1,2,..,9 all have different last digits. It's easy enough to calculate the final digit of the cube root by seeing which number less than 10 cubes to give the same last digit.

So with the number 377933067, the final digit of its cube root must be 3, since 3^{3}= 27.

Even easier: the final digit of the cube root is also the final digit of the cube of the final digit. So with the number 377933067, the final digit of its cube root is the final digit of 7

^{3}=343, which is 3.

Xenomortis wrote:If you haven't memorised the mapping, you'll have to calculate this.

The mapping is simply two cycles of four, with the rest fixed. Namely (2, 8, 6, 7) and (5, 4, 9, 3), or in longhand:

**Spoiler:**

wee free kings

- Magnanimous
- Madmanananimous
**Posts:**3491**Joined:**Wed Feb 17, 2010 7:11 pm UTC**Location:**Land of Hipsters and Rain (LOHAR)

### Re: Neat Mental Arithmetic trickses

LaserGuy wrote:If you know a perfect square, you can find the next square above it by adding the number and then number +1. Follows directly from the algebra, and it's generally pretty quick to use. Eg. What's 41^2? Well 40^2 is 1600, then add 40 and add 41 to get 41^2 = 1681.

On this note: it's easier to memorize square numbers under 100

^{2}than it might seem, since they follow nice patterns. Like the ones digit follows 0-1-4-9-6-5, then backwards 5-6-9-4-1-0, repeating back and forth. Same goes with the rightmost two digits: 00-01-04-09-16-25-36-49-64-81-00-21-44-69-96-25-56-89-24-61-00-41-84-29-76-25. The squares from 50 to 60 are 2500, 2601, 2704, 2809, 2916, 3025, 3136, 3249, 3364, 3481, 3600... Look familiar?

Once you have the first 25 squares memorized, the rest are much easier. Knowing high squares (or at least how to calculate them mentally) is very useful for mental multiplication.

### Re: Neat Mental Arithmetic trickses

Xenomortis wrote:If you don't know the mapping, the following is helpful:

a^{b}= c mod n

implies

d^{b}= a mod n

where d*c = 1 mod n

Are you sure about that?

- Xenomortis
- Not actually a special flower.
**Posts:**1455**Joined:**Thu Oct 11, 2012 8:47 am UTC

### Re: Neat Mental Arithmetic trickses

PM 2Ring wrote:Xenomortis wrote:If you don't know the mapping, the following is helpful:

a^{b}= c mod n

implies

d^{b}= a mod n

where d*c = 1 mod n

Are you sure about that?

Let a,b,c and n be such that a

^{b}= c mod n and b > 0

Then a = c

^{-b}mod n

Given d s.t. d*c = 1 mod n, we have

a = c

^{-b}= d

^{b}mod n

Right?

(In my example, n

^{3}= 6 mod 11

6*2 = 12 = 1 mod 11

Hence 2

^{3}= n = m mod 11)

### Re: Neat Mental Arithmetic trickses

Xenomortis wrote:Let a,b,c and n be such that a^{b}= c mod n and b > 0

Then a = c^{-b}mod n

Not necessarily.

Xenomortis wrote:Given d s.t. d*c = 1 mod n, we have

a = c^{-b}= d^{b}mod n

Right?

(In my example, n^{3}= 6 mod 11

6*2 = 12 = 1 mod 11

Hence 2^{3}= n = m mod 11)

Your example works because φ(11) = 10 and 3² = -1 mod 10.

### Re: Neat Mental Arithmetic trickses

Xenomortis wrote:Let a,b,c and n be such that a^{b}= c mod n and b > 0

Then a = c^{-b}mod n

No. a = c

^{b^-1}, which you get by raising both sides to the power of b inverse.

ETA: but it is the inverse mod φ(n), as PM points out, since you need a

^{1}= a

^{b*b^-1}for any value a, and we have a

^{φ(n)}=1=a

^{0}.

Last edited by jaap on Fri Jun 07, 2013 9:41 am UTC, edited 2 times in total.

- Xenomortis
- Not actually a special flower.
**Posts:**1455**Joined:**Thu Oct 11, 2012 8:47 am UTC

### Re: Neat Mental Arithmetic trickses

Magnanimous wrote:Once you have the first 25 squares memorized, the rest are much easier. Knowing high squares (or at least how to calculate them mentally) is very useful for mental multiplication.

Since you can turn products into differences of two squares, although that can get a little messy if the numbers to be multiplied don't have the same parity, since then you have to deal with squares of the form (n + ½)². OTOH, that's not too bad, since (n + ½)² = n² + n + ¼.

Once you've memorised the first 25 squares, the squares up to 125² are pretty easy,

since (50 ± n)² = 100(25 ± n) + n²,

and (100 ± n)² = 100(100 ± 2n) + n².

### Re: Neat Mental Arithmetic trickses

On topic: I have used the taylor expansion of the square root, to approximate things like \sqrt{5}. Also: calculating things like 13*17=15

Another very useful (but limited) trick is if you need to calculate an integral, and it can be easily seen that it is bounded, then the integral must be smaller (in absolute value) than a bound times the domain of integration. For example \int_0^1 \int_0^1 e^{-x^2/y}\sin y dx dy. Not a clue what the actual answer is, but if it's not in [0,1], it's wrong.

^{2}-4=221. That is the same trick PM2Ring refered to.Another very useful (but limited) trick is if you need to calculate an integral, and it can be easily seen that it is bounded, then the integral must be smaller (in absolute value) than a bound times the domain of integration. For example \int_0^1 \int_0^1 e^{-x^2/y}\sin y dx dy. Not a clue what the actual answer is, but if it's not in [0,1], it's wrong.

### Re: Neat Mental Arithmetic trickses

I learned the divisibility test for 7 this last year, after teaching the rest of the divisibility rules to my students and finding out it existed:

Double the last digit, subtract it from the remaining digits, is it a multiple of 7?

If you can't tell, repeat the process until you know whether it is a multiple of 7 or not.

15,287 --> 7*2 = 14. 1,528 - 14 = 1,514.

1,514 --> 4*2 = 8. 151 - 8 = 143.

143 --> 3*2 = 6. 14 - 6 = 8. NOT a multiple of 7, so 15,287 is not divisible by 7.

17,360 --> 0*2 = 0. --> 1,736.

1,736 --> 6*2 = 12. 173 - 12 = 161.

161 --> 1*2 = 2. 16 - 2 = 14. IS a multiple of 7, so 17,360 is divisible by 7.

Double the last digit, subtract it from the remaining digits, is it a multiple of 7?

If you can't tell, repeat the process until you know whether it is a multiple of 7 or not.

15,287 --> 7*2 = 14. 1,528 - 14 = 1,514.

1,514 --> 4*2 = 8. 151 - 8 = 143.

143 --> 3*2 = 6. 14 - 6 = 8. NOT a multiple of 7, so 15,287 is not divisible by 7.

17,360 --> 0*2 = 0. --> 1,736.

1,736 --> 6*2 = 12. 173 - 12 = 161.

161 --> 1*2 = 2. 16 - 2 = 14. IS a multiple of 7, so 17,360 is divisible by 7.

"We never do anything well unless we love doing it for its own sake."

Avatar: I made a "plastic carrier" for Towel Day à la So Long and Thanks for All the Fish.

Avatar: I made a "plastic carrier" for Towel Day à la So Long and Thanks for All the Fish.

### Re: Neat Mental Arithmetic trickses

LaserGuy wrote:Spoiler:

If the sum of the digits is divisible by 3, then it is divisible by 3. If the sum of the digits is divisible by 9, then so is the number. Extends to higher powers of 3.

Rules for 2s and 3s can be extended to any multiples of them, such as 6, 12, etc.

If the sum of the even digits minus the sum of the odd digits is either 0 or a multiple of 11, then it is divisible by 11.

Powers of 2: no argument.

Powers of 3: Sort of. If you attempt to add up the digits to see whether the sum is divisible by 9 or 27, etc, then you have a bit of a problem:

27*3563 = 96,201 , whose digits add up to 18 (which adds to 9). This works for me, though, since now I can divide by 9 and repeat the process: 10,689 adds to 24, which is only divisible by 3 (at best), so 96,201 is divisible by: 3, 9, and 27.

Multiples of 11: I'm not quite getting what you mean. The rule is that you index each digit in the number. So in 96,201 , you say that 9 is the first, 6 is the second, etc. Then you take every oddly indexed number and add them, while every evenly indexed number is subtracted from the total. If you get zero or a multiple of 11, then the number was divisible by 11.

So 209 is divisible by 11 because: + 2 - 0 + 9 = 11, while 96,201 isn't because: + 9 - 6 + 2 - 0 + 1 = 6.

"We never do anything well unless we love doing it for its own sake."

Avatar: I made a "plastic carrier" for Towel Day à la So Long and Thanks for All the Fish.

Avatar: I made a "plastic carrier" for Towel Day à la So Long and Thanks for All the Fish.

- Magnanimous
- Madmanananimous
**Posts:**3491**Joined:**Wed Feb 17, 2010 7:11 pm UTC**Location:**Land of Hipsters and Rain (LOHAR)

### Re: Neat Mental Arithmetic trickses

andrewxc wrote:I learned the divisibility test for 7 this last year, after teaching the rest of the divisibility rules to my students and finding out it existed:

Double the last digit, subtract it from the remaining digits, is it a multiple of 7?

If you can't tell, repeat the process until you know whether it is a multiple of 7 or not.

15,287 --> 7*2 = 14. 1,528 - 14 = 1,514.

1,514 --> 4*2 = 8. 151 - 8 = 143.

143 --> 3*2 = 6. 14 - 6 = 8. NOT a multiple of 7, so 15,287 is not divisible by 7.

17,360 --> 0*2 = 0. --> 1,736.

1,736 --> 6*2 = 12. 173 - 12 = 161.

161 --> 1*2 = 2. 16 - 2 = 14. IS a multiple of 7, so 17,360 is divisible by 7.

This method actually works for divisibility by any prime number besides 2 or 5, although the multiple is different. Link

### Re: Neat Mental Arithmetic trickses

andrewxc wrote:I learned the divisibility test for 7 this last year, after teaching the rest of the divisibility rules to my students and finding out it existed:

Double the last digit, subtract it from the remaining digits, is it a multiple of 7?

If you can't tell, repeat the process until you know whether it is a multiple of 7 or not.

15,287 --> 7*2 = 14. 1,528 - 14 = 1,514.

1,514 --> 4*2 = 8. 151 - 8 = 143.

143 --> 3*2 = 6. 14 - 6 = 8. NOT a multiple of 7, so 15,287 is not divisible by 7.

17,360 --> 0*2 = 0. --> 1,736.

1,736 --> 6*2 = 12. 173 - 12 = 161.

161 --> 1*2 = 2. 16 - 2 = 14. IS a multiple of 7, so 17,360 is divisible by 7.

If you like that test, then you'll love this one. If the first digit is 7 or greater, then reduce it by seven. Otherwise, replace the first two digits with the remainder from dividing that number by 7. Repeat the process until you know whether it is a multiple of 7 or not.

15287 -> 1287 -> 587 -> 27 -> no

17360 -> 3360 -> 560 -> yes

- gmalivuk
- GNU Terry Pratchett
**Posts:**26821**Joined:**Wed Feb 28, 2007 6:02 pm UTC**Location:**Here and There-
**Contact:**

### Re: Neat Mental Arithmetic trickses

That works in general, actually, since you're just repeatedly subtracting multiples of 7*10^n, which of course won't change divisibility by 7. So the same process will work for other integers as well:

12039854, checking for divisibility by 13:

First two digits are 12, from which we can't subtract 13, but the first 3 are 120, from which we can subtract 13 nine times to get 3:

339854, first two digits are 33, which is 7 mod 13:

79854, first two digits are 79, which is 1 mod 13:

1854, first two digits are 18, which is 5 mod 13:

554, first two digits are 55, which is 3 mod 13:

34 is 8 mod 13, just like 12039854 (and of course maintaining the same remainder is something the other method doesn't do, I believe).

Really, this is just the standard division algorithm, but you don't keep track of any of the quotient information along the way and end up with just the remainder. Since you'd probably need to write things down to do this with bigger numbers in the first place, why not just divide them and be done with it?

12039854, checking for divisibility by 13:

First two digits are 12, from which we can't subtract 13, but the first 3 are 120, from which we can subtract 13 nine times to get 3:

339854, first two digits are 33, which is 7 mod 13:

79854, first two digits are 79, which is 1 mod 13:

1854, first two digits are 18, which is 5 mod 13:

554, first two digits are 55, which is 3 mod 13:

34 is 8 mod 13, just like 12039854 (and of course maintaining the same remainder is something the other method doesn't do, I believe).

Really, this is just the standard division algorithm, but you don't keep track of any of the quotient information along the way and end up with just the remainder. Since you'd probably need to write things down to do this with bigger numbers in the first place, why not just divide them and be done with it?

### Re: Neat Mental Arithmetic trickses

Yeah, I was trolling. My point is that a divisibility trick doesn't qualify as neat unless it is less work than long division.

- gmalivuk
- GNU Terry Pratchett
**Posts:**26821**Joined:**Wed Feb 28, 2007 6:02 pm UTC**Location:**Here and There-
**Contact:**

### Re: Neat Mental Arithmetic trickses

Hm, yeah. I edited my post while you were writing yours to point out that very same thing. It makes me wonder if Stu Savory was also trolling, or if he honestly believes his method has something useful to offer. I like the irony in imagining he complains about how "kids these days" can't recognize multiples while at the same time failing to recognize that his method is less efficient or useful than long division.

Edit: speaking of long division, I'm always a fan of the square root "long division" algorithm, though I suppose it doesn't really work as a mental trick so much as a non-calculator trick, since keeping track of everything in your head would be difficult past 2 or 3 digits.

Edit: speaking of long division, I'm always a fan of the square root "long division" algorithm, though I suppose it doesn't really work as a mental trick so much as a non-calculator trick, since keeping track of everything in your head would be difficult past 2 or 3 digits.

### Re: Neat Mental Arithmetic trickses

gmalivuk wrote:Hm, yeah. I edited my post while you were writing yours to point out that very same thing. It makes me wonder if Stu Savory was also trolling, or if he honestly believes his method has something useful to offer. I like the irony in imagining he complains about how "kids these days" can't recognize multiples while at the same time failing to recognize that his method is less efficient or useful than long division.

Well, his purported "proof" of the fundamental theorem of arithmetic only covers existence, not uniqueness, so he could well be trolling.

I did just learn of Ramanujan's construction to approximately square the circle though, so thanks for the link.

gmalivuk wrote:Edit: speaking of long division, I'm always a fan of the square root "long division" algorithm, though I suppose it doesn't really work as a mental trick so much as a non-calculator trick, since keeping track of everything in your head would be difficult past 2 or 3 digits.

Yeah, that one is great if you need digit-exactness.

But for quicker convergence (and something easier to do mentally) Heron's method is the way to go.

wee free kings

### Re: Neat Mental Arithmetic trickses

flownt wrote: Also: calculating things like 13*17=15^{2}-4=221. That is the same trick PM2Ring refered to.

And that trick can be useful in reverse to calculate squares.

Eg, 23² - 3² = (23 + 3)(23 - 3)

So, 23²

= (23 + 3)(23 - 3) + 3²

= 26 * 20 + 9

= 529

gmalivuk wrote:Edit: speaking of long division, I'm always a fan of the square root "long division" algorithm, though I suppose it doesn't really work as a mental trick so much as a non-calculator trick, since keeping track of everything in your head would be difficult past 2 or 3 digits.

We were taught that algorithm in junior high school. I was initially impressed with it, but after a while I found it a bit tedious, since at each step if you can't guess the next digit you have to do an (approximate) division.

Qaanol wrote:Yeah, that one is great if you need digit-exactness.

But for quicker convergence (and something easier to do mentally) Heron's method is the way to go.

Agreed. Heron's method converges much faster. OTOH, the divisions can get a bit unwieldy, especially when doing it mentally, but it's not too bad if you do it with fractions rather than decimals. And of course, you can round numbers off a little to make the calculations easier, since the next iteration will fix up small errors.

For quick mental square root estimates, I generally use a round or two of

sqrt(a² ± d) ~= a ± d/2a

perhaps followed by a round or two of Heron.

### Re: Neat Mental Arithmetic trickses

andrewxc wrote:I learned the divisibility test for 7 this last year, after teaching the rest of the divisibility rules to my students and finding out it existed:

Double the last digit, subtract it from the remaining digits, is it a multiple of 7?

If you can't tell, repeat the process until you know whether it is a multiple of 7 or not.

Another way would be to group the digits in 3s from the right, then alternately subtract and add, giving you a 3 digit (or less) number to check for divisibility.

E.g. 15,287 -> 287-15 = 272 = 7*30 + 62 (not divisible)

15,287,125 -> 125-287+15 = -162+15 = -147 (divisible)

The method can be used to check for divisibility by 11 and 13 as well, AND it preserves remainders, because you're effectively working in mod 1,001 (7*11*13).

Of course, it's only really a mental trick if you're proficient at adding/subtracting 3 digit numbers.

- Carlington
**Posts:**1588**Joined:**Sun Mar 22, 2009 8:46 am UTC**Location:**Sydney, Australia.

### Re: Neat Mental Arithmetic trickses

It is now evident to me that I have only just barely begun to scratch the surface of what mental arithmetic techniques there are. (sneaky cheesegrater sidestep HA!) I have been working my way through this thread and doing my best to commit these to memory, for use both as a parlour trick and for when I can't be bothered to dig my calculator out in class.

Kewangji: Posdy zwei tosdy osdy oady. Bork bork bork, hoppity syphilis bork.

Eebster the Great: What specifically is moving faster than light in these examples?

doogly: Hands waving furiously.

Eebster the Great: What specifically is moving faster than light in these examples?

doogly: Hands waving furiously.

Please use he/him/his pronouns when referring to me.

### Re: Neat Mental Arithmetic trickses

gmalivuk wrote: It makes me wonder if Stu Savory was also trolling, or if he honestly believes his method has something useful to offer. I like the irony in imagining he complains about how "kids these days" can't recognize multiples while at the same time failing to recognize that his method is less efficient or useful than long division.

I can argue it both ways. On one hand, the technique does vindicate itself for higher primes; it's just 7 where I think it's not worth the effort. On the other hand, he also goes to bat for the "Indian multiplication technique" (which I usually see credited to the Japanese) by showing how awesome it is at multiplying 23 x 41 without bothering to show how awful it is for multiplying 67 x 94. I don't think it's trolling so much, just that some people are so blinded by "mathemagic" or any non-Western algorithm that they think that this is the key to motivation and competence in American schoolchildren.

- gmalivuk
- GNU Terry Pratchett
**Posts:**26821**Joined:**Wed Feb 28, 2007 6:02 pm UTC**Location:**Here and There-
**Contact:**

### Re: Neat Mental Arithmetic trickses

Does it really vindicate itself, though? I can repeatedly subtract a prime from the leftmost digits of a big number until it shrinks to a manageable size without having to figure out or memorize any tricks specific to the particular prime at hand like that site lists.

### Re: Neat Mental Arithmetic trickses

Here's a trick I posted last year in the Digits of Pi thread.

You can easily improve the accuracy of calculations that use 22/7 as an approximation of pi by reducing it by .04%.

pi ~= 3.14159265...

22/7 = 3.14285714...

22/7 * (1 - 4/10000) = 3.1416

So when you need pi * x, first calculate y = x * 22 / 7, then y - y * 4 / 10000 will be a better approximation.

You can easily improve the accuracy of calculations that use 22/7 as an approximation of pi by reducing it by .04%.

pi ~= 3.14159265...

22/7 = 3.14285714...

22/7 * (1 - 4/10000) = 3.1416

So when you need pi * x, first calculate y = x * 22 / 7, then y - y * 4 / 10000 will be a better approximation.

### Re: Neat Mental Arithmetic trickses

Suppose that you want to estimate a division n/d. If you have an approximate reciprocal for d (that is, r is approximately 1/d), then nr is an estimate for n/d, but nr(2-dr) is an even better estimate.

Example: Suppose you're estimating 355/113. You know that 1/113 is approximately 0.009. Then:

355 * 0.009 = 3.195 is an estimate

355 * 0.009 * (2 - 113 * 0.009) = 3.140685 is a better estimate

To put it another way, if n/d is roughly n'/d', then n'/d' * (2 - d/d') is a better estimate. This works especially well if d' is easier to divide by than d.

So, for example, 4096/105 is roughly 4100/100, that is, 41. However 41 * (2 - 105/100) is closer to 39.

Example: Suppose you're estimating 355/113. You know that 1/113 is approximately 0.009. Then:

355 * 0.009 = 3.195 is an estimate

355 * 0.009 * (2 - 113 * 0.009) = 3.140685 is a better estimate

To put it another way, if n/d is roughly n'/d', then n'/d' * (2 - d/d') is a better estimate. This works especially well if d' is easier to divide by than d.

So, for example, 4096/105 is roughly 4100/100, that is, 41. However 41 * (2 - 105/100) is closer to 39.

### Re: Neat Mental Arithmetic trickses

DeGuerre wrote:Suppose that you want to estimate a division n/d. If you have an approximate reciprocal for d (that is, r is approximately 1/d), then nr is an estimate for n/d, but nr(2-dr) is an even better estimate.

I was a little surprised to realise that you can use Newton's method to calculate reciprocals. I don't think I've never used this technique for mental arithmetic, but it can be handy for programming if you need big reciprocals but don't have access to an arbitrary precision library.

For those interested in the derivation:

**Spoiler:**

### Re: Neat Mental Arithmetic trickses

I use a slightly different way of testing divisibility by 7 and 13, based on the fact that 1001 is divisible by both.

Step 1: Promote the last two digits to a multiple of 7 or 13. (7: 22 → 21, 81 → 84; 13: 22 → 26, 81 → 78).

Step 2: Add or subtract the same amount to the thousands digit.

Step 3: Discard the last two digits.

Step 4: See step 1.

567869252041 → 42

5678692530 → 28

56786905 → 07

567889 → 91

5698 → 98

56

567869252041 → 39

5678692500 → 00

56786925 → 26

567879 → 78

5668 → 65

26

Step 1: Promote the last two digits to a multiple of 7 or 13. (7: 22 → 21, 81 → 84; 13: 22 → 26, 81 → 78).

Step 2: Add or subtract the same amount to the thousands digit.

Step 3: Discard the last two digits.

Step 4: See step 1.

567869252041 → 42

5678692530 → 28

56786905 → 07

567889 → 91

5698 → 98

56

567869252041 → 39

5678692500 → 00

56786925 → 26

567879 → 78

5668 → 65

26

- Yakk
- Poster with most posts but no title.
**Posts:**11129**Joined:**Sat Jan 27, 2007 7:27 pm UTC**Location:**E pur si muove

### Re: Neat Mental Arithmetic trickses

91 is the first number that looks prime but isn't, and the only one under 100.

"Instant" prime detector for numbers under 100:

Is it 91? Not prime!

Check divisibility by 2, 3 and 5 (this should be nearly instant -- is it even? Does it end in 5? Add up digits, do they sum to a number divisible by 3?). If so, and it isn't 2 3 or 5 (heh), it is not prime.

Is it a perfect square? Not prime!

Otherwise, prime.

You can extend this to 200 with these 5 prime-looking numbers: 119, 133, 143, 161, 187 -- but I don't bother.

"Instant" prime detector for numbers under 100:

Is it 91? Not prime!

Check divisibility by 2, 3 and 5 (this should be nearly instant -- is it even? Does it end in 5? Add up digits, do they sum to a number divisible by 3?). If so, and it isn't 2 3 or 5 (heh), it is not prime.

Is it a perfect square? Not prime!

Otherwise, prime.

You can extend this to 200 with these 5 prime-looking numbers: 119, 133, 143, 161, 187 -- but I don't bother.

One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

### Re: Neat Mental Arithmetic trickses

Yakk wrote:91 is the first number that looks prime but isn't, and the only one under 100.

"Instant" prime detector for numbers under 100:

Is it 91? Not prime!

Check divisibility by 2, 3 and 5 (this should be nearly instant -- is it even? Does it end in 5? Add up digits, do they sum to a number divisible by 3?). If so, and it isn't 2 3 or 5 (heh), it is not prime.

Is it a perfect square? Not prime!

Otherwise, prime.

You can extend this to 200 with these 5 prime-looking numbers: 119, 133, 143, 161, 187 -- but I don't bother.

By your method 77 is prime. It's not 91, it's not divisible by 2,3 or 5, it's not a perfect square.

### Re: Neat Mental Arithmetic trickses

Having worked with middle/high school students to identify all the primes between up to 100, I feel confident in saying that 91 isn't the first number that looks prime but isn't. (To me, it doesn't look prime at all since it's clearly 70+21, but "looks prime" is a somewhat subjective classification.) Other common trip-ups include 51, 57, and 87.

In my observation, a common failure mode is to start from known multiplication facts, rather than known divisibility rules - most people have something resembling a memorized multiplication table, which only goes out so far (commonly 12x12 or smaller). 3x17 is much smaller than 12x12, but it wouldn't show up in such a table, so they don't recognize 51 as being a multiple of anything.

In my observation, a common failure mode is to start from known multiplication facts, rather than known divisibility rules - most people have something resembling a memorized multiplication table, which only goes out so far (commonly 12x12 or smaller). 3x17 is much smaller than 12x12, but it wouldn't show up in such a table, so they don't recognize 51 as being a multiple of anything.

No, even in theory, you cannot build a rocket more massive than the visible universe.

### Who is online

Users browsing this forum: No registered users and 6 guests