So what is it you want? You explained in detail about 2+7=9, which is half of 18, but what are you getting at? Because you are looking for X, which is unknown, do you have any value related to X?
Never mind that, let me give you a hint:
Let your X be 35, your end range be 50, now you can sub 35 -50 = 15, sub 15 from half of 50, so 15-25 = 10, then sub 10 from half of 25, so 10-12.5 = 2.5, now you should multiply by 4 to get 10, by 5 to get 12.5, by 6 to get 15 and so on.
Someone here was talking about being good in math, this should be easy for mathematicians to figure out, after all we have the start and end range.