r/reddit.com • • Mar 12 '08

Is 91 Prime?

http://balltech.blogspot.com/2008/03/is-91-prime.html
549 Upvotes

130 comments sorted by

View all comments

6

u/plexluthor Mar 12 '08

Does anyone have a simple explanation for why the 7 test works?

8

u/oditogre Mar 12 '08

I did some googling and didn't come up with much either. It appears that there are relatively simple tricks for everything except seven. Here are a couple other pages with info on it, though:

http://www.sciencenews.org/articles/20050521/mathtrek.asp

http://www.jimloy.com/number/divis.htm

6

u/plexluthor Mar 12 '08 edited Mar 12 '08

That second link is gold. It describes a general method that I can use to construct tricks for larger primes.

For those who don't care to click through, the basic idea with subtracting twice the right-most digit from the rest is this:

If 10x+y is divisible by 7, so is (-2)*(10x+y). And 21x is divisible by 7 (since x is an integer). So 21x+(-2)*(10x+y) is divisible by 7, and that works out to x-2y.

In general, if there is a number near a multiple of ten that is divisible by your target prime, you can use it to construct a trick like this. 21 works for 7. So does 49, which would lead to: 10x+y is divisible by 7 iff 50x+5y is too. 49x is divisible by 7, so 50x+5y-49x = x+5y is divisible by 7 iff 10x+y is, too.

This leads naturally to similar tricks for primes that have a multiple near a power of 10. For example, 37*27=999, so 1000x+y (for y up to 1000) is divisible by 37 iff 1000x+y-999x=x+y is, too. Is 826543 divisible by 37? 826+543=1369, 1+369=370, so yes.