A smaller table by hand

A 2\times 2 table has entries, by row, (3,0) and (1,3). The margins are row totals 3 and 4, column totals 4 and 3, and n=7.

List the values of the top-left entry that the margins allow, compute the hypergeometric probability of the observed table, and the one-sided p-value for a top-left entry at least as large as 3.

The top-left entry k satisfies \max(0,4-4)\le k\le\min(3,4), so k=0,1,2,3. With \binom{7}{4}=35,

\mathbb{P}(K=k)=\frac{\binom{3}{k}\binom{4}{4-k}}{35},

which is 1/35, 12/35, 18/35 and 4/35. The observed table has k=3 and probability 4/35\approx 0.114. The one-sided probability of a top-left entry at least this large is the same 4/35, because 3 is already the largest feasible value.