The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Fun math algorithms
09-05-2020, 10:31 PM
Post: #1
Fun math algorithms
Here are a few fun math tricks that I collected and still remember over the years. I'm curious what non-calculator math routines any of you may have learned (with or without explanation). I remember one more (computing square roots by hand which I did not learn until after grad school) which I will post if someone doesn't already do so after a few days.

Dividing by 9

Suppose we wish to compute 3461 / 9 by hand, without a calculator. The first digit of the answer is the first digit of the numerator: 3. The next digit in the answer comes from taking the previous digit, namely 3, and adding the next digit in the numerator modulo 9: \( 3+4 \pmod 9 \equiv 7 \pmod 9\). If the sum was greater than 9, add 1 to the previous digit. Since 7 is clearly less than 9, we do not add 1 to the preceding digit 3, and our partial answer is 37. Repeat the process of taking the current digit and adding the next digit in the numerator. So \( 7+6 \pmod 9 \equiv 13 \pmod 9 \equiv 4 \pmod 9\). Now the adjusted partial answer is 384 -- note that the second digit was previously 7, but since the third digit sum was 13 (greater than 9), we adjust the preceding digit by 1. Once we reach the one's digit in the numerator (in this case 1), the remainder would be 4+1 (4 from the previous digit and 1 from the next digit in the numerator). (If this sum were larger than 9, we would again increment the preceding digit by 1.) So the result is 384 with a remainder of 5.

To see how it works, it is best to study the following expansion by 10 and 9:
\[
\begin{align}
3461 & = 3\cdot 10^2 \cdot 10 + 4 \cdot 10 \cdot 10 + 6 \cdot 10 + 1 \\
& = 3\cdot 10^2 \cdot (9+1) + 4\cdot 10 \cdot 10 + 6\cdot 10 + 1 \\
& = 3\cdot 10^2 \cdot 9 + 3\cdot 10^2 + 4\cdot 10 \cdot 10 + 6\cdot 10 + 1\\
& = 3\cdot 10^2 \cdot 9 + (3+4)\cdot 10\cdot 10 + 6\cdot 10 + 1\\
& = 3\cdot 10^2 \cdot 9 + (3+4) \cdot 10 \cdot (9+1) + 6\cdot 10 + 1\\
& = 3\cdot 10^2 \cdot 9 + (3+4) \cdot 10 \cdot 9 + 7\cdot 10 + 6\cdot 10 + 1\\
& = 3 \cdot 10^2 \cdot 9 + (3+4)\cdot 10 \cdot 9 + (7+6)\cdot 10 + 1\\
& = 3\cdot 10^2 \cdot 9 + (3+4) \cdot 10 \cdot 9 + (9 + 4)\cdot 10 + 1\\
& = 3\cdot 10^2 \cdot 9 + (3+4) \cdot 10 \cdot 9 + 9\cdot 10 + 4\cdot 10 + 1\\
& = 3\cdot 10^2 \cdot 9 + (3+4+1) \cdot 10 \cdot 9 + 4\cdot 10 + 1\\
& = 3\cdot 10^2 \cdot 9 + (3+4+1) \cdot 10 \cdot 9 + 4\cdot (9+1) + 1\\
& = 3\cdot 10^2 \cdot 9 + (3+4+1) \cdot 10 \cdot 9 + 4\cdot 9 + (4 + 1)\\
\end{align}
\]
So
\[ \frac{3461}{9} = \frac{3\cdot 10^2 \cdot 9 + (3+4+1) \cdot 10 \cdot 9 + 4\cdot 9 + (4 + 1)}{9} =
3\cdot 10^2 + (3+4+1) \cdot 10 + 4+ \frac{4 + 1}{9}
\]

Squaring a number ending in 5:

Take the number formed by removing the final digit 5, multiply by 1 more than that number, and append 25 to the product. For example, \(6^2 = 4225\) where the first two digits 42 are obtained by \( 6\cdot (6+1) = 42\).

Explanation: write any number \(a\) ending in 5 as \( x5\). Then
\[ \begin{align}
a^2 & = (10\cdot x + 5)^2 \\
& = 100x^2 + 2\cdot 5 \cdot 10 \cdot x + 5^2\\
& = 100 (x^2+x) +25^2\\
& = 100\cdot x \cdot (x+1) + 25
\end{align} \]

Divisibility tests (I'll show divisibility by 11; you are welcome to try variations of this for other small divisors)

To test if a number n is divisible by 11, take alternating sums of the digits. If the sum is equivalent to 0 modulo 11, then the original number is divisible by 11. For example, consider 1254. Since \( -1 + 2 - 5 + 4 \pmod 11 \equiv 0 \pmod 11 \), the number 1254 is divisible by 11.

Note that \( 10^n \pmod{11} \equiv (-1)^n \pmod{11} \). Thus a number with digits \( d_9d_8d_7\cdots d_1 d_0 \) can be written as
\[ \begin{align}
d_9 \cdot 10^9 + d_8 \cdot 10^8 + \dotsm + d_1\cdot 10 + d_0 \pmod{11} & \equiv
d_9 \cdot (-1)^9 + d_8 \cdot (-1)^8 + \dotsm + d_1 \cdot (-1) + d_1 \pmod{11}\\
& \equiv -d_9 + d_8 - d_7 + \cdots + d_2 - d_1 + d_0 \pmod{11}
\end{align}
\]
This type of computation reminded me of a problem from a 7th grade mathematics competition where one had to determine whether a number (with many digits) written in base 13 was divisible by 12. Not only were calculators not allowed, but it was infeasible to expand the number into base 10 and then divide by 12 with the allotted time.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Fun math algorithms - Han - 09-05-2020 10:31 PM
RE: Fun math algorithms - telemachos - 09-06-2020, 12:30 AM
RE: Fun math algorithms - Albert Chan - 09-06-2020, 12:46 AM
RE: Fun math algorithms - Han - 09-06-2020, 03:54 AM
RE: Fun math algorithms - Albert Chan - 09-08-2020, 09:59 PM
RE: Fun math algorithms - David Hayden - 09-10-2020, 03:59 PM
RE: Fun math algorithms - Albert Chan - 10-16-2020, 04:02 PM
RE: Fun math algorithms - EdS2 - 10-17-2020, 08:51 AM
RE: Fun math algorithms - Albert Chan - 10-17-2020, 11:27 AM
RE: Fun math algorithms - Albert Chan - 10-17-2020, 12:32 PM
RE: Fun math algorithms - EdS2 - 10-19-2020, 07:59 AM
RE: Fun math algorithms - Albert Chan - 10-19-2020, 08:51 PM
RE: Fun math algorithms - Albert Chan - 10-19-2020, 09:33 PM
RE: Fun math algorithms - Albert Chan - 10-19-2020, 11:05 PM



User(s) browsing this thread: 6 Guest(s)