# HP Forums

Full Version: 71B - Your chances of winning the lottery
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

When the California lottery started one of the local news guys said "Your chance of winning is about the same as flipping a coin the same way 25 times in a row" Hmmm How many flips might that be?

10 DELAY.1

20 DESTROY ALL

30 H=0 @ T=0 @ R=0 @ M=0 @ N = RND > RND

40 'NEQ':R=0 @ X = FLAG(0,NOT FLAG(0))

50 'THROW':L=N @ N = RND > RND

60 IF N THEN H=H+1 ELSE T=T+1

70 IF N<>L THEN GOTO 'NEQ'

80 R=R+1 @ DISP M;H+T;INT(100*R/M)

90 IF R>M THEN M=R @ DISP M;H+T

100 IF M<25 THEN GOTO 'THROW'

110 DISP H/T;H+T;H;T @ STOP

You will probably need fresh batteries for this one :^) I have not been able to let it run to completion yet.. I keep needing my 71 for other things.

I am accepting ideas for stuff to write...

Edited: 24 Sept 2007, 3:04 p.m.

Here is a faster version:

```10 DISP .5^25
```

If you flip a coin 25 times in a row, then you flip it 25 times.

On the other hand if you want to calculate the odds of flipping a coin and it comes up Heads 25 times in a row, then it is simply

1 in 2^25 = about 1 in 33.55 million. If you want to calculate the odds of flipping a coin and it coming up the same 25 times in a row, then it would be 1 in 2^24 or about 1 in 16.78 million.

Any Help?

I'm sure you've all heard this one before...

Your odds of winning the lottery are the same,
whether or not you buy a ticket.

Ren

dona nobis pacem

Ren,

I look at it this way. The chance of me keeping my lottery money is 99.999999999999999999999999999999999%. If I do this many many times over many many years, the total savings come out to winning a small lottery ... at a near 100%!!!

Namir