This is a refined version of a [question I have recently posted](https://mathoverflow.net/q/446461/9924).


For a prime $p$, let $\varphi\_p\colon\mathbb Z\to\mathbb Z/p\mathbb Z$ denote the canonical homomorphism from the integers onto the group of order $p$.



> 
> Given an integer $n\ge 3$, what is the smallest $\varepsilon=\varepsilon(n)>0$ such that for any subset $A\subset\mathbb Z$ with $|A|=n$, not contained in an arithmetic progression with the difference greater than $1$, there exists a prime $p$ satisfying $(1-\varepsilon(n))n\le|\varphi\_p(A)|<n$?
> 
> 
> 


To put it simply, I want a prime $p$ distinguishing between the elements of $A$ ``as much as possible", but not distinguishing between all of them - subject to the assumption that $A$ is not contained in a nontrivial arithmetic progression (see [this nice construction](https://mathoverflow.net/a/446470/9924) by Peter Mueller showing that the containment assumption is vital.).


As an example, $\varepsilon(3)=1/3$: for any pairwise distinct integers $a,b,c$ with $\gcd(b-a,c-b,a-c)=1$ there exists a prime $p$ dividing exactly one of $b-a$, $c-b$, and $a-c$.



Bins-and-primes (prime divisors of $\prod(a_i-a_j)$, II)
The answer is $\varepsilon(n)=1-\frac{2}{n}$. Clearly, $\lvert\varphi\_p(A)\rvert\ge2$ for all primes $p$. However,
for every $n\ge2$ there is a set $A$ of size $n$ such that $\lvert\varphi\_p(A)\rvert=2$ whenever $\varphi\_p$ is not injective on $A$:


Let $P=\{2,3,\ldots,p\_{n-1}\}$ be the set of the first $n-1$ primes and $\pi$ be their product. Set $$A=\{0\}\cup\{\frac{\pi}{p}\,|\,p\in P\}.$$
Then $\operatorname{gcd}(A)=1$, so $A$ is not contained in an arithmetic progression with difference $>1$.


For each $p\in P$, exactly one of the elements in $A$ is not divisible by $p$, so $\lvert\varphi\_p(A)\rvert=2$.


Now let $p<q$ be distinct elements from $P$. From $\frac{\pi}{p}-\frac{\pi}{q}=\frac{\pi}{pq}(q-p)$ and $0<q-p<p\_{n-1}$ we see that all the prime divisors of $\frac{\pi}{p}-\frac{\pi}{q}$ are in $P$. Thus $\lvert\varphi\_p(A)\rvert=2$ for $p\in P$, and $\lvert\varphi\_p(A)\rvert=n$ for each prime $p>p\_{n-1}$.


