Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Re: 0 illegal modulus?

by nella (Novice)
on Jun 13, 2001 at 03:58 UTC ( #87968=note: print w/replies, xml ) Need Help??

in reply to Re: 0 illegal modulus?
in thread 0 illegal modulus?

Let me explain further:

You have the integers:

1 2 3 4 5 6 7 9 10 11 ...

If you consider these numbers mod 4, for example, the integers become:

1 2 3 0 1 2 3 0 1 2 3 ... (*)

So you can think of mod as a function (mapping) that takes all multiples of 4 to 0; 4*x mod 4 = 0 for all integers x. Now, the period of repitition in line (*) is obviously 4. (Since the multiples of 4 are all 4 integers apart, and only these are mapped to 0, the period must be 4.) It is similarly true in general that the period of repition is equal to the modulus. (Side note: this is true in the other degenerate case, mod 1. x mod 1 = 0 for every integer x.) What does a period of 0 mean, then, but that there is no repitition. A modulus of 0 does make sense; just as before, it means map multiples of the modulus to 0. The only multiple of 0 is 0, and so only 0 is mapped to 0. As there is no repitition, x mod 0 must be x.

I hope this is clearer.

Replies are listed 'Best First'.
Re: Re: Re: 0 illegal modulus?
by mugwumpjism (Hermit) on Jun 13, 2001 at 14:44 UTC

    I suppose that could be one flawed way to look at it. But that's got nothing to do with the common definition of the term, the etymological roots of the word "modulus", or what happens when you run this C program:

    #include <stdio.h> int main() { int a,b,c; a=4; b=0; c=a % b; printf ("%d mod %d = %d\n", a,b,c); } $ gcc test.c -o test $ ./test Floating point exception $

    The flaw in your statement is the comment "What does a period of 0 mean, then, but that there is no repitition." I'm sorry, but even if it means that a commonly used integer operation can be used in such a way to produce a divide by zero error, zero times any number is still zero and hence zero cannot be used as a base for a modulus.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87968]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2018-03-17 22:44 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (227 votes). Check out past polls.