K (ngn/k)K (ngn/k), 84 7778 bytes
-4 thanks to @Bubbler
{#1_(|/(x/'{$[x;,/i,''(x-i)o'y&i:1+!x&y;,!0]}/2#y)x')\1}{x*y%*|_x*y%*|(*:)(|!\)/x,y}
/ungolfed
p:{$[x;,/i,''(x-i)o'y&i:1+!x&y;,!0]} /partitions
g:*|(*:)(|!\)/ /gcd
l:{x*y%g_x*y%g x,y} /lcm
f:{#1_(|/(l/'p/2#x)l')\1} /landau log