Suppose we have $d$ cylindrical metal bars, with radius $l$, attached orthogonal to a support in random places:
Now we have to attach bars with radius $k$ EVENLY SPACED, with distance $p$ between their centers, in the same support and without any bar being in top of other:
Determine the possible values for $p$. ($k$ is not necessarily greater than $l$.)
(The way that I think the) Problem: Given a increasing finite sequence $\{a_n\}_{n=1}^d$ of $d$ real numbers and positive real numbers $l$ and $k$, find $p$ and $q$ such that the sequence $\{b_n\}_{n=0}^\infty=\{pn+q\}$ has the property: $$(a_i-l,a_i+l)\cap(b_j-k,b_j+k)=\emptyset\quad \forall i,j.$$ That is: we have open intervals around each $a_i$ with size $2l$ and we must find $p$ and $q$ such that the intervals with size $2k$ around numbers of the form $\{pn+q\}$ has no intersection with the first ones.
Question: How should I approach the problem to find ALL nontrivial solutions? (Note that $p>a_d-a_1$ will trivially solve the problem.)
Edit: I was not clear about looking for all nontrivial solutions.
(Edit) What I expect as an answer: A path to the solution to the problem, that is: an expression for $p$ and $q$ depending on the given data. Something like: "You formulate in the manner A, use results B and calculate C. I leave for you the calculations and minor details."
Edit: As user Timothy Chow pointed out, to give a bound on the number $d$ of bars can drastically make a difference on the possibility for such expression. So consider that $d \le 15$.
About the problem: A student of my class on differential equations asked me that problem and said that would be very helpful to have a 'very nice formula' for $p$ and $q$. He is doing university in engineering and already works in a big company here (Brazil). At first it appeared to me to be a 'very simple-trivial-easy' problem because of the finiteness of the first sequence, but the fact that the $a_n$'s are not necessarily evenly spaced make all too hard.
About the post itself: I had no idea of how to ask for help with that problem, so I asked in meta.mathoverflow about it and user @fedja very kindly answered me how to do it. Any help with a better title and appropriate tags will be very welcome.
My attempt to solve the problem: The problem looks like an optimization problem, so I tried to define a function $F(p,q)$ such the solutions correspond to the minimum of this function. One option is: $$F(p,q)=\int_{\mathbb{R}}f(x)g(x)\,dx,$$
where $$f(x) =
\begin{cases}
1, & \text{if $x \in (a_i-l,a_i+l)$ } \\
0, & \text{if $x \notin (a_i-l,a_i+l)$ }
\end{cases}$$
and
$$g(x) =
\begin{cases}
1, & \text{if $x \in (b_i-k,b_i+k)$ } \\
0, & \text{if $x \notin (b_i-k,b_i+k)$ }
\end{cases}.$$
Certainty $F(p,q)\ge0$ $\forall p,q$. Also $F(p,q)=0$ is a solution to the problem. As $f(x)\neq0$ only for a finite number of finite intervals this becomes
$$F(p,q)=\sum_{n=0}^d\int_{a_n-l}^{a_n+l}g(x)\,dx.$$
That $g(x)$ can be written as a Heaviside function applied to a cosine function:
$$g(x)=H\left(\cos\left(\frac{2\pi}{p}x-\frac{2\pi}{p}q\right)-\cos\left(\frac{2\pi k}{p}\right)\right).$$
So we have
$$F(p,q)=\sum_{n=0}^d\int_{a_n-l}^{a_n+l}H\left(\cos\left(\frac{2\pi}{p}x-\frac{2\pi}{p}q\right)-\cos\left(\frac{2\pi k}{p}\right)\right) \, dx.$$
For this integral I tried to use analytic approximations to the step function like the ones in the Wikipedia article, but none of the expressions seems to lead to an integral that can be expressed in closed form.
I still have a feeling that this problem could be solved in closed form. Since I had my master degree (about 10 years ago) I had never again contact to some areas of math like abstract algebra (fields, rings, etc). In all that time I essentially taught Linear Algebra and Differential Equation courses and just started my PhD in Physics, so all my experience is way too limited. I feel like someone with experience in Algebra would say "Oh, that is very simple application of Fermat's little theorem and euclidean division...". Or may be some one with experience in Measure theory "It's a easy calculation with the Lebesgue-Sobolev formula...". Any help will be very welcome!