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

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

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.

]]>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.

19825638 mod 5 = 3

]]>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.]]>

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.

]]>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.