2
$\begingroup$

Can anyone explain to me what the description of https://oeis.org/A227259 means?

Number of n X 2 0,1 arrays indicating 2 X 2 subblocks of some larger (n+1) X 3 binary array having a sum of two or less, with rows and columns of the latter in lexicographically nondecreasing order.

If you could just explain it enough so that I could verify the first three or four values, that'd be great. I can't even figure out WTF it's trying to describe.

The background is that I've got a different (much simpler to describe) sequence that matches this sequence as far as shown and that (provably) matches the formula listed there as "Empirical", but the OEIS editors won't add my comment with the simpler description unless I say "conjecture" or can prove some sort of equivalence with the monster that's there as the current sequence name.


EDIT: Nevermind, found the bug in my code. Bug is corrected below.

Here's my interpretation of the sequence if I'm guided by what people have been saying in the comments; it doesn't match the sequence in OEIS, so I hope someone who understands the interpretation in the comments and has code to verify the first several values can write an answer explaining what their code is doing.

import numpy as np
from scipy.ndimage import convolve

def gen_acceptable_mat(rows, cols):
    for worknum in range(2**(rows*cols)):
        binval = bin(worknum).replace('0b', '')
        binval = ('0' * (rows*cols - len(binval))) + binval
        flat = np.array([int(x) for x in binval],dtype=np.dtype('b'))
        mat = np.reshape(flat, (rows, cols))
        g = [ ''.join(str(t) for t in row) for row in mat ]
        if g != sorted(g):
            continue
        g = [ ''.join(str(t) for t in row) for row in np.transpose(mat) ]
        if g != sorted(g):
            continue
        yield mat

# original buggy line:
# ul_kernel = np.array([[1,1,0],[1,0,0],[0,0,0]], dtype='b')
ul_kernel = np.array([[1,1,0],[1,1,0],[0,0,0]], dtype='b')

if __name__ == '__main__':
    for npone in range(2,8):
        acceptable = list(gen_acceptable_mat(npone, 3))
        twobytwos = [(convolve(j, ul_kernel, mode='constant', cval=0) <= 2)[:-1,:-1].astype(int) for j in acceptable]
        print(np.unique(twobytwos, axis=0).shape[0])

This gives me 3, 9, 20, 40, 74, 128

With the fix, this gives me matching values.

Okay, now to line these values up with my simpler description...

$\endgroup$
4
  • 3
    $\begingroup$ here's a guess. If you have a $(n+1)\times 3$ 0-1 matrix, the 2x2 submatrices are indexed by the positions in a $n\times 2$ array (the coordinates of the top left hand corner of the 2x2 submatrix). Given a $(n+1)\times 3$ matrix you can form a $n\times 2$ matrix which has a 1 if the corresponding 2x2 submatrix has sum $\leqslant 2$ and a 0 otherwise. The sequence might then count how many different $n\times 2$ arrays arise from $(n+1)\times 3$ arrays satisfying certain conditions. $\endgroup$ May 24, 2023 at 16:21
  • 2
    $\begingroup$ In particular, $[0,1]$ is the missing array for $n=1$, yielding $a_1=2^2-1=3$. You cannot construct a $2\times 3$ binary array where the left $2\times 2$ subarray has sum $\ge 3$, the right $2\times 2$ subarray has sum $\le 2$, and the rows and columns are lexicographically nondecreasing. $\endgroup$
    – RobPratt
    May 24, 2023 at 18:09
  • $\begingroup$ Unfortunately, that interpretation of the sequence means that the first several values are 3, 9, 20, 40, 74, 128; I'll edit my question to include the code I'm using to reach that conclusion. $\endgroup$ May 24, 2023 at 19:26
  • 1
    $\begingroup$ I verified 3 9 23 50 96 168 274 423 625 891. $\endgroup$
    – RobPratt
    May 24, 2023 at 19:27

1 Answer 1

0
$\begingroup$

Here are the $23$ solutions for $n=3$:

1
0 0
0 0
0 0

2
1 0
0 0
0 0

3
1 0
0 0
0 1

4
1 0
0 1
0 0

5
1 0
0 1
0 1

6
1 0
1 0
0 0

7
1 0
1 0
0 1

8
1 0
1 0
1 0

9
1 0
1 0
1 1

10
1 0
1 1
0 0

11
1 0
1 1
0 1

12
1 0
1 1
1 1

13
1 1
0 0
0 0

14
1 1
0 1
0 0

15
1 1
0 1
0 1

16
1 1
1 0
0 0

17
1 1
1 0
0 1

18
1 1
1 0
1 0

19
1 1
1 0
1 1

20
1 1
1 1
0 0

21
1 1
1 1
0 1

22
1 1
1 1
1 0

23
1 1
1 1
1 1

If you point out one that you are missing, I'll show you a corresponding $4 \times 3$ array.

$\endgroup$
1
  • $\begingroup$ Ah! I found a matrix that mine had that yours didn't, and that allowed me to track down the bug in my code. $\endgroup$ May 24, 2023 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .