2 added 8 characters in body

In fact the absolute value could not be greater than $2^{k-1}.$ Let $\{z\}=z-\lfloor z \rfloor$ denote the fractional part of $z$, then $$\Phi(n,x)-xr=0-\sum_i\{x/{p_i}\}+\sum_{i \lt j}\{ x/{p_ip_j}\}-\cdots+(-1)^{k}\{x/{n}\}$$ is a sum of $2^k$ terms, each between $0$ and $1$, half added and half subtracted. There is no reason to expect the first $k$ primes to give the optimal gap, and in fact they do not. For that matter, the question would be as interesting to me if the $p_i$ are simply relatively prime integers. The references given by Alan Haynes are apt and lead one to look at the article The distribution of totatives by D. H. Lehmer. Even there the key example is a bit hard to work out. If $q$ is any integer and $p_1\lt\dots\lt p_k$ are $k$ primes all of the form $p_i=c_iq-1$ then for $n=p_1p_2\cdots p_k$ there is a number $1 \lt x \lt n$ for which $|\Phi(n,x)-xr| \gt 2^{k-1} \frac{q-2}{q}.$ Let $C=\prod c_i$ It is esy to see that $$n=Cq^k-(\sum_iC/c_i)q^{k-1}+(\sum_{i\lt j}C/c_ic_j)q^{k-2}-\cdots+(-1)^k.$$ A similar expression holds for any product of several of the $p_i.$ The essentially unique extremal $x$ is $$\frac{n +(-1)^kp_1}{q}.$$ (-1)^kp_1}{q}-1.$$At this point I will simply illustrate with k=4. Then$$n=c_{1}c_{2}c_{3}c_{4}{q}^{4}- \left( c_{1}c_{2}c_{3}+c_{1}c_{2}c_{4}+c_{1}c_{3}c_{4}+c_{2}c_{3}c_{4} \right) {q}^{3}  + \left( c_{1}c_{2}+c_{1}c_{3}+c_{1}c_{4}+c_{2}c_{3}+c_{2}c_{4}+c_{3}c_{4} \right) {q}^{2}- \left( c_{1}+c_{2}+c_{3}+c_{4} \right) q+1$$and$$x=c_{1}c_{2}c_{3}c_{4}{q}^{3}- \left( c_{1}c_{2}c_{3}+c_{1}c_{2}c_{4}+c_{1}c_{3}c_{4}+c_{2}c_{3}c_{4} \right) {q}^{2}  + \left( c_{1}c_{2}+c_{1}c_{3}+c_{1}c_{4}+c_{2}c_{3}+c_{2}c_{4}+c_{3}c_{4} \right) {q}- \left( c_{2}+c_{3}+c_{4} \right) right)-1 $$So$$x/p_1p_2p_3p_4-\lfloor x/p_1p_2p_3p_4\rfloor =x/n \approx 1/q$$while, each term$$x/p_i-\lfloor x/p_i\rfloor=1-\frac{c_i-c_1}{c_iq-1x/p_i\rfloor=1-\frac{c_i-c_1+1}{c_iq-1} \approx 1-1/q $$and each term$$x/(p_ip_j)-\lfloor x/(p_ip_j)\rfloor=\frac{c_ic_jq-(c_i+c_j)+c_1}{c_ic_jq^2-(c_i+c_j)q+1}\approx x/(p_ip_j)\rfloor=\frac{c_ic_jq-(c_i+c_j)+c_1-1}{c_ic_jq^2-(c_i+c_j)q+1}\approx 1/q.$$The terms of one sign are very about 1/q and those of the other are about 1-1/q. this accounts for the entire summation being close to (1-2/q)2^{k-1} The other extreme is at n-1-x. 1 In fact the absolute value could not be greater than 2^{k-1}. Let \{z\}=z-\lfloor z \rfloor denote the fractional part of z, then$$\Phi(n,x)-xr=0-\sum_i\{x/{p_i}\}+\sum_{i \lt j}\{ x/{p_ip_j}\}-\cdots+(-1)^{k}\{x/{n}\}$$is a sum of 2^k terms, each between 0 and 1, half added and half subtracted. There is no reason to expect the first k primes to give the optimal gap, and in fact they do not. For that matter, the question would be as interesting to me if the p_i are simply relatively prime integers. The references given by Alan Haynes are apt and lead one to look at the article The distribution of totatives by D. H. Lehmer. Even there the key example is a bit hard to work out. If q is any integer and p_1\lt\dots\lt p_k are k primes all of the form p_i=c_iq-1 then for n=p_1p_2\cdots p_k there is a number 1 \lt x \lt n for which |\Phi(n,x)-xr| \gt 2^{k-1} \frac{q-2}{q}. Let C=\prod c_i It is esy to see that$$n=Cq^k-(\sum_iC/c_i)q^{k-1}+(\sum_{i\lt j}C/c_ic_j)q^{k-2}-\cdots+(-1)^k.$$A similar expression holds for any product of several of the p_i. The essentially unique extremal x is$$\frac{n +(-1)^kp_1}{q}.$$At this point I will simply illustrate with k=4. Then$$n=c_{1}c_{2}c_{3}c_{4}{q}^{4}- \left( c_{1}c_{2}c_{3}+c_{1}c_{2}c_{4}+c_{1}c_{3}c_{4}+c_{2}c_{3}c_{4} \right) {q}^{3}  + \left( c_{1}c_{2}+c_{1}c_{3}+c_{1}c_{4}+c_{2}c_{3}+c_{2}c_{4}+c_{3}c_{4} \right) {q}^{2}- \left( c_{1}+c_{2}+c_{3}+c_{4} \right) q+1$$and$$x=c_{1}c_{2}c_{3}c_{4}{q}^{3}- \left( c_{1}c_{2}c_{3}+c_{1}c_{2}c_{4}+c_{1}c_{3}c_{4}+c_{2}c_{3}c_{4} \right) {q}^{2}  + \left( c_{1}c_{2}+c_{1}c_{3}+c_{1}c_{4}+c_{2}c_{3}+c_{2}c_{4}+c_{3}c_{4} \right) {q}- \left( c_{2}+c_{3}+c_{4} \right) $$So$$x/p_1p_2p_3p_4-\lfloor x/p_1p_2p_3p_4\rfloor =x/n \approx 1/q$$while, each term$$x/p_i-\lfloor x/p_i\rfloor=1-\frac{c_i-c_1}{c_iq-1} \approx 1-1/q $$and each term$$x/(p_ip_j)-\lfloor x/(p_ip_j)\rfloor=\frac{c_ic_jq-(c_i+c_j)+c_1}{c_ic_jq^2-(c_i+c_j)q+1}\approx 1/q. The terms of one sign are very about $1/q$ and those of the other are about $1-1/q.$ this accounts for the entire summation being close to $(1-2/q)2^{k-1}$

The other extreme is at $n-1-x$.