Solution: Say the length and width are L and W respectively, and Peter knows A = LW, Paul knows S = L+W. Clearly A != p1 p2 (product of two primes) since otherwise Peter would know S immediately. But Paul knows that before Peter makes his first statement, therefore S != p1 + p2(sum of two primes) since if it were, to the best of Paul's knowledge it's possible that A = p1 p2 and Paul could not be sure Peter wouldn't know S right away. So Peter now knows S != p1 + p2 in pass 2, and since 4 <= S <= 40, S is in the set {11, 17, 23, 27, 29, 35, 37} (call these the "permissible" values for S).
Claim that if S = 11, Peter and Paul would have the exact conversation that they do: in pass 2, Paul knows that the possible values for S = L+W are
11 = 2+9 => A = 18 = 2x9 = 6x3 => S = 11, 9 => S = 11 (9 not permissible)
= 3+8 => A = 24 = 2x12 = 3x8 = 4x6 => S = 14, 11, 10 => S = 11
= 4+7 => A = 28 = 2x14 = 4x7 => S = 12, 11 => S = 11
= 5+6 => A = 30 = 2x15 = 3x10 = 6x5 => S = 17, 13, 11 => S = 17, 11
therefore Paul knows A = 30 = 5x6 since in the other three cases S has only one permissible value (so Peter would have known S in pass 2) whereas in the fourth case, Peter cannot decide between 11 and 17 in pass 2. But in pass 3 he can eliminate 17 because
17 = 2+15 => A = 30 = 2x15 = 3x10 = 6x5 => S = 17, 13, 11 => S = 17, 11
= 3+14 => A = 42 = 2x21 = 3x14 = 6x7 => S = 23, 17, 13 => S = 23, 17
i.e. even though Peter does not know S in pass 2, Paul still would not have been able to decide between A = 30 or 42.
So L = 5, W = 6 is a possible solution to the puzzle, and we can show it is unique by observing that if S is one of 17, 27, 23, 29, 35, or 37, then Paul could not know A in pass 2. We have already proven this in the case S = 17, and the other cases are similar (though somewhat tedious to discover):
23 = 2+21 => A = 42 = 2x21 = 3x14 = 6x7 => S = 23, 17, 13 => S = 23, 17
= 3+20 => A = 60 = 3x20 = 5x12 => S = 23, 17
27 = 3+24 => A = 72 = 3x24 = 8x9 => S = 27, 17
= 6+21 => A = 126 = 6x21 = 9x14 => S = 27, 23
29 = 5+24 => A = 120 = 5x24 = 8x15 => S = 29, 23
= 14+15 => A = 210 = 14x15 = 30x7 => S = 29, 37
35 = 13+22 => A = 286 = 13x22 = 11x26 => S = 35, 37
= 15+20 => A = 300 = 15x20 = 12x35 => S = 35, 37
37 = 4+33 => A = 132 = 4x33 = 11x12 => S = 37, 23
= 7+30 => A = 210 = 14x15 = 30x7 => S = 29, 37.