Undergrad Name of distance to nearest multiple of n function?

  • Thread starter Thread starter The Bill
  • Start date Start date
  • Tags Tags
    Function Multiple
Click For Summary
The function mav(a,n) calculates the Euclidean distance from an integer a to the nearest multiple of n. It is computed by taking the modulus of a with n, resulting in b, and then returning the lesser value between b and n-b. The creator is unsure if this function has a standardized name or notation, as searches yield unrelated results in n-adic and p-adic contexts. There is also a suggestion that a more efficient method for computing this function may exist. The discussion seeks clarity on the function's nomenclature and potential optimization techniques.
The Bill
Messages
373
Reaction score
146
TL;DR
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?
 
Mathematics news on Phys.org
I've never heard of something specific for that.
 
Here is a little puzzle from the book 100 Geometric Games by Pierre Berloquin. The side of a small square is one meter long and the side of a larger square one and a half meters long. One vertex of the large square is at the center of the small square. The side of the large square cuts two sides of the small square into one- third parts and two-thirds parts. What is the area where the squares overlap?

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
7
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
3
Views
5K
  • · Replies 16 ·
Replies
16
Views
5K