I'm not the expert on this, but they aren't really doing any math, they are just guessing numbers until they get the right number.
My understanding is that a number between say 0-100, when plugged in solves the hash. Whoever can find the number first solves the block. The difficulty adjustment increases or decreases the range.