Jump to content

My calculator has no mod button.


the tree

Recommended Posts

I don't think I've ever seen a calculator with a built in mod button. I assume you're interested in finding the least non-negative integer congruent to x mod n say.

 

If you want to find x mod n you can first take the floor(x/n) (just drop the digits decimal of x/n). Then find x-n*floor(x/n).

 

e.g. 34 mod 5, your calculator gives 34/5=6.8. Floor(6.8)=6. 34-5*6=4

 

You can also do n*frac(x/n), where frac is the decimal part. e.g. frac(6.8)=.8, but depending on how your calculator stores the decimal this could cause problems from rounding errors.

Link to comment
Share on other sites

It should not be necessary. However, if you are doing many calculations involving large numbers than mechanical means can be handy to save time.

 

I would say if the division algorithm isn't an utterly trivial thing then it should be done by hand until it is before turning to a calculator for help.

 

In retrospect though I do regret posting a way of doing it with a calculator. I should have demanded the tree come up with one on his own- it's really not difficult with even a basic understanding of mod. I was feeling lazy I suppose.

Link to comment
Share on other sites

I think this highlights almost exactly one of the first things I try to get across to the students I had at university: you are going to go backwards in terms of arithmetic.

 

You start at school with long divisiond and remainders, then you learn about fractions, then you do decimals. Call this the 'peak' at age 13 when you use calcultors for everything. I've even seen books aimed at A-level students which write things like sqrt(2)=1.4 (come on people!). Anyway, you start then to regress when you are told that it is better to have fractions and symbols (i.e. pi not 3.1415....) in your answers, and then you get to university and you're doing remainder arithmetic again. I don't understand why students find modulo arithmetic so hard given that it is the first thing they learned to do with numbers beyond adding and 'times tables'.

 

Oh, and one thing that always seems to escape students attention is when asked to work out 2^31+1 mod 7, say, that they actually work out what 2^31+1 is first as an integer and then reduce it, when you can by inspection see that the answer is 3.

Link to comment
Share on other sites

I don't understand why students find modulo arithmetic so hard given that it is the first thing they learned to do with numbers beyond adding and 'times tables'.
Because they haven't done it for ages? And I never did learn my times tables.

 

Oh, and one thing that always seems to escape students attention is when asked to work out 231+1 mod 7, say, that they actually work out what 231[/sup']+1 is first as an integer and then reduce it, when you can by inspection see that the answer is 3.
O.k. considering I was only introduced to modulos yesterday, could you show how?
Link to comment
Share on other sites

I don't understand why students find modulo arithmetic so hard given that it is the first thing they learned to do with numbers beyond adding and 'times tables'.

 

In addition to not being able to do the arithmetic, they don't like equivalence relations. This is also suprising since they've been implicitly using equivalence relations on the rational numbers since I don't know how early.

 

 

@the tree- If you've just been introduced to modular arithemtic then I would suggest doing everything by hand until it's mind numbingly easy. It is grade school stuff like matt has said, so this shouldn't take long to come back.

 

2^31+1 mod 7... you'll learn Fermat's Little Theorem (and Euler's) later and it will be perhaps more obvious. That's overkill for numbers this small though. What is 2^3 mod 7 and how does this help find 2^31?

Link to comment
Share on other sites

The point about modulo arithmetic that is seemingly never emphasised is that you can reduce mod whatever at any time you want if it helps, you don't have to just do it at the very end. So 2^31 is 2*(2^3)^10 = 2*1^10=2 (mod 3).

 

(Yes, knowing other important results like Fermat's little theorem help, but is no replacement for just looking at the problem and thinking for a second.)

 

 

I also don't buy the reason that because they've not done it for ages that it is hard. Not least because they will have done long division of polynomials for partial fraction reasons very recently. And you'll almost certainly have just seen Euclid's algorithm which is just long division too: like all the really good ideas it is actually very simple. There are many proofs of things that I've seen that I've thought truly simple whilst simultaneously knowing I'd've never thought of it.

Link to comment
Share on other sites

(Yes, knowing other important results like Fermat's little theorem help, but is no replacement for just looking at the problem and thinking for a second.)

 

Absolutely. This sort of reduction is a good lead in to uses of Fermat/Euler though.

 

I also don't buy the reason that because they've not done it for ages that it is hard. Not least because they will have done long division of polynomials for partial fraction reasons very recently.

 

Alas, they probably weren't capable of dividing polynomials either. I honestly don't know what they make them do in high school anymore.

 

And you'll almost certainly have just seen Euclid's algorithm which is just long division too: like all the really good ideas it is actually very simple. There are many proofs of things that I've seen that I've thought truly simple whilst simultaneously knowing I'd've never thought of it.

 

When I first learned about the Euclidean algorithm to write the gcd as a linear combination I remember thinking how bloody cool division was and wondering why this wasn't taught in grade school. It's such a simple idea, yet so very clever.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.