Wolfram Mathematica Explorations for
Floor, Ceiling and the Space Between

Árpád Bényi and Branko Ćurgus


The Problem

Let $\mathbb{N}$ denote the set of positive integers and let $\mathbb{R}_+$ denote the set of positive real numbers. Given $\alpha \in \mathbb{R}_+$, define the function \[ f_\alpha:\mathbb N \to \mathbb Z \] by \begin{equation} f_\alpha (n) = \bigl\lfloor \alpha^2 \, n \bigr\rfloor - \bigl\lfloor \alpha \lfloor \alpha\mkern 1mu n \rfloor \bigr\rfloor, \quad \forall \, n \in \mathbb N. \end{equation} The problem that we consider is to describe $\operatorname{Range}\bigl(f_\alpha\bigr)$ for all $\alpha \in \mathbb{R}_+$, where \[ \operatorname{Range}\bigl(f_\alpha\bigr) = \bigl\{ f_\alpha(n) : n \in \mathbb{N} \bigr\} \]
Our Results for $\alpha \in \mathbb{R}_+ \setminus \mathbb{N}$

The numbering of the statements below is from our paper:

Floor, Ceiling and the Space Between

Proposition 2.1.

For all $\alpha \in \mathbb{R}_+ \setminus \mathbb{N}$, we have \[ \operatorname{Range}\bigl(f_\alpha\bigr) \subseteq \{0,\ldots, \lceil\alpha\rceil\} . \]


Our Results for $\alpha \in \mathbb{Q}_+\setminus \mathbb{N}$

The numbering of the statements below is from our paper:

Floor, Ceiling and the Space Between

Lemma 3.1.

Let $a\in\mathbb{N}$ and $b\in\mathbb{N}\mkern-2mu\setminus\mkern-2mu\{1\}$ be relatively prime, and set $\alpha=a/b$. Then \[ \operatorname{Range}(f_\alpha) = \{0\}\cup\bigl\{f_\alpha(1), \ldots, f_\alpha(b^2-1)\bigr\}. \]

The following proposition gives the ranges for the functions $f_\alpha$ for all $\alpha \in (0,1) \cap \mathbb{Q}$.

Proposition 3.4.

Let $a, b \in \mathbb{N}$ be relatively prime with $a \lt b$. Then \[ \operatorname{Range}\bigl(f_{1/b}\bigr) = \{0\} \quad \text{for all} \quad b \gt 1, \] and \[ \operatorname{Range}\bigl(f_{a/b}\bigr) = \{0,1\} \quad \text{for all} \quad b \gt a \gt 1. \]

The following proposition gives the ranges for the functions $f_\alpha$ for all rational numbers greater than $1$ whose denominator is $2$.

Proposition 3.5.

For all $s \in \mathbb{N}$ we have \[ \operatorname{Range}\bigl(f_{2 s + 1/2}\bigr) = \bigl\{0, s \bigr\} \] and \[ \operatorname{Range}\bigl(f_{2s - 1/2}\bigr) = \bigl\{0, s - 1, s \bigr\}. \]

The first equality in Proposition 3.5 generalizes as follows.

Corollary 3.8.

Let $b\in\mathbb{N}\setminus\{1\},$ and $s \in\mathbb N \cup\{0\}$. Then \[ \operatorname{Range}\bigl(f_{s b+1/b}\bigr) = s \mkern 2mu \{0,\ldots, b-1\} . \]

The following corollary unifies Corollaries 3.12 and 3.13 in the paper.

Corollary 3.14.

Let $b \in\mathbb{N}\setminus\{1\}$ and $s \in\mathbb N \cup\{0\}$. Then \[ \operatorname{Range}\bigl(f_{sb+1+1/b}\bigr) = \bigl(s\{0, 1,\ldots, b-1\}\bigr)\cup \bigl(s\{1,\ldots, b-1\}+\{1\}\bigr). \]

Corollary 3.15.

Let $b \in\mathbb{N}\setminus\{1\}$ and $s \in\mathbb{N}$. Then \[ \operatorname{Range}\bigl(f_{sb-1+1/b}\bigr) = \bigl(s\{0, 1,\ldots, b-1\}\bigr)\cup \bigl(s\{1,\ldots, b-1\} - \{1\}\bigr). \]

The above results were exact. The following is an inclusion result.

Proposition 3.10.

Let $b \in\mathbb{N}\setminus\{1\}$ and $s \in\mathbb N \cup\{0\}$ and $u \in \{0,\ldots,b-1\}$. Then \[ \operatorname{Range}\bigl(f_{sb+u+1/b}\bigr) \subseteq \bigl(s\{0, \ldots, b-1\}\bigr) + \{0,\ldots, u\}. \]

Based on Wolfram Mathematica experimentation presented below, we state the following conjecture.

Conjecture 3.17.

For all $b \in\mathbb{N}\setminus\{1\}$, all $a \in \{0,\ldots,b-1\}$ relatively prime to \(b\), and all $s \in\mathbb N$ we have \[ \operatorname{Range}\bigl(f_{sb - a/b}\bigr) = \bigl(s\{0, \ldots, b-1\}\bigr) \cup \bigl(s\{1, \ldots, b-1\} - \{1\}\bigr). \]


Our Results for $\alpha \in \mathbb{R}_+\setminus\mathbb{Q}_+$

The numbering of the statements below is from our paper:

Floor, Ceiling and the Space Between

Proposition 4.1.

For all $t \in \mathbb{N}$ and \[ \alpha(t) = \frac{1+\sqrt{1+4t}}{2}, \] we have \[ \operatorname{Range}\bigl(f_{\alpha(t)}\bigr) = \bigl\{1,\ldots, \lfloor \alpha(t) \rfloor \}. \]

Based on Wolfram Mathematica experimentation presented below, we state the following conjecture.

Conjecture 4.3.

For all positive irrational parameters $\alpha$ we have \[ \{1,\ldots, \lfloor\alpha\rfloor\} \subseteq \operatorname{Range}\bigl(f_\alpha\bigr). \]

The preceding conjecture, if true, and Proposition 2.1 imply the following quadruplicity.
Proposition 4.4.

If Conjecture 4.3 is true, then for all positive irrational parameters \(\alpha\), one of the following equalities holds:

  1. $\displaystyle \operatorname{Range}(f_\alpha) = \bigl\{1,\ldots,\lfloor\alpha\rfloor\bigr\}$  (the smallest possible),
  2. $\displaystyle \operatorname{Range}(f_\alpha) = \bigl\{0,\ldots,\lfloor\alpha\rfloor\bigr\}$  (the smallest possible with prepended $0$),
  3. $\displaystyle \operatorname{Range}(f_\alpha) = \bigl\{1,\ldots,\lceil\alpha\rceil\bigr\}$  (the smallest possible with appended $\lceil\alpha\rceil$),
  4. $\displaystyle \operatorname{Range}(f_\alpha) = \bigl\{0,\ldots,\lceil\alpha\rceil\bigr\}$  (the largest possible).

The conjectured statements in Proposition 4.4 account for the seemingly deep differences among positive irrational numbers. It would be interesting to explore these differences further. We state two more conjectures.
Conjecture 4.5.

For all irrational numbers $\alpha \in (0,1)$ we have \[ \operatorname{Range}(f_\alpha) = \{0,1\}. \] That is, all irrational $\alpha \in (0,1)$ satisfy the equality in item D in Proposition 4.4.

Conjecture 4.7.

For all positive irrational $\alpha$ we have \[ \operatorname{Range}(f_\alpha) = \{1\} \qquad \Leftrightarrow \qquad \alpha = \frac{1+\sqrt{5}}{2}. \]


Wolfram Mathematica Code

If you are not familiar with Wolfram Mathematica, for a quick start see my Mathematica webpage. There are several movies linked at Mathematica webpage which might make the start easier. Also, one can search for newer, better movies. The web resources for Wolfram Mathematica are huge.

Below is the Mathematica code for the function $f_\alpha (n)$ defined in the paper. You can simply copy and paste the code below to a Mathematica notebook. It should work.

Clear[ff, n, \[Alpha]];
ff[n_, \[Alpha]_] :=
 Floor[\[Alpha]^2 n] - Floor[\[Alpha] Floor[\[Alpha] n]]

Whenever one defines a new function in Mathematica, it is a good idea to test it on a simplest possible example.

ff[7, Pi]

To get the range of the function $f_\alpha$ for a specific $\alpha$, for example $\alpha = 3 \pi$, we utilize the following code:

Sort[DeleteDuplicates[Table[ff[k, 3 Pi], {k, 1, 1000}]]]

The output of the preceding code is \[ \{0,1,2,3,4,5,6,7,8,9,10\}. \] That this is the range of $f_{3 \pi}$ follows from Proposition 2.1. In the case of irrational \(\alpha\), determining how far we need to extend the variable \(k\) in the code to capture the exact range of \(f_{\alpha}\) is not straightforward. Lemma 3.1 in our paper provides an upper bound for the case when \(\alpha\) is rational.


Mathematica Explorations for $\alpha \in \mathbb{Q}_+\setminus \mathbb{N}$


Wolfram Mathematica Explorations for $\alpha \in \mathbb{R}_+\setminus \mathbb{Q}_+$