I recently saw and answered this question that I thought was pretty interesting. It's asking about functions $f:\mathbb{Z}^+\to\mathbb{Z}^+$ such that for all $x,y\in\mathbb{Z}^+$, there exists exactly one $k$ with $x+1\le k \le x+f(y)$ such that $y|f(k)$. In that question, they're asking to show there are infinitely many $n$ such that $f(n)=n$, but my question is what functions $f$ can satisfy this?
Repeating a bit from my answer to that question, we have that divisibility of $f$ by $y$ is a $f(y)$-periodic function, which also implies that $f(n)|f(mn)$ for all $m,n\in\mathbb{Z}^+$. We also have that $[n|f(n)]\iff f(n)=n$ and $[n|f(m)]\iff [f(n)|m]$ $(\star)$.
Letting $f(n)=k$, we have from $(\star)$ that $n|f(k)$. If we use $(\star)$ again but the other way around, we get that $f(k)|n$. Thus for all $n$, $[f(n)=k]\iff[f(k)=n]$. This also implies that $f$ is injective.
Using $(\star)$ again with $m=n$, we have that $[n|f(n)]\iff [f(n)|n]$ and since $[n|f(n)]\iff f(n)=n$, this means that $[n|f(n)]\iff [f(n)|n]\iff f(n)=n$. So if $f(n)\not=n$, $f(n)$ can be neither a multiple or divisor of $n$.
Since divisibility by $n$ is $(f(n)=k)$-periodic and divisibility by $k$ is $n$-periodic, we have that $f(\mathrm{lcm}(n,k))=\mathrm{lcm}(n,k)$.
Coming to my final questions: what are all the possible functions $f$ such that the original property holds? It's true that $f$ defined as $f(n)=n$ works, but are there other functions? Is it possible to specify all such $f$?
Edit: This is what I've found must be true of $f$:
- $f(n)|f(mn)$
- $[n|f(n)]\iff f(n)=n$
- $[n|f(m)]\iff f(n)|m$
- $f(n)|n\iff f(n)=n$
- $f(n)=k\iff f(k)=n$
- $f$ is bijective
- $f(n)=k\implies f(\gcd(n,k))=\gcd(n,k)$
- $f(n)=k\implies f(\mathrm{lcm}(n,k))=\mathrm{lcm}(n,k)$
- $f(ag)=bg\implies f(g)|\gcd(a,b)\cdot g$
- for $p$ prime, $f(p)=p$ or $f(p\cdot f(p))=p\cdot f(p)$
- for $p$ prime and $f(ap)=bp$, $f(p)=p$ or [$f(p)|\gcd(a,b)$ and $f(p)\not| p$]
- for $p$ prime, $f(p)$ must be a prime. This also implies that $f$ restricted to the primes is bijective.
- $f$ is a multiplicative function.
I think that all multiplicative $f$ satisfying $f(p)$ prime for $p$ prime and $f(f(p))=p$ work, but I'm not sure about this.