Is this puzzle an abstraction of already existing problem?

109 Views Asked by At

My friend came up with this puzzle while we were playing with pixels on an image editor. The nature of the puzzle seems pretty simple, so I have this hunch that we aren't the only humans to have done this before. If you know the applications of this same problem, if it's name, or any other information relating to it: please let me know! I've never wrote math formally so please let me know if there's an inconsistency or a more concise way of writing this. If someone could verify or point out an issue with my solution(s) I'd really appreciate it.

Problem

$0 \le i \lt n$

Given set $S$ consisting of $n$ amount a points in a cell grid in the form $(x_i, y_i)$: create an expression $f$ that is equal to the amount of cells used to connect each pair of point's pair of manhattan distances. (Note that since $0 \le i \lt n$, the bounding rectangle of all the points as a vertex at (0, 0) and is always in the first quadrant of $\mathbb{R}^2$)

Here are some examples with solutions (blue = point in $S$; black = cell counted in $f$)

My Solution

I must clarify that if $x_i = x_j$, that value will only show up once in $S_x$ (the same applies to $y_i$, $y_j$, and $S_y$ respectively)

$$ S = \left\{(x_0, y_0), (x_1, y_1), \dots, (x_{n-1}, y_{n-1})\right\} \\ S_x = \{x_0, x_1, \dots, x_{n-1}\} \\ S_y = \{y_0, y_1, \dots, y_{n-1}\} \\ u_x = \text{unique}(S_x) \\ u_y = \text{unique}(S_y) \\ \min(S_x) = 0 \text{ and } \min(S_x) = 0 \\ m_x = \max(S_y) \\ m_y = \max(S_x) \\ f = (m_x + 1)(m_y + 1) - (m_x + 1 - u_x)(m_y + 1 - u_y) - n $$ As pointed out by Jaap Scherphuis, this expression can be represented much more simply: by adding the unique columns and unique rows, subtracting the cross-section to avoid double counting, then subtracting the blue dots. $$ f = u_x(m_y + 1) + u_y(m_x + 1) - u_x u_y - n $$

Problem 1.5

This is a problem that I gave a shot after the previous problem.

Given everything from before: create an expression $p$ that evaluates to the amount of configurations $S$ can be in, with $n$ and $f$ staying constant.


$$ u_x, u_y \in C \\ C = \{a, b\} \\ a \le b \\ p = a!\left(a^{b - a}\right) $$