.
Let p and q be that prime integer numbers that are the length and the width, respectively.
Then you have
p + q = 40/2 = 20,
and (OBVIOUSLY) you should select these prime numbers p and q as close to their mean value of 10 as possible.
Just the first trial 13 and 7 leads you to the success and to the dimensions p= 13, q= 7 centimeters.
ANSWER. The area of the rectangle is 13*7 = 91 cm^2.
Solved.
I'd say that everything is simple in this problem, and there is nothing extraordinary interesting . . .