I Name of distance to nearest multiple of n function?

  • I
  • Thread starter Thread starter The Bill
  • Start date Start date
  • Tags Tags
    Function Multiple
AI Thread 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 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?
 
Mathematics news on Phys.org
I've never heard of something specific for that.
 
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...
Thread 'Imaginary Pythagoras'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top