Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**John E. Franklin****Member**- Registered: 2005-08-29
- Posts: 3,588

Here's a trick for modular 8 computation.

483 is what mod 8 ?

(4 x 4) + (8 x 2) + 3

16 + 16 + 3

The 16's cancel out, left with 3.

Here's another one:

61 mod 8 ?

(6 x 2) + 1 = 12 + 1 = 13 and 13 is (1 x 2) + 3 --> 2 + 3 --> 5, so answer is 5.

So you double the tens place and quadruple the hundreds place and probably 8 times the thousands place,

and add them together, then repeat to make smaller for the answer of mod 8.

Let's try 6532 ?

(6 x 8) + (5 x 4) + (3 x 2) + 2 =

48 + 20 + 6 + 2 =

76 =

(2 x 7) + 6 =

20 =

(2 x 2) + 0 =

4

So 6532 mod 8 should be 4.

I just discovered this by trial and error after I made an octagonal diagram, or

actually a British Flag shape, like an X and a Plus sign on top of one another, and

started counting around and around up to 100 plus and examined the numbers.

**igloo** **myrtilles** **fourmis**

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,750

Hi John;

You can simplify it a little.

(6 x 8) + (5 x 4) + (3 x 2) + 2 =

Instead of going 6 * 8 you can use 6 * 0 and anywhere else you see an 8 substitute a 0.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**John E. Franklin****Member**- Registered: 2005-08-29
- Posts: 3,588

Yes, yes, you are right, I was just thinking about that on the couch...

Like any long number for example #0##0##0##0###. And the period at the end there is the decimal place.

Yes it's because 125 x 8 is 1000. Actually it's even better than that because once you get above one-thousand,

all the places to the left of that forever are not need at all, so 00000000000### is all you need to figure the mod 8.

Truly awesome!! Thanks a lot bobbym.

**igloo** **myrtilles** **fourmis**

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,750

Without getting into why this works because of that to get mod 5 of any number. You just have to take the mod of the last digit.

19825638 mod 5 = 3

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**JaneFairfax****Member**- Registered: 2007-02-23
- Posts: 6,868

John E. Franklin wrote:

So you double the tens place and quadruple the hundreds place and probably 8 times the thousands place, and add them together, then repeat to make smaller for the answer of mod 8.

Not necessary, since 1000 is divisible by 8. For any number with four or more digits, you only need to concentrate on the first three digits on the right. Thus 6532 (mod 8) = 532 (mod 8) and 123456789 (mod 8) = 789 (mod 8).

This reason it works is this. Suppose 100*a*+10*b*+*c* is your three-digit number. Doing what you say produces 4*a*+2*b*+*c*. The difference between this and your three-digit number is 96*a*+8*b* = 8(12*a*+*b*), which is divisible by 8; hence the two numbers are equal mod 8.

*Last edited by JaneFairfax (2010-12-13 07:51:20)*

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,750

Hi John;

Are you familiar with horners method? I remember being faced with the problem of programming a mod function that took a single or double precision number mod of numbers with millions of digits.

It was for a math package we were writing, still less than half done. It is not that important just that I cannot remember any bit of how I did it! I just remember I used horners method on the numbers and that the routine was fast.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**John E. Franklin****Member**- Registered: 2005-08-29
- Posts: 3,588

Wow, thanks Jane, that's incredible. 100a + 10b - 4a - 2b is then divisible by 8, hence cancels!!!

And bobbm, I'll look it up...

**igloo** **myrtilles** **fourmis**

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 107,750

Hi John;

Do not worry about it right now. See if you can apply what Jane showed you to some other mods like 5 for instance.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

Pages: **1**