Conway’s 150 Method for Mental Factorization

Benjamin asked me to do some factorization exercises.

I am not an expert in this field; I mainly use brute force, with some small tricks like the 1,001 method.

While researching mental factorization, I came across John Conway’s 150 method.
Using this technique, one can check a number for all prime factors under 40 with just one clever process.

Normally, when testing for primes, we do a modulo test for each divisor separately.
If it fails, we throw it away and start over for the next prime.

Conway’s idea eliminates that repetition:
You can reuse your previous work as you test several primes in one pass.

It’s surprisingly fast for 3- and 4-digit numbers — perfect for mental math.


Conway’s method of checking for primes below 40 is written down by Arthur Benjamin here:


:1234: The core idea

The trick is that the numbers 150\space -\space 156 collectively include almost all small primes:

150 = 2 \times 3 \times 5 \times 5
151 = \text{(prime, so skip)}
152 = 8 \times 19
153 = 9 \times 17
154 = 2 \times 7 \times 11
155 = 5 \times 31
156 = 12 \times 13

Since these consecutive numbers cover 2, 3, 5, 7, 11, 13, 17, 19,\space and \space 31, we checked all primes under 32, except 23 and 29.


:puzzle_piece: Example 1: N = 931

The largest multiple of 150 below 931 is 150 \times 6 = 900.
Subtract it: A = 931 - 900 = 31.

Now count down by 6 (because K = 6):
31,\space 25,\space 19,\space 13,\space 7,\space 1,\space -5

Each step corresponds to 150 \space – \space 156 and the primes associated with it:

150, check for: 2, 3, 5
151, (prime; skip)
152, check for: 19
153, check for: 17
154, check for: 7, 11
155, check for: 31
156, check for: 13

Let’s do each step:

1: starting with 31. We check this for divisors 2,\space 3,\space \&\space 5. We find none.
2: Subtract 6 from 31 to get 25. We skip this, because 151 is prime.
3: Subtract 6 from 25 to get 19. We check this for divisor 19. We find that 19 is a divisor of 19.
4: Subtract 6 from 19 to get 13. We check this for divisor 17. We find none.
5: Subtract 6 from 13 to get 7. We check this for divisors 7 & 11. We find that 7 is a divisor of 7.
6: Subtract 6 from 7 to get 1. We check this for divisor 31. We find none.
7: Subtract 6 from 1 to get -5. We check this for divisor 13. We find none.

We now know that 7 and 19 are factors of 931.


:puzzle_piece: Example 2: N = 689

Nearest lower multiple of 150: 150 \times 4 = 600.
Subtract: A = 689 - 600 = 89.

Now count down by 4:
89, 85, 81, 77, 73, 69, 65

At 65, we hit a multiple of 13 and indeed 689 \div 13 = 53.


:light_bulb: Why it works

If N is your number and K the multiplier of 150 just below it, you are effectively checking:

N - 150K,
N - 150K - K
N - 150K - K - K
N - 150K - K - K - K
N - 150K - K - K - K - K
N - 150K - K - K - K - K - K
N - 150K - K - K - K - K - K - K

This is the same as:

N - 150K
N - 151K
N - 152K
N - 153K
N - 154K
N - 155K
N - 156K

Since divisibility doesn’t change when you add or subtract a multiple of a divisor, any “hit” in this sequence reveals a real factor of N.

3 Likes

Interesting way.

I would have gone with harder way if didn’t read it.

If we take same example like 931.

2 (nah, last digit odd)

3 (9+3+1 = 13, not either)

5 (last digit not 5 or 0)

7 (93-2×1 = 91, yes this is it) ✓

11 (9-3+1 = 7, not either)

13 (93-9×1 = 84, not either)

17 (93-5×1 = 88, not this either)

19 (tricky since here we have to add unlike the above where we subtract, 93+2×1 = 95 , yes this is it) ✓

931 = 7×19 (divide 931 by 7 = 133 , and after that it’s pretty obvious

So 7 × 7 × 19.

One alternative way, can be by improving our factual information. knowing more obvious results like 29 × 9 = 261, squares like 961 (31×31), 18 × 16 (17²-1), and so on

1 Like

Super cool!

I found this blogpost about it (it links to the same PDF you shared):

It also mentions extensions a 2000 and a 1000 method and links to another PDF with a whole bag of tricks to cover all 6 digits numbers.

1 Like

:abacus: Conway’s adaptation for checking factors 23 and 29

In the previous post, we checked for all primes below 32, except 23 and 29.
Now, I’ll show you how to adapt this system to also include 23 and 29.

Let’s show its power with an example.

:puzzle_piece: Example 1: N = 667

We start with the 150 system.
Nearest lower multiple of 150: 150 \times 4 = 600.
Subtract: A = 667 - 600 = 67.

Now count down by 4:
67,\space 63,\space 59,\space 55,\space 51,\space 47,\space 43

We check 67 for factors of 2,\space 3,\space and \space 5.
We skip 63.
We check 59 for a factor of 19.
We check 55 for a factor of 17.
We check 51 for factors 7 and 11.
We check 47 for a factor of 31.
We check 43 for a factor of 13.

We find none.

As I said earlier, we have now checked for all primes under 32, except for 23 and 29.

Let’s do them now. We go back to our starting point of 67 and add half of 4, so 2:
67 + 2 = 69
We check 69 for a the factor of 23 and indeed find it (69\space =\space 23 \times 3)!

We take 67 and add 10 times 2 or 20:
67 + 20 = 87.
We check this for the factor of 29 and find it (87\space =\space 29\times 3)!

667 = 23*29.


:light_bulb: Why it works

Close to 300 we find 2 numbers that are multiples of 23 and 29:
290\space = 29 \times 10
299\space = 23 \times 13

Recall: we started with taking multiples of 150 off:
N - 150K

Now we are taking multiples of 300 off:
N - 300k

It is easy to transition from N - 150K to N - 300k:
Just take K = 2k, which translates to: k = {\dfrac{K}{2}}
This is why in the example we went from K=4 to k=2.

67 = 667 - 4\times 150 => K = 4
67 = 667 - 2\times 300 => k = 2

By adding k to check for 23 we do:
N - 300k + k
or:
N - 299k

And by adding 10 \times k we get:
N - 300k + 10k
or:
N - 290k

Since divisibility doesn’t change when you add or subtract a multiple of a divisor, any “hit” in this sequence reveals a real factor of N.

:puzzle_piece: Example 2: N = 920

For brevity, I’ll skip the 150 system and start with the 300 system.
So we now only check for 23 and 29.

Nearest lower multiple of 300:
300 \times 3 = 900.
(k=3)
Subtract: A = 920 - 900 = 20.

Add k:
20+3 = 23.
23 is obviously a factor 23.

Add 10 times k:
20 + 10 \times 3 = 50
50 is obviously not a factor 29.

So 23 is a factor of 920.

Btw, if we did the 150 system first, we would find 2 and 5 as factors.
We would start with 20 and check this against 2,\space 3,\space and\space 5.
2 is a factor of 20, 3 is not, and 5 is too.

Indeed: 920 = 2^3×5×23.

1 Like

The problem I have with these texts (both Benjamins and Cooks) is that for beginners in mental calculation the text is quite complex.

As you know, I always like to give lots of examples on how this works and how to apply these techniques. So, even if you don’t understand why it works, you can still apply the techniques.

At least; that is how I look at it.

1 Like

Working Smarter, Not Faster

I was asked to factor 82,450.

My Rule #1: always start with the low-hanging fruit.

Why? Because the sooner you make the number smaller, the easier every next step becomes.


Low Hanging Fruit

In 82,450, it’s obvious that 50 is a factor, so start there:

82{,}450 / 50 = 1{,}649

Now we’ll test 1,649 for smaller primes one by one.


Check for Small Primes

7:
1,649 − 1,400 = 249
249 − 210 = 39
→ 35 is a multiple of 7, 39 is not → no factor

11:
1,649 − 1,100 = 549
550 would have been a multiple of 11 → no factor

13:
1,649 − 1,300 = 349
390 is a multiple of 13. Let’s add stepwise from 349:
349, 362, 375, 388 → 2 away from 390 → no factor
(Alternatively, 390 − 349 = 41, and 39 is a multiple of 13, not 41.)

17:
1,649 = 1,700 − 51
51 = 3×17factor found!
1{,}649 / 17 = 97
And 97 is prime. :white_check_mark:

In checking for factor of 17 here, I used a small trick.
When checking divisibility, we only care whether the modulo is zero.
So you can safely ignore negative signs — it makes no difference.

1{,}649 - 1{,}700 = -51
Since we only care whether the remainder is 0, -51 or +51 doesn’t matter.
So feel free to flip the subtraction or drop the minus if it helps keep numbers small.


We started with 50 = 2 × 5^2.
Now we know:
82{,}450 = 2 × 5^2 × 17 × 97


Conway’s 150 Method (Quick Example)

Let’s revisit 1,649 with Conway’s “150” pattern:

Step Operation Note
1 1,649 − 1,500 = 149 K = 10
2 149 (150)
3 139 (151)
4 129 → Check for 19 → not a factor (152)
5 119 → Check for 17119 = 17×7 :white_check_mark: (153)

So again, 17 pops up as a factor.


My 97 Trick

Suppose you suspect that 97 might be a factor.
Here’s a simple mental-math test.

Since 100 \bmod 97 = 3,
you can “rip off” two digits at a time, just like Art Benjamin rips off one-digit at a time.

Let:
A = 100a + b
Then:
A \bmod 97 \equiv 3a + b


Example: Testing 1,649 for a Factor of 97

Here a = 16, b = 49:

3a + b = 3×16 + 49 = 97

Because the result (97) is divisible by 97,
the original number 1,649 is too. :white_check_mark:

1 Like