That second one is perhaps the most telling.
Oh, but for A|B that "stack everything" is not optimal, of course. What about gcd(A,B)>1, so in the smallest interesting case 4,6? There you can get 4j2s, better than the stack-all 5j3s.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!