Jump to content
Science Forums

Recommended Posts

Posted

I have a final coming up in CSIS (Problem solving). Its a programming course but network engineers have to take it for some reason as well. They talk about different ways to find problems and we use psudo code and flow charts. Anyways there are two different types of math, one is call modulo division and Integer division. I suck at math and on every test we've had I got these problems wrong. Is there a way to do this with my calculator? I have a graphing calcuator, a TI-84 Plus, and I haven't been able to find a program for it or an easier way to do modulo and integer division.

Posted

Modulo operation - Wikipedia, the free encyclopedia

 

The only time I have come across modulo division is in cryptography. Integer division is normal math, whereas modulo division is only concerned with the remainder. So, 7 divided by 3 is two and one third in integer division, and 7 mod 3 is 1.

 

Is this what you are referring to?

 

If so, in order to solve a modulo problem with a calculator-

 

a mod b

 

1) Perform the operation normally, where a/b equals a whole number followed by a decimal. If there is no decimal than the answer is 0.

 

2) Multiply the whole number in the answer from step one by b, and subtract this figure from a, this is the remainder of the operation, and the answer to the modulo operation.

 

 

So A divided by B equals XXX.YYYYYYYY

 

A mod B equals A minus (B times XXX)

 

ETA: It appears that in programming, the result is not always positive. I think my explanation may be too simplistic for your needs, you may need to wait for someone else to more accurately answer your question, or read the wiki page I posted above.

Posted
Anyways there are two different types of math, one is call modulo division and Integer division.

The operations are “modulo” (just modulo, not “modular division”) and “integer division”. Common symbols used for them are “\” for integer division, and “%” for modulo.

Is there a way to do this with my calculator?

You can easily do modular division on nearly any calculator.

 

To perform the integer division a\b: 1) divide a by b; 2) if the result is an integer (whole number), stop – that is the result; 3) otherwise, the next lower integer is the result. The operation described in steps 2 and 3 above are known as “floor”, the common symbol for which is [imath]\rfloor[/imath]. On most scientific calculators, the floor function is a key labeled “int”.

 

For example to calculate 1234\56 on a typical calculator, enter

1 2 3 4 ÷ 5 6 =

which should display

22.035714

or similar. This isn’t a whole number, so reduce it until it is, for a result of

22

 

To calculate 1234%56, first calculate 1234\56, then multiply it by the divisor, 56, then subtract this from the dividend, 1234. Enter

2 2 × 5 6 =

which should display

1232

Subtract this from 1234, giving a result of

2.

 

Your calculator may have a integer division and modulo key, but you should know how to perform these operations on any calculator, or with paper and pencil. The modulo function is key to a valuable kind of arithmetic known as modular arithmetic, with which any computing-literate person should be intuitively and intimately familiar.

Posted
Anyways there are two different types of math, one is call modulo division and Integer division. I suck at math and on every test we've had I got these problems wrong. Is there a way to do this with my calculator?
Back in the stone age, school required us an ability to do both things simultaneously and... without a calculator!!!!! Only thing, the result of "modulo division" was called the remainder.

 

Oh the memories of auld lang syne! The comforting aroma in Great Granny's country croft kitchen, the sheep grazing the heather on the braes, the fresh strong North Sea wind splashing waves against the voe's banks...:)

 

We'll tak a cup o' kindness yet......

Posted
The only time I have come across modulo division is in cryptography.

 

I messed around with modulo division for a while after reading Bruce Schneiers "Applied Cryptography". I can't see what a network engineer would use modulo division for, but at least it is another concept to add to your mental toolbox.

Posted
I messed around with modulo division for a while after reading Bruce Schneiers "Applied Cryptography". I can't see what a network engineer would use modulo division for, but at least it is another concept to add to your mental toolbox.

 

a network engineer may need to proportionally divide and allocate network resources. :)

 

StateMaster - Encyclopedia: Modular arithmetic

...More generally, modular arithmetic also has application in disciplines such as law (see e.g., apportionment), economics, (see e.g., game theory) and other areas of the social sciences, where proportional division and allocation of resources plays a central part of the analysis. ...
Posted
a network engineer may need to proportionally divide and allocate network resources. :)

 

StateMaster - Encyclopedia: Modular arithmetic

 

I guess that makes sense. I'm not a network engineer, I just write the code to use the network. :)

 

@C1ay:

 

I didn't see any modulo division being used in the provess of calculating subnet address allocations and netmasks. Yet I assume that you linked to that page for some reason. :eek:

Posted
Decimal to Octal conversion

Method of successive division by 8

 

To convert integer decimals to octal, divide the original number by the largest possible power of 8 and successively divide the remainders by successively smaller powers of 8 until the power is 1. The octal representation is formed by the quotients, written in the order generated by the algorithm.

 

Octal - Wikipedia, the free encyclopedia

 

Code converting decimal to octal would naturally use a mod function.

 

~modest

Posted
I didn't see any modulo division being used in the provess of calculating subnet address allocations and netmasks. Yet I assume that you linked to that page for some reason. :hihi:

 

It doesn't show any but it does show how network engineers will sometimes use dotted decimal notation. The modulo function is handy in the conversion. There's an example of the integer and modulo math used in calculating subnets here.

Posted
Back in the stone age, school required us an ability to do both things simultaneously and... without a calculator!!!!! Only thing, the result of "modulo division" was called the remainder.

Oh, I vaguely remember something called a remainder! I think they stopped caring about us putting it in our answers around 6th grade. :-)

 

Thanks for everybody's help, math is just one of those things I just cant seem to wrap my head around unless I am using formula's, then it gets easier.

Posted
I think they stopped caring about us putting it in our answers around 6th grade. :-)
:) So the stone age hasn't ended after all! There is still hope!

 

Even before 6th grade they maybe had you continuing into the fractional part. :cheer: I hope it's maybe easier to think of it as "just the remainder" instead of something complicated.

 

xxxxxxxx

xxxxxxxx

xxxxxxxx

xxxxxxxx

xxxxxxxx

xxxxxxxx

xxxxx

Ooops! Six equal parts but 5 get left over, gotta draw straws to settle the matter...:(

Posted

Another use of modulo arithmetic is adding information to a 'sliding window'. Let's say that you want to store the last m items. You drop the information into slot[i%m], where % is the modulus operator. Here i simply increments from 0, 1, ... and so forth. Makes it easier to determine order if i and say j are normal indices, but access to their place in the circular list are handled by modulo arithmetic.

Posted

As this thread has shifted from its original “how to” to the “what is it good for” question, I’ll throw out one.

 

The modulo (remainder) / integer division function is key to most pseudorandom number generators. A simple example:

 

Let’s say we want to generate random-like numbers from 0 to 99999999.

 

Assign a number M = 99999999 + 1 = 100000000

Chose an “irregular” number P greater than M – let’s use 827347231

Chose another irregular number S less than M – let’s use 27347231

Chose a “seed” number A between 0 and 99999999 – let’s pick 46294630

 

To generate random-like numbers, reassign and output A = ((A+S)*P)%M

 

For example, the first number is ((46294630+27347231)*827347231)%100000000

 

The first few numbers using the above selections are: 84036891, 14066182, 71809403, 75180454, 85590235, 71256646, 1814587, 73225958, 31989659, 37651590

 

This is a pretty crude scheme, as when, as it must, a number repeats, the entire sequence following it will repeat. There is an obvious way to avoid this with no change to the core generator formula, left as an exercise for the reader. :hihi:

Posted

This is a reasonable way to generate pseudorandom numbers in situations where computations of PRNs has to be efficient. One of the problems with this method is the lack of long term uniformity of the numbers generated, i.e. some ranges occur more often that others. Then again something like the Mersenne twister chews up more CPU cycles generating PRNs.

Posted
Another use of modulo arithmetic is adding information to a 'sliding window'. Let's say that you want to store the last m items. You drop the information into slot[i%m], where % is the modulus operator. Here i simply increments from 0, 1, ... and so forth. Makes it easier to determine order if i and say j are normal indices, but access to their place in the circular list are handled by modulo arithmetic.
Actually, given that presumably this is handled by incrementing the unique variable for i in chronological order, it is enough to keep a variable for the remainder and increment it with a conditioned reset to zero. This is very simple and it avoids the greater CPU time of the division algorithm.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...