# Can i do modulus on a TI-83? How can i compute a negative modulus?

1. Jan 11, 2012

### kirkulator

I am studying Integer Modulo in my Cryptography and Data Security class. We are dealing with mainly modulo 26 [the alphabet] right now. I understand if it is addition or multiplication you just take the remainder of the result divided by, lets say 26 in this circumstance.

ie: (5+25)mod26 = 4
ie: (5*6)mod26 = 4

But i'm not quite understanding how to do mod26 when there results a negative number.
ie: the shift cipher is (x-k)mod26
which usually results in a negative because k is usually > x
so say, if i had -7mod26

Also is there any way to calculate this sort of problem on my calculator to check my work? I have a TI-83.

Thanks so much guys.
Amanda

2. Jan 11, 2012

### razmtaz

Not sure if this is what you mean, but hopefully this is helpful:

you can reduce any number by the modulus. If you had 123 mod 26, this is congruent to 97 which is congruent to 71 congruent to 45 congruent to 19 congruent to -7 and so on. If you want the smallest positive value, its 19 in this case.

Basically, if you have a negative value, simply add a multiple of the modulus to it until you get the smallest positive value that is less than the modulus itself.

Not sure about your calculator in particular though (so im sorry if you already knew this and it is thus irrelevant)

3. Jan 11, 2012

### kirkulator

Just to clarify, youre saying -7mod8 would be 1? [-7+8] = 1 < 8, the answer is one?
and -21mod8 would be 3 because [-21 + 24] = 3 < 8?

Thanks so much this really did help a LOT. I dont think theres a way to do mod on the calculator everywhere i look says you must program it yourself.

4. Jan 11, 2012

### micromass

Staff Emeritus
That's correct!!

5. Jan 11, 2012

### kirkulator

Wow, thats extremely simple and a lot more clear than how my prof explained it. You wouldn't have an equivalently elegant way of explaining modular division [reciprocals] would you? The only way he told us how to do, say 5(-1)mod26 {where 5(-1) is representing the reciprocal of 5), is to use the euclidean algorithm, in which he didnt explain well either. If this is too exhaustive to explain, then dont worry about it! I've been trying to find some good explanations online.

6. Jan 11, 2012

### jhae2.718

For a Ti-83, the best you are going to get is
Code (Text):

x fPart(y/x)

for $y \!\mod x$

7. Jan 11, 2012

### kirkulator

great, ill take note of that function of my calculator.