I have gathered some data and I'm trying to find an equation for it. There are two variables, as you can see in the table below. I've noticed the result is equal to the x value as long as x <= y. Then, for any given y, the results follow a very specific pattern, but starting from the first result that matched the value of y. So, for y = 5, when the result is 5, it follows this pattern: 5-5-6-6-7-8-8-9-9-10...
If anyone can point me in the right direction to figure this out, I'd be thankful. And sorry if I explained something badly. Maths are not my strong point.
x\y 1 2 3 4 5 6 7 8 9 10
1 1 1 1 1 1 1 1 1 1 1
2 1 2 2 2 2 2 2 2 2 2
3 2 2 3 3 3 3 3 3 3 3
4 2 3 3 4 4 4 4 4 4 4
5 3 3 4 4 5 5 5 5 5 5
6 4 4 4 5 5 6 6 6 6 6
7 4 5 5 5 6 6 7 7 7 7
8 5 5 6 6 6 7 7 8 8 8
9 5 6 6 7 7 7 8 8 9 9
10 6 6 7 7 8 8 8 9 9 10
11 7 7 7 8 8 9 9 9 10 10
12 7 8 8 8 9 9 10 10 10 11
13 8 8 9 9 9 10 10 11 11 11
14 8 9 9 10 10 10 11 11 12 12
15 9 9 10 10 11 11 11 12 12 13
EDIT: I've found a method to compute the result, but it's not a single equation.
First, you need to know, for a given value of x and y, the position of its associated result in the pattern presented above (1-1-2-2-3). You can do it with the following equation:
(x - y) % 5
Then, there is a slightly different equation for each of the positions in the pattern:
First Pos: y + 3 * floor((x - y) / 5)
Second Pos: y + 3 * floor((x - y) / 5)
Third Pos: y + 3 * floor((x - y) / 5) + 1
Fourth Pos: y + 3 * floor((x - y) / 5) + 1
Fifth Pos: y + 3 * floor((x - y) / 5) + 2
For example, for x = 13 and y = 10:
(13 - 10) % 5 = 3
which means that their associated result occupies the fourth position in the pattern. Using the appropriate equation:
10 + 3 * floor((13 - 10) / 5) + 1 = 11
I also tried with values beyond those shown in the table and it seems to work just fine. But, again, it's not a single equation, which was my goal in the first place.
Not a perfect fit, but a good equation for estimation is $f(x) = \frac{x + y}{2}$