The harmonicity of the ratio P/Q is given by the following formula: h(P/Q) = sgn( x(P)-x(Q) ) / ( x(P) + x(Q) ).
The x(X)'s are indigestibilities. The sgn function equals +1 when x(P) is larger than x(Q), and -1 if x(Q) is greater. The ratio P/Q should be in lowest terms to avoid having to use correction factors.
(See also Chapter 5 [of Divisions of the Tetrachord] and Barlow, 1987.)