In number theory we have so-called explicit formula's in terms of the Riemann zeta zero's. For instance to count the sum of the logarithms of the primes below some given integer.

(second Chebyshev Function)

Consider the floor function : http://mathworld.wolfram.com/FloorFunction.html

Is there an explicit formula for it consisting of elementary functions?

If not, why not?

Maybe in terms of the zero's of another special function?

  • 2
    $\begingroup$ I imagine it's not what you're looking for, but $-\lceil -x \rceil$ works. (There's probably also a Fourier series for $x-\lfloor x\rfloor$, which is a triangular wave) $\endgroup$ – Milo Brandt Jan 23 '15 at 23:30
  • 1
    $\begingroup$ This question is very important to me and seems well written. Here's a bounty. Now let's hope we get an answer. $\endgroup$ – The Great Duck May 7 '16 at 6:14
  • 1
    $\begingroup$ math.stackexchange.com/questions/389063/… I like the formula with arctan and tan $\endgroup$ – Andrei May 7 '16 at 7:02
  • $\begingroup$ @Andrei Are you trying to say that this question is a duplicate? $\endgroup$ – The Great Duck May 7 '16 at 16:57
  • $\begingroup$ @TheGreatDuck - the question was asked (and answered) in a previous thread $\endgroup$ – Andrei May 8 '16 at 18:17

Note that $\lfloor x \rfloor = x - \{x\}$, where $\{x \}$ (the fractional part of $x$) is periodic with period $1$, with a jump discontinuity at integer points. Let's try to write $\{x\}=f\left(\cot \pi x\right)$, since $\cot \pi x$ has the same property. We need $f(y)\rightarrow 0$ as $y\rightarrow \infty$, $f(y)\rightarrow 1$ as $y\rightarrow -\infty$, and the correct arc-tangent-y interpolation in between. What works is $f(y)=\frac{1}{2}-\frac{1}{\pi}\tan^{-1}y$. Putting things together, $$ \lfloor x \rfloor=x-\frac{1}{2} + \frac{1}{\pi}\tan^{-1}(\cot \pi x). $$

  • $\begingroup$ I'm leaning towards your answer as it appears to be the simplest and easiest to understand. However, I have one question. Are you saying that f(y) equals the fractional portion? That's very interesting if that's the case! $\endgroup$ – The Great Duck May 14 '16 at 6:42
  • $\begingroup$ Yes, since $\{x\}=x - \lfloor x \rfloor$. One caveat here is that we need to fill in the integer values (for both $\{x\}$ and $\lfloor x\rfloor$) by right-continuity, since $\cot k\pi$ ($k\in\mathbb{Z}$) is not defined. $\endgroup$ – mjqxxxx May 15 '16 at 16:00
  • $\begingroup$ Hmm... Perhaps there is a way to fix that and make it exist? Without piece wise of course. $\endgroup$ – The Great Duck May 16 '16 at 3:35

I don't think your going to find an explicit formula for the floor function and here is why,

$nextprime(n)= 1+\sum_{j=1}^{2n}\lfloor\frac{n!^j}{j!}\rfloor-\lfloor\frac{n!^j-1}{j!}\rfloor$


Greatest prime factor of $n$ $=n+1-\sum_{j=1}^{n}\lfloor\frac{j!^n}{n}\rfloor-\lfloor\frac{j!^n-1}{n}\rfloor$

Smallest prime coprime to $n=1+\sum_{j=1}^{n}\lfloor\frac{n^j}{j!}\rfloor-\lfloor\frac{n^j-1}{j!}\rfloor$

I mean the list goes on and on. If there were an explicit formula for the floor function, any thing having to do with primes would have a solution. Let me know if you find it. (:

  • 2
    $\begingroup$ But there already is an explicit formula for the number of primes below $n$ (as mentioned by the OP already), so why would it be surprising that we get other formulas for primes by nesting summations? $\endgroup$ – Erick Wong May 13 '16 at 17:10
  • $\begingroup$ The comment from The Great Duck was "we don't want those definitions. We want an equation consisting of elementary functions." This is what I was trying to respond to. If you had a formula comprised of elementary functions, you wouldn't need nested sums. You would have a straight forward sum as shown in the equations above. This is highly unlikely. You would have to find a simple combination of "elementary" terms that would be able to truncate exactly any decimal expansion, rational, irrational, transcendental...ect. I'm not saying its impossible, just highly unlikely. $\endgroup$ – e2theipi2026 May 13 '16 at 23:29
  • $\begingroup$ I think @mjqxxxx 's answer noting that $\lfloor x\rfloor = x - \frac{1}{2}+\frac{1}{\pi}\text{arctan}(\text{cot}(\pi x))$ is explicit and elementary enough, isn't it? $\endgroup$ – rmdmc89 May 14 '16 at 2:19
  • $\begingroup$ To you and me maybe but read last comment directly under post and you will see that it was asked to find a form without the trigonometric definition. A form of "elementary functions". $\endgroup$ – e2theipi2026 May 14 '16 at 8:37
  • $\begingroup$ Well, I should make it clear that I am not a representative of the OP. I am a person posting a bounty. However, if the formula consists of summations and limits and series, then... it is consisting of elementary functions. $\endgroup$ – The Great Duck May 16 '16 at 3:37

The standard way in analytic number theory to deal with sums involving the floor function is to either (a) estimate it trivially or (b) use Fourier analysis. In both cases, the idea is that \[\lfloor x \rfloor = x - \{x\},\] where $\{x\}$ denotes the fractional part of $x$. Trivially, one has \[0 \leq \{x\} < 1,\] and often this is sufficient for applications. Alternatively, one can use Fourier analysis, as this is essentially a sawtooth function, which has the Fourier expansion \[\{x\} = \frac{1}{2} - \frac{1}{2\pi i} \sum_{\substack{m = -\infty \\ m \neq 0}}^{\infty} \frac{1}{m} e^{2\pi i mx}.\] In practice, one instead uses the partial sum \[S_M \{x\} = \frac{1}{2} - \frac{1}{2\pi i} \sum_{\substack{m = -M \\ m \neq 0}}^{M} \frac{1}{m} e^{2\pi i mx},\] which satisfies \[S_M \{x\} = \{x\} + O\left(\frac{1}{1 + \|x\| M}\right),\] where $\|x\|$ denotes the distance from $x$ to the nearest integer. In particular, $S_M \{x\}$ is uniformly bounded in $M$ for all $x$ and converges pointwise almost everywhere to $\{x\}$ as $M$ tends to infinity.


I've derived an explicit formula for $S(x)=Floor(x)$ from the explicit formula for $Q(x)$ based on the relationship between $S(x)$ and $Q(x)$. The $c(n)$ coefficient referenced in (3) below involves both a Dirichlet convolution and a Dirichlet inverse, but I believe it simplifies such that $c(n)=1$ when $n$ is a square integer ($n\in\{1,4,9,16,...\}$) and $c(n)=0$ when $n$ is not a square integer.

(1) $\quad Q(x)=\sum\limits_{n=1}^x a(n)\,,\quad a(n)=\left|\mu(n)\right|$

(2) $\quad Q_o(x)=\frac{6\,x}{\pi^2}+\sum\limits_{k=1}^K\left(\frac{x^{\frac{\rho_k}{2}}\zeta\left(\frac{\rho_k}{2}\right)}{\rho_k \zeta'\left(\rho_k\right)}+\frac{x^{\frac{\rho _{-k}}{2}}\zeta \left(\frac{\rho_{-k}}{2}\right)}{\rho_{-k}\zeta'\left(\rho_{-k}\right)}\right)+1+\sum\limits_{n=1}^N\frac{x^{-n}\,\zeta(-n)}{(-2\,n)\,\zeta'(-2\,n)}\,,\\$ $\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad K\to\infty\land N\to\infty$

(3) $\quad S_o(x)=\sum_\limits{n=1}^x c(n)\,Q_o\left(\frac{x}{n}\right)$

The following plot illustrates $S_o(x)$ (orange) evaluated at $K=N=200$. $S(x)$ is illustrated in blue as a reference but is mostly hidden under the evaluation of $S_o(x)$. The red discrete portion of the plot illustrates the evaluation of $S_o(x)$ at integer values of $x$.

Illustration of $S_o(x)$

  • $\begingroup$ I assume these are the usual riemann zero’s used here ? Impressive. But “ Why “ this works is not Clearly explained. Do others agree ? $\endgroup$ – mick Apr 17 '18 at 21:46
  • $\begingroup$ @mick Yes, $\rho_k$ refers to a non-trivial zeta zero. The formula for $S_o(x)$ is based on the relationship $S(x)=\sum\limits_{n=1}^x c(n)\,Q(\frac{x}{n})$ where $c(n)=\begin{array}{cc} \{ & \begin{array}{cc} 1 & \sqrt{n}\in \mathbb{Z} \\ 0 & \text{True} \\ \end{array} \\ \end{array}$. $\endgroup$ – Steven Clark Apr 18 '18 at 3:29
  • $\begingroup$ @mick I illustrated the $Q_o(x)$ formula in the following question: math.stackexchange.com/q/2737492. There's still some question in my mind with respect to the convergence of the $Q_o(x)$ formula. $\endgroup$ – Steven Clark Apr 18 '18 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.