Name of distance to nearest multiple of n function?

  • Context: Undergrad 
  • Thread starter Thread starter The Bill
  • Start date Start date
  • Tags Tags
    Function Multiple
Click For Summary
SUMMARY

The function mav(a, n) computes the Euclidean distance from an integer a to the nearest multiple of another integer n. This function is defined by taking the modulus of a with respect to n, resulting in b = a mod n, and then returning the minimum of b or n - b. The discussion highlights a potential lack of standardized terminology for this function, which resembles an absolute value in the context of integers modulo n. Additionally, there is an inquiry into whether a more efficient computational method exists for this function.

PREREQUISITES
  • Understanding of integer arithmetic and modular operations
  • Familiarity with Euclidean distance concepts
  • Basic programming skills in any language for function implementation
  • Knowledge of mathematical notation and functions
NEXT STEPS
  • Research standardized mathematical terminology for modular arithmetic functions
  • Explore efficient algorithms for computing modular distances
  • Learn about integer programming techniques in Python or Java
  • Investigate the properties of n-adic and p-adic integers for related concepts
USEFUL FOR

Mathematicians, computer scientists, and software developers interested in modular arithmetic, algorithm optimization, and mathematical function implementation.

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.
 
  • Like
Likes   Reactions: The Bill

Similar threads

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