Mary - M
Jim - J
Mary's ticket number is one less than Jim's ticket number.
J - 1 = M
The product of their numbers is 812
M * J = 812
plus first equation into 2nd
(J - 1) J = 812
J^2 - J - 812 = 0
(J - 29) (J + 28) = 0
J = 29 or -28, 29 cuz you can't have negative for question.
J = 29
plus 29 in first equation,
29 - 1 = M
28 = M
Mary's ticket number is 28 and Jim is 29