Predictability of what $\lfloor n\log n\rfloor$ "skips"

39 Views Asked by At

TL;DR: is there any way to tell what numbers will not be present in the function $\lfloor n\log n\rfloor$ under a given upperbound?


I am writing a program that will calculate the sum of the gaps in the function $\lfloor n\log n\rfloor$ under an inputted upperbound. The gaps can be gathered from the chart below. $$\begin{array}{c|cccccccccccc}n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12\\\hline \lfloor n\log n\rfloor & 0 & 0 & 1 & 2 & 3 & 4 & 5 & 7 & 8 & 10 & 11 & 12\end{array}.$$ The gaps in this example are $6$ and $9$, for they are skipped. Let $h(u)$ be the output of the program in question, $u$ the upperbound. The table above shows $h(12)$, and is $15$.

I am trying to optimize this program. Currently, I brute-force my way through all values concerned.

I wonder now if there is any predictability to the gaps. I have analyzed the pattern for some time, but I have thus far been able to find any, other than that, as $n$ grows, the average gap density increases, probably because $x^x$ grows faster for larger $x$.

1

There are 1 best solutions below

1
On BEST ANSWER

This can't be effectively calculated. Especially since the size of the gaps significantly increases as n increases. For example, if $n > e^{10}$, the gaps have a size of at least 10.

Your problem can be solved easier. The sum of all numbers between $0$ and $n$ is known to be $\frac{n(n+ 1)}{2}$. From this value, you just need to substract all those numbers in the range from $0$ to $n$ that can be expressed as $\lfloor i \log(i)\rfloor$.