# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
164 lines (142 sloc) 7.18 KB
 Divisibility intuition
randRange(4, 20) getFactors(NUMBER)

What are the positive factors of NUMBER?

You can resize this box with NUMBER dots to help you find the factors:

init({ range: [[-3, NUMBER + 3], [-NUMBER - 3, 3]], scale: [20, 20] }); addMouseLayer(); graph.width = NUMBER; graph.height = 1; graph.set = bogusShape; graph.handle = bogusShape; graph.topLabel = bogusShape; graph.leftLabel = bogusShape; graph.redraw = function() { graph.set.remove(); graph.topLabel.remove(); graph.leftLabel.remove(); graph.height = ceil(NUMBER / graph.width); init({ range: [[-3, graph.width + 3], [-graph.height - 2, 3]], scale: [20, 20] }); graph.set = raphael.set(); graph.set.push(path([ [-1, 1], [graph.width, 1], [graph.width, -graph.height], [-1, -graph.height], [-1, 1], [1, 1]],{ stroke: BLUE, opacity: 1.0 })); _(NUMBER).times(function(i) { graph.set.push(circle([i % graph.width, -floor(i / graph.width)], 0.25, { stroke: BLUE, fill: BLUE, opacity: 0.6 })); }); graph.handle.translate( graph.width * 20 - graph.handle[0].attr("translation").x, graph.height * 10 - graph.handle[0].attr("translation").y); graph.topLabel = label([graph.width / 2 - 0.5, 1], graph.width, "above"); graph.leftLabel = label([-1, -graph.height / 2 + 0.5], graph.height, "left"); }; graph.dragHandle = addMovablePoint({ coord: [graph.width, -graph.height / 2 + 0.5], constraints: { constrainY: true }, snapX: 1, onMove: function(x, y) { graph.width = min(max(x, 1), NUMBER); graph.redraw(); return [graph.width, -graph.height / 2 + 0.5]; } }); graph.handle = raphael.set(); graph.handle.push(line( [-0.12, 0], [-0.12, 1], { stroke: BLUE, opacity: 1.0 })); graph.handle.push(line( [0.12, 0], [0.12, 1], { stroke: BLUE, opacity: 1.0 })); graph.dragHandle.visibleShape.remove(); graph.dragHandle.mouseTarget.attr({ scale: 2.0 }); var \$mouseTarget = \$(graph.dragHandle.mouseTarget.getMouseTarget()); \$mouseTarget.bind("vmouseover", function(event) { graph.handle.animate({ scale: 1.5, stroke: BLUE }, 50); }); \$mouseTarget.bind("vmouseout", function(event) { graph.handle.animate({ scale: 1.0, stroke: BLUE }, 50); }); graph.redraw();
FACTOR

Enter all the different factors you can find (one factor per box):

The NUMBER dots can be arranged in NUMBER / FACTOR row. The NUMBER dots can be arranged in NUMBER / FACTOR rows. Each row has FACTOR dot each, so \pink{NUMBER / FACTOR} is a factor of NUMBER: Each row has FACTOR dots each, so \pink{NUMBER / FACTOR} is a factor of NUMBER:

graph.width = FACTOR; graph.height = ceil(NUMBER / graph.width); init({ range: [[-3, graph.width + 3], [-graph.height - 2, 3]], scale: [7, 7] }); graph.set = raphael.set(); graph.set.push(path([ [-1, 1], [graph.width, 1], [graph.width, -graph.height], [-1, -graph.height], [-1, 1], [1, 1]],{ stroke: BLUE, opacity: 1.0 })); _(NUMBER).times(function(i) { graph.set.push(circle([i % graph.width, -floor(i / graph.width)], 0.25, { stroke: BLUE, fill: BLUE, opacity: 0.6 })); });

The positive factors of NUMBER are toSentenceTex(FACTORS.reverse(), function(){return true;}, "hint_pink").