A fun little probability puzzle for you.

Well go ahead. But here is a proof that requires less programming.

Do you know anybody ever who can say they only ever saw heads on coin flips during their lives?

Surely if you had, they would remember it and make a point about it, and you would remember.

That’s my point, lad. Because you started with 98 blue and 2 red, it is not the same as a situation where it was only ever 2 blue and 2 red.

My software will be built to investigate one specific claim only:

origami wrote
If you flip a coin 3 times and get all heads, the odds of it being heads the 4th time are not 50-50.

I’m not investigating people who have only seen heads, just the question I quoted there.

Is a fair coin more likely to land tails after 3 heads in a row? That’s the question. You think it is. I’ll write something to find out.

If you write it correctly, it will bear me out. That is the entire basis of statistical analysis.

The entire basis of statistical analysis is that, when you get 3 heads in a row, the 4th one is less likely to be heads?

That’s nonsensical. The point I’m trying to make is that the best bet is that they lied about putting any reds there.

Statistics.

Yes, correct.

A well written program should tell you, necessarily with some margin of error, the amount of times out of, say, 1000 where you would expect the coin to land heads on the fourth flip after three heads, and the amount of times you would expect tails. The answer will not be 500.

If you make it 10000 instead of 1000, the margin of error will be smaller.

No it is not (unless you have them prearranged in boxes O:) ).

But you missed the hedge opportunity. I would make more money than you.

You don’t understand statistics if you think an infinite number of heads is possible with an even coin.

Right, that’s my point. The previous repetitions matter.

50 blue and 48 blue plus 2 red is not the same as 2 blue and 2 red.

If this were not true, then the odds on the first flip would not be 50-50.

What 50-50 literally means is 50 times yes and 50 times no in 100 repetitions.

But then the math gets weird because, get this, if you get the same result twice in a given 50-50 repetition, the odds of the third result also being the same are greater than 50-50.

Okay, here’s the software promised.

jsfiddle.net/rp6e8f7v/1/

Flips a coin a million times, and keeps track of how many times in a row it was flipped. Every time it flips 3 in a row, it records the subsequent flip as a “headsAfter3” or a “tailsAfter3”.

Press “run” in the top left to give a run of 1,000,000

But that’s incorrectly written. Those are one million repetitions, not 250000 instances of 4 repetitions.

I have no idea what that means. I don’t remember ever specifying that, because I don’t even know what the hell it could possibly mean. Why is it incorrect because it doesn’t achieve some previously unspecified criteria that I never heard of?

It’s incorrect because we are talking about the odds of the 4th flip after three given flips.

If there were, say 44539 arbitrary flips, that is already a different scenario.

aaab is not the same as aabbababbababababaabaaab

I think I get what you’re asking for, right, okay.

I’ll do it that way. I don’t think it will make a difference, but I’ll do it that way.

When you flip a normal coin, it’s probably a coin that’s been flipped before. So if you flip 3 in a row, it’s not the first 3 flips that coin has ever experienced in its life, it’s part of a really long sequence of flips. It’s very silly that you think this matters.

But I’ll humour you anyway, I like programming.

You need to write one that repeats 250000 times a scenario where 3 heads have been flipped.