• user warning: Unknown column 'captcha_type' in 'field list' query: SELECT module, captcha_type FROM captcha_points WHERE form_id = 'search_theme_form' in /home/unitorga/public_html/coding/sites/all/modules/captcha/captcha.inc on line 60.
  • user warning: Unknown column 'captcha_type' in 'field list' query: SELECT module, captcha_type FROM captcha_points WHERE form_id = 'search_block_form' in /home/unitorga/public_html/coding/sites/all/modules/captcha/captcha.inc on line 60.

Modulo Arithmetic

One problem I've noticed with calculators in general is that they don't do Modulo arithmetic. This is normally not needed by the typical person, but comes in handy for solving some interesting number theory problems.

So I quickly (like 5 minutes) created this modulo calculator below.

View it here.

Comments

This

This is pretty much useless, it doesn't work.

Well that's a pretty useful

Well that's a pretty useful piece of feedback. I can definitely use the information you have provided to improve my script. I have no idea why you are 'pissed' though since it's a free script. Not able to do your homework assignment?

Maybe you could provide the following to be useful.

  • Your internet browser
  • Your operating system
  • The numbers you entered into the calculator

[none]

I'm sorry the only other comment here is from a jerk.
Your app is really useful-- but is it handling negative numbers correctly? -5 should be equal to 7 mod 12, right?

Good job otherwise.

Yeah you are right, -5

Yeah you are right, -5 should be equal to 7 mod 12. If my script isn't working it's because the % modulo JavaScript operator is returning the wrong value.

Since this is one of my most popular pages, I should probably fix that bug (which should be pretty simple to do).

Dave

This should be fixed now,

This should be fixed now, negative values should work. Interesting that JavaScript's implementation of Modulo is actually incorrect for most negative cases.

just one minor question, if

just one minor question, if I want to calculate a large number to a large power, mod to a large number, without doing it by hand... it seems like the app doesn't have that feature...
im actually working on a problem, which is 141^128 mod1000, trying to figure out what that is....

Yeah I remember doing stuff

Yeah I remember doing stuff like that when I was learning number theory in university. You want to follow the instructions here to do this type of calculation.

http://en.wikipedia.org/wiki/Modular_exponentiation#Memory-efficient_method

Links

Twitter Follow me on Twitter

Subscribe Subcribe to my blog