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) LCM / D_PARENT LCM / D_OFFSPRING_1 LCM / D_OFFSPRING_2 new Plural(function(n) { return $.ngettext("unit", "units", n); })

The starting block below is `CODE_PARENT` unit long. The starting block below is `CODE_PARENT` units long. Use the tools below to convert the starting block into both of the goal blocks that are `CODE_OFFSPRING_1` units long and `CODE_OFFSPRING_2` units long. The current blocks show your progress.

Starting Block:

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

Current Block 1:

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

Goal Block 1:

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

Current Block 2:

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

Goal Block 2:

init({range: [[0, 1], [0, 1]], scale: [500 * 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
[pieces, times['current_block_1'], times['current_block_2']]
var guess1 = roundTo(3, guess[1] / guess[0]), guess2 = roundTo(3, guess[2] / guess[0]), answer1 = roundTo(3, ANSWER_1); answer2 = roundTo(3, ANSWER_2); return guess1 === answer1 && guess2 === answer2;
pieces = guess[0]; times['current_block_1'] = guess[1]; times['current_block_2'] = guess[2]; updateGraphAndAnswer();
guess = guess.length ? guess : [1, 1, 1]; $('#pieces').text(plural(guess[0], 'piece')); $('#current_block_1_times').text(plural(guess[1], 'time')); $('#current_block_2_times').text(plural(guess[2], 'time'));

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

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.

The starting block has a length of `CODE_PARENT`, which can be rewritten as:

`\qquadfraction(D_PARENT, D_PARENT) + fraction(N_PARENT - D_PARENT, D_PARENT) = fraction(N_PARENT, D_PARENT)`

We can rewrite the starting block length in terms of `\dfrac{1}{LCM}` units:

`\qquad fraction(N_PARENT, D_PARENT) \times fraction(PARENT_MULTI, PARENT_MULTI) = fraction(SLICES, LCM)`

If we cut the starting block into `SLICES` equal pieces, each piece will have a length of `fraction(1, LCM)` units.

Goal block 1 has a length of `CODE_OFFSPRING_1` units, which can be rewritten as:

`\qquadfraction(D_OFFSPRING_1, D_OFFSPRING_1) + fraction(N_OFFSPRING_1 - D_OFFSPRING_1, D_OFFSPRING_1) = fraction(N_OFFSPRING_1, D_OFFSPRING_1)`

We can rewrite the goal block 1 length in terms of `\dfrac{1}{LCM}` units:

`\qquad fraction(N_OFFSPRING_1, D_OFFSPRING_1) \times fraction(OFFSPRING_1_MULTI, OFFSPRING_1_MULTI) = fraction(OFFSPRING_1_MULTI * N_OFFSPRING_1, LCM)`

If we copy a piece of length `\dfrac{1}{LCM}` units `OFFSPRING_1_MULTI * N_OFFSPRING_1` times we get `fraction(OFFSPRING_1_MULTI * N_OFFSPRING_1, LCM)` units, which is the length of goal block 1.

We can rewrite the goal block 2 length in terms of `\dfrac{1}{LCM}` units:

`\qquad fraction(N_OFFSPRING_2, D_OFFSPRING_2) \times fraction(OFFSPRING_2_MULTI, OFFSPRING_2_MULTI) = fraction(OFFSPRING_2_MULTI * N_OFFSPRING_2, LCM)`

If we copy a piece of length `\dfrac{1}{LCM}` units `OFFSPRING_2_MULTI * N_OFFSPRING_2` times we get `fraction(OFFSPRING_2_MULTI * N_OFFSPRING_2, LCM)` units, which is the length of goal block 2.

Therefore the solution is to cut the starting block into `SLICES` pieces, copy current block 1 `OFFSPRING_1_MULTI * N_OFFSPRING_1` times and current block 2 `OFFSPRING_2_MULTI * N_OFFSPRING_2` times.