Hacker News new | ask | show | jobs
by eihli 1878 days ago
Can you please share how you got the 2^40 number? I've been trying to think of how to figure out the odds of these.

Odds of 4 hex 8's in a row given a 4 digit string is (1/16)^4.

Odds of 4 hex 8's in a row given a 5 digit string is number of ways to arrange 8s in the first 4 digits (1) times 16 possible 5th digits plus number of ways to arrange 8s in the last 4 digits (1) times 16 possible 1st digits, all divided by the number of possible arrangements (16^5)

So 8888X or X8888 is (2 * 16) / (16^5)?

And then 8888XX or X8888X or XX8888 is...

(16^2 + 16^2 + 16^2) / (16^6) ???

1 comments

I did 10 8's (mythic!) at the beggining of the hash (2^4)^10 = 2^40.

I didnt account they could start at any position, so the actual number is probably

(64-10)/2^40 ≈ 1 / 2^35

We should also subtract strings longer than 10 that were double counted. However i think the probability of such things is negligible relative to 2^35.

If instead we were doing 4 8's i think it would be: (64-4)/((2^4)^4) = 60/2^16 ≈ 2^10

I've always been bad at calc probabilities so i may have messed this up.

> Odds of 4 hex 8's in a row given a 5 digit string is number of ways to arrange 8s in the first 4 digits (1) times 16 possible 5th digits plus number of ways to arrange 8s in the last 4 digits (1) times 16 possible 1st digits, all divided by the number of possible arrangements (16^5)

You're double counting "88888". But then again so am i.