["H", "T"] _.map(ONE_FLIP, function(result) { return (SEQUENCE.match(RegExp("(?=" + result + ")", "g")) || []).length }) ["HH", "HT", "TH", "TT"] _.map(TWO_FLIP, function(result) { return (SEQUENCE.match(RegExp("(?=" + result + ")", "g")) || []).length }) ['HHH','HHT','THH','HTH','THT','HTT','TTH','TTT'] _.map(THREE_FLIP, function(result) { return (SEQUENCE.match(RegExp("(?=" + result + ")", "g")) || []).length }) [ $._("Fair coin"), $._("Unfair coin"), $._("Human guesses") ]

Which method was used to generate this sequence of heads and tails?

H
T
init({ range: [[0, 15], [0, 6]], scale: [31, 54] }); label([8, 6], "H vs T", "below", false).css({ "font-size": "16px", "color": "#444444" }); style({ "stroke": "#cccccc", "stroke-width": 1 }, function() { _(5).times(function(i) { line([0.2, i + (54.5 / 54)], [15.8, i + (54.5 / 54)]); }); }); _.each(ONE_FLIP, function(caption, n) { label([8 * n + 4, 1], caption, "below", false).css({ "font-size": "13px", "color": "#444444" }); }); style({ fill: "#a6a6a6", strokeWidth: 0 }, function() { rect(2, 1, 4, ONE_FLIP_RESULT[0] / SEQUENCE.length * 5); }); style({ fill: "#595959", strokeWidth: 0 }, function() { rect(10, 1, 4, ONE_FLIP_RESULT[1] / SEQUENCE.length * 5); });
init({ range: [[0, 16], [0, 6]], scale: [31, 54] }); label([8, 6], $._("Two-flip streaks"), "below", false).css({ "font-size": "16px", "color": "#444444" }); style({ "stroke": "#cccccc", "stroke-width": 1 }, function() { _(5).times(function(i) { line([0.2, i + (54.5 / 54)], [15.8, i + (54.5 / 54)]); }); }); _.each(TWO_FLIP, function(caption, n) { label([4 * n + 2, 1], caption, "below", false).css({ "font-size": "13px", "color": "#444444" }); }); style({ fill: "#808080", strokeWidth: 0 }, function() { _.each(TWO_FLIP_RESULT, function(count, n) { rect(4 * n + 1, 1, 2, count / SEQUENCE.length * 7); }); });
init({ range: [[0, 16], [0, 6]], scale: [31, 54] }); label([8, 6], $._("Three-flip streaks"), "below", false).css({ "font-size": "16px", "color": "#444444" }); style({ "stroke": "#cccccc", "stroke-width": 1 }, function() { _(5).times(function(i) { line([0.2, i + (54.5 / 54)], [15.8, i + (54.5 / 54)]); }); }); _.each(THREE_FLIP, function(caption, n) { label([2 * n + 1, 1], caption, "below", false).css({ "font-size": "13px", "color": "#444444" }); }); style({ fill: "#808080", strokeWidth: 0 }, function() { _.each(THREE_FLIP_RESULT, function(count, n) { rect(2 * n + 0.5, 1, 1, count / SEQUENCE.length * 9); }); });

View patterns: Coin flips | H vs T | Two-flip streaks | Three-flip streaks

Khan.scratchpad.disable(); $('.pattern-tabs a').on('click', function(e) { var $el = $(e.currentTarget); $('.pattern-tabs a').removeClass("selected"); $el.addClass("selected"); var charts = $('#coin-flip-sequence-charts'); var offset = $el.data("offset") * -1 * 496; charts.animate({marginLeft: offset}); return false; });

CHOICES[SOLUTION]

randFromArray(["H", "T"], 276).join("") (SEQUENCE.match(/H/g) || []).length
0
randFromArray(randFromArray([ ["H", "H", "H", "T", "T"], ["H", "H", "T", "T", "T"] ]), 276).join("") 1
randFromArray([ "HTHHTHTHTHTHTHHHTHTHTHTHHHHTHTTHHTHHTHTHTHTHTH" + "HTHTHTHTHTHTHHHTHTHTHTHHTHTHTTTHHTHHTHTHHHTHHT" + "HTHTHHHTHHTTTHHTHHTHTHTHTHTTHHHTHTHHTHHTHTHTHT" + "HTHTHTHTHHTHTHTHHHHTTTHTHTTHTHTHHHTHTHTTTHTHHT" + "HTTTHTHTHTHTHTHTHTHTTHTHTHTHTHHHHTTHTHTTHTHTTT" + "HTHTHTHHTTHTHTHTHTHTHTHTHTHTHTHTHTHHTHTHTHTTHT", "HHHTTTHTTTHTHHHHTHTTHTHTHTHHHTHTTTHTHHTHTHTHTH" + "HHHTTTTHTHTHHTHHHHTHHTTHTHTTTTHTHTHTHHTTTHTHTH" + "THHTTHTHTHHTHTHTHTHHTHHTHHTHHTHHTTTHTHTHTHHTHT" + "HHHTTTTHTHHTTHTTTHTHTHHHTHTHTHTHTHTHHHTHTHTHHT" + "HHTTTHHTHTHHTHTHTHTHTTTHTHTHHHTHHTTHTHHTHTTHHH" + "THTHHTHHTHTHTHHTHTHHHHTHTHTHHTHHTHHTTTHHTHTHHH", "HHHTHTTTHTHHHTHTHTHTTTTHTHHTHHHTHHTHHHTTTHHHTT" + "HHTHHHTTTTHTHTHTTHTHHHHTHTHHTHHTHTTHTHTTHTTHHT" + "TTHTHHHTHTHTHTHTHTTHTHHTHTHHHHTTHTHTHHTHHTHTTT" + "THHHTHTTHHHHTTHTHHTHTHTHTHHTHTHTHHTHTHTHTTHHHH" + "HTTHHTTHTTHTHHTTHTHTTTHTHTHTTHTHTHHHHHTTHTHTHT" + "THTHTHHTHTHTHTHHHTHTTHTHTHTHTHHTHTHTTTTHTHHTTH" ]) 2