A curious property of the fractional part

406 Views Asked by At

I've found a curious property of the fractional part.

Namely, let be given a number $n$. Then among the numbers

$ n/1, n/2, n/3, .... n/n, $

the proportion of elements whose fractional part is $\geq 1/2$ tends to $2.588\ldots$ as $n$ tends to $\infty$. Here is the Python code that helped me to discover this fact, by giving various values to $n$.

n = 7379491
count = 0
for i in range(1, n):
    if n/i - n//i >= 0.5:
        count += 1

print("{}, {}".format(n, n/count))

Is it something known? what is the rationale behind this?

2

There are 2 best solutions below

4
On BEST ANSWER

The constant you are looking for is $\frac{1}{2 \ln(2) - 1}$. Here's an explanation; I'm skipping some details here and there but the overall idea should be intact.

  • For $\frac{2}{3} n < k \leq n$, we have $1 \leq \frac{n}{k} < \frac{3}{2} \implies \left\{ \frac{n}{k} \right\} < \frac{1}{2}$;
  • for $\frac{2}{4} n < k \leq \frac{2}{3} n$, we have $\frac{3}{2} \leq \frac{n}{k} < 2 \implies \left\{ \frac{n}{k} \right\} \geq \frac{1}{2}$;
  • for $\frac{2}{5} n < k \leq \frac{2}{4} n$, we have $2 \leq \frac{n}{k} < \frac{5}{2} \implies \left\{ \frac{n}{k} \right\} < \frac{1}{2}$;
  • for $\frac{2}{6} n < k \leq \frac{2}{5} n$, we have $\frac{5}{2} \leq \frac{n}{k} < 3 \implies \left\{ \frac{n}{k} \right\} \geq \frac{1}{2}$;
  • ...

Therefore, the $k$'s we are counting are those satisfying $\frac{2}{2 l} n < k \leq \frac{2}{2l - 1} n$ for some integer $l \geq 2$. The limit of the proportion is then given by $$\begin{split} \sum_{l = 2}^\infty \left( \frac{2}{2 l - 1} - \frac{2}{2 l} \right) &= 2 \left( \frac{1}{3} - \frac{1}{4} + \frac{1}{5} - \frac{1}{6} + \dots \right) \\ &= 2 \underbrace{\left( 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \dots \right)}_{= \ln(1 + 1) = \ln{2}} - \underbrace{2 \left( 1 -\frac{1}{2} \right)}_{= 1} \\ &= 2 \ln(2) - 1 \\ &\approx 0.38629436112. \end{split}$$ This is the value discovered by Benoit Cloitre on the OEIS in 2012 (found by Martin R in the comments). See https://oeis.org/A075989. The $2.588...$ you've found is the inverse of that value, $\frac{1}{2 \ln(2) - 1} \approx 2.58869944956$.

3
On

Note that ${n/k} \ge 1/2$ iff $[2n/k]-2[n/k]=1$ so if $a(n)$ is the number of such $k \le n$ we have $$a(n)=\sum_{k \le n}([2n/k]-2[n/k])=\sum_{k \le 2n}[2n/k]-n -2\sum_{k \le n}[n/k]$$ since if $n+1 \le k \le 2n$ we have $[2n/k]=1$ and there are precisely $n$ such $k$ to be added and subtracted in the first sum.

But $\sum_{k \le x}[x/k]=D(x)=\sum_{m \le x}\tau(m)=x\log x +(2\gamma-1)x+O(x^{\alpha+\epsilon})$ where $\tau(m)$ is as usual the number of divisors of $m$, $\gamma$ is the Euler constant and $\alpha$ is the Dirichlet divisor problem exponent known to be less than $.32$ as of now and conjectured to be $1/4$ (easy proof by the hyperbola method that $\alpha$ is at most $1/2$ and not that hard to prove is at most $1/3$ either).

So $$a(n)=(2n)\log 2n + (2\gamma-1)(2n)-n -2n \log n -2(2\gamma-1)n+O(n^{\alpha+\epsilon})$$ hence by simplification we get $$a(n)=n(2\log 2 -1)+O(n^{\alpha+\epsilon})$$ so $a(n)/n \to 2\log 2-1$ as noted in the OP