1
$\begingroup$

Does the function $f(x,y) = ((x-1) \mod y)+1$ have an existing name?

f(1,5) = 1
f(2,5) = 2
f(3,5) = 3
f(4,5) = 4
f(5,5) = 5
f(6,5) = 1
f(7,5) = 2

$\endgroup$
6
  • $\begingroup$ tagged as linear algebra? o_O $\endgroup$ Jun 4, 2010 at 16:02
  • 3
    $\begingroup$ Hardy seems worthy of a name. It's more or less mod. $\endgroup$ Jun 4, 2010 at 16:08
  • $\begingroup$ but since we traditionally label elements {1,2,...,y} instead of the better {0,1,...,y-1}, it is actually a good question, I'd say. $\endgroup$ Jun 4, 2010 at 16:11
  • $\begingroup$ I know its not the most interesting function in the world. I just want to check if it has a well known existing name to avoid confusing my readers. $\endgroup$ Jun 4, 2010 at 16:46
  • $\begingroup$ In that case, what kind of readers do you expect? $\endgroup$
    – Will Jagy
    Jun 4, 2010 at 17:49

4 Answers 4

7
$\begingroup$

In math, as opposed to in computer science, when you apply "mod y" you land in the integers modulo y, denoted Z/yZ, not back in the integers. This means that mod 7, the symbols 1 and 8 denote the same thing, i.e. the equivalence class {...,-13,-6,1,8,15,...}.

A more computer-y way to say this is that for mathematicians, "integer mod 7" is a different kind of data class than "integer."

All this is just a long way of saying that this is probably the wrong place to ask your question.

If I were defining this function in a math paper I'd say something like "Let f(x,y) denote the unique number in {1,2,...,y} which is congruent to x modulo y" or "By the division algorithm there exists a unique number in {1,2,...,y} which is congruent to x modulo y, we denote this number f(x,y)."

$\endgroup$
1
  • 2
    $\begingroup$ Thats pretty interesting, thanks for the detail. So I think from this information it is probably better to just name the function something like "mmod". $\endgroup$ Jun 4, 2010 at 18:48
5
$\begingroup$

Well, it's the quotient map from $\mathbb{Z}$ into $\mathbb{Z}/5\mathbb{Z}$, with the slightly unconventional relabelling of 0 as 5. Nothing much more interesting than that.

$\endgroup$
2
$\begingroup$

You could conceivably describe this as the "least positive residue" modulo y (as opposed to the "least non-negative residue" modulo y).

$\endgroup$
1
  • $\begingroup$ "least positive residue" is a name for normal modulo in some textbooks. Some people reference the "least positive (non-zero) residue" but i think it still doesn't capture that the number y is in the range. $\endgroup$ Jun 5, 2010 at 19:00
2
$\begingroup$

I think that my yesterday silly question implicitly gives a name to your function -- the feng shui function. To be more specific, for applying some knowledge from the feng shui system, one needs to start with his house number, say $n$, compute its sum of decimal digits, then do this again with the resulted number, and so on. The final result is a decimal digit in the range $\lbrace 1,2,\dots,9\rbrace$, namely $f(n,9)$, as you may check. If one does a similar computation in base $b$, the result is always $f(n,b-1)$. Isn't this a good reason for the name?!

$\endgroup$
2
  • $\begingroup$ Could be. In "Concrete Mathematics" Graham, Knuth, and Patashnik, define a kind of reverse modulo they call "murmur". They then joke that since Mod was a fashion in the 60s, the murmur function, defined in the 70s, should be called Punk! So what should the feng-shui function be dubbed? Hip? GaGa? ...? $\endgroup$ Jun 5, 2010 at 19:08
  • $\begingroup$ As I am far from what is in fashion right now, I could refer to my son's understanding of that: the feng-shui function is Ska. $\endgroup$ Jun 6, 2010 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.