randRangeWeighted( 3, 8, 1, 1 / 6 ) D_PARENT === 1 ? randRange( 1, 2 ) : randRange( D_PARENT + 1, 2 * D_PARENT - 1 ) N_PARENT / D_PARENT randRange( 3, 8 ) randRange( 3, 8 ) randRangeExclude( 2, 2 * D_OFFSPRING_1 - 1, [ D_OFFSPRING_1 ] ) randRangeExclude( 2, 2 * D_OFFSPRING_2 - 1, [ D_OFFSPRING_2 ] ) N_PARENT * getLCM(D_OFFSPRING_1, D_OFFSPRING_2) / D_PARENT
D_PARENT === 1 ? N_PARENT : mixedOrImproper( N_PARENT, D_PARENT ) mixedOrImproper( N_OFFSPRING_1, D_OFFSPRING_1 ) mixedOrImproper( N_OFFSPRING_2, D_OFFSPRING_2 ) N_OFFSPRING_1 / D_OFFSPRING_1 N_OFFSPRING_2 / D_OFFSPRING_2 OFFSPRING_1 / PARENT OFFSPRING_2 / PARENT getLCM( D_OFFSPRING_1, D_OFFSPRING_2 )

The starting block below is CODE_PARENT units long. Use the tools to the right to convert the starting block into both of the goal blocks that are CODE_OFFSPRING_1 units long and CODE_OFFSPRING_2 units long. You can see your progress as the current blocks.

Starting Block:

initSliceClone([ "current_block_1", "current_block_2" ]); init({ range: [ [ 0, 1 ], [ 0, 1 ] ],scale: [ 600, 25 ] }); rectchart( [ 1, 0 ], [ "#e00", "#999" ] );

Current Block 1:

init({ range: [ [ 0, 1 ], [ 0, 1 ] ],scale: [ 600, 25 ] }); rectchart( [ 1, 0 ], [ "#e00", "#999" ] );

Goal Block 1:

init({ range: [ [ 0, 1 ], [ 0, 1 ] ],scale: [ 600 * ANSWER_1, 25 ] }); rectchart( [ 1, 0 ], [ BLUE, "#999" ] );

Current Block 2:

init({ range: [ [ 0, 1 ], [ 0, 1 ] ],scale: [ 600, 25 ] }); rectchart( [ 1, 0 ], [ "#e00", "#999" ] );

Goal Block 2:

init({ range: [ [ 0, 1 ], [ 0, 1 ] ],scale: [ 600 * ANSWER_2, 25 ] }); rectchart( [ 1, 0 ], [ ORANGE, "#999" ] );
Cut Starting Block into 1 piece
Copy Current Block 1 1 time
Copy Current Block 2 1 time

The goal block 1 of length CODE_OFFSPRING_1 units can be rewritten as fraction( N_OFFSPRING_1, D_OFFSPRING_1 ).

The goal block 1 of length CODE_OFFSPRING_2 units can be rewritten as fraction( N_OFFSPRING_2, D_OFFSPRING_2 ).

Cutting the starting block into x pieces is the same as dividing it by x.

We want to cut the starting block into a piece that can be copied into both goal block 1 and goal block 2.

A

The least common denominator of D_OFFSPRING_1 and D_OFFSPRING_2 (the denominators of the goal blocks) is LCM. Therefore you can copy a block \dfrac{1}{LCM} units long to make both goal blocks.

To find the number of slices to cut the starting block into we solve for s in the following equation:

CODE_PARENT ÷ s = \dfrac{1}{LCM}

CODE_PARENT = \dfrac{1}{LCM}s

CODE_PARENT \cdot LCM = s

s = SLICES

We now have a resulting block that is \dfrac{1}{LCM} units long. Now we simply divide our goal blocks by this value to see how many times we need to copy the resulting block.

\color{BLUE}{c1 = \dfrac{N_OFFSPRING_1}{D_OFFSPRING_1} ÷ \dfrac{1}{LCM} = \dfrac{N_OFFSPRING_1}{D_OFFSPRING_1} \cdot LCM = N_OFFSPRING_1 * LCM / D_OFFSPRING_1}

\color{ORANGE}{c2 = \dfrac{N_OFFSPRING_2}{D_OFFSPRING_2} ÷ \dfrac{1}{LCM} = \dfrac{N_OFFSPRING_2}{D_OFFSPRING_2} \cdot LCM = N_OFFSPRING_2 * LCM / D_OFFSPRING_2}

Therefore the solution is to cut the starting block into SLICES pieces, copy current block 1 N_OFFSPRING_1 * LCM / D_OFFSPRING_1 times and current block 2 N_OFFSPRING_2 * LCM / D_OFFSPRING_2 times.