At a minimum, to identify an appropriate UTM zone you need the latitude and longitude of the "principal meridian" and the range east or west. Such information designates a north-south strip of nominal 6 mile by 6 mile squares whose lower left corners are displaced from the meridian's origin by 6 miles east-west for each range.
The code will have to obtain the coordinates of the meridians from some data source: these values cannot be determined by an algorithm (unless possibly some special kinds of meridians are involved: the question does not provide any information about this).
The formulas are simple, once you equate one degree of longitude with 111.2 * cos(latitude) km and recall that 1 mile is close to 1.609 km. With this information you can obtain the longitudes spanned by the quadrant in question and recalling that the UTM zones are 6 degree gores starting with the first at -180..-174 and moving positively around the earth, numbered starting with 1.
This suggests the following pseudocode, which uses the longitude of a quadrant's center to decide on the UTM zone.
function UTMZone(lat, lon, range, ew) {
# (lat, lon) is the location of the central meridian
# range is a positive integer
# ew is an east-west designation for ranges
if (ew = east) then r = range - 1/2 else r = 1/2 - range
longitude = lon + r * 6 * 1.609 / (111.2 * cos(lat))
return round( (longitude + 183)/6 )
}
For example, consider range 9E relative to the Navaho meridian at (35.748889, -108.533056). The center lies 9-1/2 = 8.5 quadrants east of the meridian. That's 8.5 * 6 = 51 miles. At this latitude, with cosine equal to 0.8115853, there are 111.2 * 0.811585 / 1.609 = 56.08965 miles per degree east-west. Converting those 51 miles to degrees gives 0.9093 degrees, which are added to the longitude of -108.533 to give -107.624 degrees. That's just within UTM zone 13, which extends from -108 to -102 degrees.
We needn't be too fussy about the calculations because sectioning the earth into a perfect square grid doesn't work; the earth isn't flat. Something has to give, and this can be seen in slight slippages of the quadrants relative to each other and tiny adjustments in their sizes. Thus all such calculations are at best approximate. But they should almost always be within about 0.01 degree accuracy, which is fine for deciding on the UTM zone.
It's worth remembering that these zones were designed to extend over 7 degrees, overlapping each other by one full degree at either end, so that it shouldn't be important to identify "the" zone when a quadrant is close to the nominal boundary: there's about five ranges worth of "wiggle room" to work with.