Let $a$,$b$,$c$ and $d$ be prime numbers such that $a>b>c>d$. Let $x$ be an integer greater than $a$.
Let $f(x) = \left(\dfrac{x}{a}\right) – \left(\left(\dfrac{x}{ab}\right) + \left(\dfrac{x}{ac}\right) + \left(\dfrac{x}{ad}\right)\right) + \left(\left(\dfrac{x}{abc}\right) + \left(\dfrac{x}{abd}\right) + \left(\dfrac{x}{acd}\right)\right) – \left(\dfrac{x}{abcd}\right) $
Let $g(x) =
\left\lfloor \dfrac{x}{a} \right\rfloor –
\left(\left\lfloor \dfrac{x}{ab} \right\rfloor +
\left\lfloor \dfrac{x}{ac} \right\rfloor +
\left\lfloor \dfrac{x}{ad} \right\rfloor \right) +
\left(\left\lfloor \dfrac{x}{abc} \right\rfloor +
\left\lfloor \dfrac{x}{abd} \right\rfloor +
\left\lfloor \dfrac{x}{acd} \right\rfloor \right) –
\left\lfloor \dfrac{x}{abcd} \right\rfloor -1$
What value of $x$ results in the maximum difference between $f(x)$ and $g(x)$ (i.e. $f(x) – g(x)$) and what is the value of the difference in terms of $a,b,c$ and $d$?
Edit: I changed the square brackets to parentheses since they were causing confusion.
There are multiple values of $x$ where the difference between $f(x)$ and $g(x)$ reaches a maximum. If you graph the difference between $f(x)$ and $g(x)$, you will notice that the curve is cyclical with a period equal to $a\times b\times c\times d$. In other words $f(z) – g(z) = f(z + abcd) – g(z + abcd)$ for any integer $z$.
For example, $a=7$, $b=5$, $c=3$, $d=2$.
By plotting the difference between $f(x)$ and $g(x)$, I have found that
the maximal difference occurs at $x=76 + 210n$ where $n$ is any integer.
The value of the maximal difference is $\frac{398}{210}$.
Why does the maximum occur at $x=76$? Why is the maximal difference equal to $\frac{398}{210}$?
Edit2: Notice that the difference between $f(x)$ and $g(x)$ reaches a peak at $x=an-1$ where $n$ is an integer. This is because the difference between the first terms of $f(x)$ and $g(x)$ is at a maximum.
$\left(\dfrac{an-1}{a}\right) – \left\lfloor \dfrac{an-1}{a} \right\rfloor = \dfrac{a-1}{a}$.
In my example where $a=7$, the peaks occur at $x = 48,76,90,118,132,160,202,$etc. All these values are in the form $x=7n-1$ and the largest peak occurs at $x=76$.
Best Answer
Note: Most of the work was already done by OP. This answer is a kind of summary.
In order to find the maximum difference $\max_{x\in\mathbb{N}}\{f(x)-g(x)\}$ the constant term $-1$ of $g(x)$ is not relevant and will be neglected. We denote with $\{x\}$ the fractional part of a real number $x\geq 0$. \begin{align*} x=\lfloor x \rfloor+\{x\}\qquad\qquad 0\leq \{x\}<1 \end{align*}
Taking primes $a>b>c>d$ we can write the difference as function $h:\mathbb{N}\to\mathbb{R}$ with \begin{align*} h(x)&=\frac{x}{a}-\frac{x}{ab}-\frac{x}{ac}-\frac{x}{ad}+\frac{x}{abc}+\frac{x}{abd}+\frac{x}{acd}-\frac{x}{abcd}\\ &\qquad-\left\lfloor\frac{x}{a}\right\rfloor+\left\lfloor\frac{x}{ab}\right\rfloor+\left\lfloor\frac{x}{ac}\right\rfloor+\left\lfloor\frac{x}{ad}\right\rfloor\\ &\qquad-\left\lfloor\frac{x}{abc}\right\rfloor-\left\lfloor\frac{x}{abd}\right\rfloor-\left\lfloor\frac{x}{acd}\right\rfloor+\left\lfloor\frac{x}{abcd}\right\rfloor\\ &=\left\{\frac{x}{a}\right\}-\left\{\frac{x}{ab}\right\}-\left\{\frac{x}{ac}\right\}-\left\{\frac{x}{ad}\right\}\\ &\qquad+\left\{\frac{x}{abc}\right\}+\left\{\frac{x}{abd}\right\}+\left\{\frac{x}{acd}\right\}-\left\{\frac{x}{abcd}\right\}\tag{1} \end{align*}
We conclude from the three aspects above:
The maximum of $h$ is given as
\begin{align*} &\max_{1\leq x\leq 210}h(x)\\ &\qquad=\max_{1\leq x\leq 210}\left(\left\{\frac{x}{7}\right\}-\left\{\frac{x}{35}\right\}-\left\{\frac{x}{21}\right\}-\left\{\frac{x}{14}\right\}\right.\\ &\qquad\qquad\qquad\qquad\left.+\left\{\frac{x}{105}\right\}+\left\{\frac{x}{70}\right\}+\left\{\frac{x}{42}\right\}-\left\{\frac{x}{210}\right\}\right)\\ &\qquad=\max_{1\leq n\leq 30}\left(\frac{6}{7} -\left(\frac{(7n-1)\mathrm{mod}(35)}{35}\right\}-\left\{\frac{(7n-1)\mathrm{mod}(21)}{21}\right\}\right.\\ &\qquad\qquad\qquad\qquad-\left\{\frac{(7n-1)\mathrm{mod}(14)}{14}\right\}+\left\{\frac{(7n-1)\mathrm{mod}(105)}{105}\right\}\\ &\qquad\qquad\qquad\qquad+\left\{\frac{(7n-1)\mathrm{mod}(70)}{70}\right\} +\left\{\frac{(7n-1)\mathrm{mod}(42)}{42}\right\}\\ &\qquad\qquad\qquad\qquad\left.-\left\{\frac{(7n-1)\mathrm{mod}(210)}{210}\right\}\right)\tag{3} \end{align*}
Calculation gives a maximum value for $n=11$ resulting in
\begin{align*} h(x)=h(7n-1)=\color{blue}{h(76)=\frac{94}{105}\doteq 0,8952} \end{align*}