39. Find a two-digit number that has the following properties:

a) if the desired number is multiplied by 2 and 1 is added to the product, the result is a perfect square;

b) if the desired number is multiplied by 3 and 1 is added to the product, the result is a perfect square.
39. The condition of the problem can be written as: $2 a+1=N^{2}, 3 a+1=M^{2}$. The squares of numbers can end with the digits $0,1,4,5,6,9$. Then $2 a$ can end with $0,4,8$ (since $2 a$ is an even number) and $a$ can end with 5,2, 4, and 0. $10 \leqslant a \leqslant 99$, i.e., $21<2 a+1<199,31<3 a+1<298$ or $21<N^{2}<199$, $31<M^{2}<298$. $N^{2}$ is an odd number, so $N^{2}$ can have the values 24, 49, 81, 121, 169, i.e., $a$ can be equal to $12,24,40,60,34$.

$M^{2}-1$ is divisible by 3, so $M^{2}$ can have the values $49,64,100,121,169$, $196,256,289$ and $a$ can be equal to $40,65,85$. Thus, $a=40$.