Oscillation equality We have objects that oscillate between two integer points, [l, r], at the speed of one unit per time unit, starting at l on t=0. You may assume l &lt; r. For example, if an object oscillates on [3, 6], then we have:

t=0 -&gt; 3
t=1 -&gt; 4
t=2 -&gt; 5
t=3 -&gt; 6
t=4 -&gt; 5
t=6 -&gt; 4
t=7 -&gt; 3
t=8 -&gt; 4


Etc. But objects oscillate continuously, so we  also have t=0.5 -&gt; 3.5 and t=3.7 -&gt; 5.3.

Given two objects oscillating between [l1, r1], [l2, r2], determine if there is ever a time t such that the two objects share the same position. You make take l1, r1, l2, r2 in any convenient format, and output any truthy/falsy values.



Truthy inputs:

[[3, 6], [3, 6]]
[[3, 6], [4, 8]]
[[0, 2], [2, 3]]
[[0, 3], [2, 4]]
[[7, 9], [8, 9]]


Falsy inputs:

[[0, 3], [3, 5]] 
[[0, 2], [2, 4]]
[[5, 8], [9, 10]]
[[6, 9], [1, 2]]
[[1, 3], [2, 6]]
Python 2, 69 bytes



l,r,L,R=input()
d=r-l;k=1
while(R-L)*k%d:k+=1
print r-L&gt;=k%2*d/k&lt;=R-l


Try it online!