In keeping with my expectations of a Harlequin Romance novel, Christmas at Cardwell Ranch does have an improbable love affair, between a modernday cowboy and a female mathematician. However, this one also happens to be a murder mystery.
Math professor Lily McCabe helps Tag Cardwell decipher a coded message that turns out to be connected to a murder. When they first meet, he thinks the message is just made up of random letters and is surprised that she counted the letters:
(quoted from Christmas at Cardwell Ranch )
"Sorry, it just seems odd to me that you'd count them."
Lily tried not to let his comment annoy her. "I'm a mathematician. I tend to count things."
His dark eyes widened. "A mathematician?"
She could tell he was fighting a grin, hoping she was joking. "I teach math at Montana State University," she said simply. Lily had seen too many men's eyes glaze over when she'd tried to explain her love of mathematics or how important it was for solving economic, scientific, engineering and business problems. Few people realized they used math in so many ways in their daily lives. Nor did they care, for that matter.

Despite being pretty smart, Lily is appears to be mathematically inferior to her exlover Gerald, without whom it seems she could not have deciphered the message:
(quoted from Christmas at Cardwell Ranch )
As she watched Gerald work, she saw that she'd been right. There were two lists of names. It amazed her how quickly he filled in the names. She had to give him credit. Gerald really was a master at this sort of thing.

(Or, maybe he was able to decode the message so quickly because he already knew what it said (wink wink) . . . )
Unfortunately, the tiny bit of mathematical cryptography that appears in the story is pretty lame (some frequency analysis and a substitution code). 