Talk:Modular arithmetic: Difference between revisions
Content added Content deleted
m (Mark who did the contribution) |
m (Improve markup of quoted text) |
||
Line 1: | Line 1: | ||
The task description begins with: |
The task description begins with: |
||
<blockquote>''“<small> The purpose of this task is to show, if your programming language allows it, how to redefine operators so that they can be used transparently on modular integers. You can do it either by using a dedicated library, or by implementing your own class. </small>”''</blockquote> |
|||
<pre> |
|||
The purpose of this task is to show, if your programming language allows it, |
|||
how to redefine operators so that they can be used transparently on modular |
|||
integers. You can do it either by using a dedicated library, or by implementing your own class. |
|||
</pre> |
|||
This is a nice interesting task description - although it would be much more interesting |
This is a nice interesting task description - although it would be much more interesting |
||
if one can't use a library. The interesting part in my view is how to redefine |
if one can't use a library. The interesting part in my view is how to redefine |
||
Line 10: | Line 6: | ||
The task description ends with: |
The task description ends with: |
||
<blockquote>''“<small> It is important that the function f is agnostic about whether or not its argument is modular. It should behave the same way with normal and modular integers. In other words, the function is an algebraic expression that could be used with any ring, not just integers. </small>”''</blockquote> |
|||
<pre> |
|||
It is important that the function f is agnostic about whether or not its argument is modular. |
|||
It should behave the same way with normal and modular integers. |
|||
In other words, the function is an algebraic expression that could be used with any ring, not just integers. |
|||
</pre> |
|||
For languages that represent elements in, says, Z/5Z as the integers 0,1,2,3,4 there is no way to |
For languages that represent elements in, says, Z/5Z as the integers 0,1,2,3,4 there is no way to |
||
distinguish an element of Z/5Z from n element in Z. That is, one is forced not to use existing libraries. |
distinguish an element of Z/5Z from n element in Z. That is, one is forced not to use existing libraries. |