I have five stacks of three blocks. I can join two stacks together, or split a stack. How many splits and joins do I need to do to end up with three stacks of five blocks?

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.