python - Smallest k X l Grid That Guarantees to Find Four Monochromatic Points -


suppose each point in z x z colored 1 of n given colors.

find smallest k , l such in k x l grid 1 guaranteed find 4 monochromatic points vertices of rectangle.


for case of n=1, smallest (k,l) (2,2)

for case of n=2, had found 4 x 4 colored grid still not making monochromatic rectangle :

$baba\aabb\abaa\bbab $

is there computational way make automatically searched?

i need advice

(i knows python reference)

the smallest k , l (following l distinguish 1) such equation

k * l >= (k + l) * n 

is satisfied. explain please consider grid (k,l) want place many pixels of same color, red, possible. k + l - 1 pixels have been placed there's no room left add 1 without becoming vertex of rectangle.

grid

so count k + l pixels of same color in grid (k,l) it's safe @ least 1 such vertex list present.

now consider 2 colors arbitrarily arranged inside grid. arrangement can @ least k * l / 2 pixels of most used color present. safe assume that, if k * l / 2 greater or equal k + l, @ least 1 such rectangle can found among used color.

for 3 colors consider k * l / 3 , on, leads formula k * l / n >= k + l n colors.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -