# [K (ngn/k)], <s>84</s> 77 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} [Try it online!][TIO-kjxc287s] [K (ngn/k)]: https://bitbucket.org/ngn/k [TIO-kjxc287s]: https://tio.run/##Dco7DoAgDADQsxA/bRFTccSjqHHTEBNd2wBnR9/87vG5nlrPkBp/YGYUhtSusjiODgBljPSC9jH4wUivizPTXnhulARo8yWJ1c5mtIEwm41YnJZ6wt/nqX4 "K (ngn/k) – Try It Online" /ungolfed p:{$[x;,/i,''(x-i)o'y&i:1+!x&y;,!0]} /partitions g:*|(*:)(|!\)/ /gcd l:{x*y%g x,y} /lcm f:{#1_(|/(l/'p/2#x)l')\1} /landau log