- #1
The Bill
- 374
- 146
- TL;DR Summary
- Is there a common name and notation for the function which takes in integers a and n, computes b= mod n, and outputs the lesser of b or n-b?
I've defined this function to clean up some pages of work I've been doing on relations of integers modulo n. Let's call it mav(a,n) for now. mav(a,n) for integers a and n is equal to the Euclidean distance from a to the nearest multiple of n.
To compute it in programming languages I've been just making a function that takes in integers a and n, computes b= mod n, and outputs the lesser of b or n-b.
I feel like I might be forgetting something from undergrad. I feel like this function may already have a standardized name and notation I'm just forgetting. It acts like "an absolute value in the integers modulo n," but whenever I search for that or notation which might look like that, I get results for n-adic and p-adic integers and analysis instead.
I also feel like there may be an easier functional method of computing it than I wrote in the second paragraph above.
Any thoughts?
To compute it in programming languages I've been just making a function that takes in integers a and n, computes b= mod n, and outputs the lesser of b or n-b.
I feel like I might be forgetting something from undergrad. I feel like this function may already have a standardized name and notation I'm just forgetting. It acts like "an absolute value in the integers modulo n," but whenever I search for that or notation which might look like that, I get results for n-adic and p-adic integers and analysis instead.
I also feel like there may be an easier functional method of computing it than I wrote in the second paragraph above.
Any thoughts?