Hacker News new | past | comments | ask | show | jobs | submit login
Help me Hack the Lottery or, the worst $90 investment ever (ssikes.com)
78 points by stephensikes on March 23, 2012 | hide | past | favorite | 56 comments



You're making the (probably) false assumption that your lottery is as broken as the Ontario one.

I question your detachment if you are calling gambling an "investment" at all. If you want to win at probability games, look at what any professional gambler does and stick your money down only when you can prove or reasonably expect to see a positive expected value given your odds. That's how basic strategy in blackjack and most of poker math works.

Also, I assumed ticket generation for the simple games was something brute-force-ish akin to:

1. Create your winning tickets. Fill in the rest of the numbers with things that won't cause duplicate wins on the same ticket pseudorandomly.

2. Make a random ticket. Check to make sure the ticket is not solved. If the ticket doesn't solve, add it to the stack of tickets.

Randomly shuffle all tickets. Print to rolls and cut. You could probably even get away with duplicate random "losing" tickets if you had enough of them because most people likely won't end up with the same losing ticket.


Also: Can we really call this a "regressive tax" like the Wired article states? There is no obligation to play the game. You are obligated to pay taxes.

Numbers games (lotteries) are run by governments now because organized crime was running them in inner cities. People still played then. See Wikipedia: http://en.wikipedia.org/wiki/Numbers_game At least the "tax" from lottery proceeds often goes to benefit social goods like public school systems.


Calling state lotteries a regressive tax highlights the irony of the socioeconomic system. The non-lottery-playing cohort tends to have more political control and uses that power (unconsciously, perhaps) to structure the market to induce lottery-playing behavior among the poorer cohort.

In other words, there are varying methods of obligation.


Can I get something to read on this premise? This type of "unconscious influence" stuff reeks of conspiracy theory or an irrelevant conclusion from sociological data. (Not calling you wrong, but I'm skeptical of this conclusion.)


I don't think it is a given that every lottery can be hacked.

I would also like to recommend this PG essay: http://paulgraham.com/wealth.html


These things are rarely about the money itself, but about taking on an established system, questioning it, and finding a way to beat it.



My sister-in-law found a winning bet for the New York Lottery.

There was a special promotion at the racino she goes to -- you could take your loser scratch tickets in a certain game to the casino, they'd put them in a big jar, and then whoever won the drawing got a trip to Las Vegas.

She saw there weren't many tickets in the jar, so she bought about $150 of these scratch tickets (she won $80 back so these only cost her $70) and submitted them. Her mom did about half as many.

A few days later her mom gets a phone call and she won a trip to Las Vegas worth $2000. Then she goes there and does some tricks with her loyalty card and now she's on an $800 junket.

I worked it out with decision theory and found that they had played the raffle almost optimally -- it blew my mind since I figured anyone who messed with scratch tickets and video slots would have to be completely impervious to probability theory.

Raffles, in generally, are good for people who play to win. My family regularly wins multiple prizes when they have raffles at the school because we're smart enough not to put tickets in for the Battleship game all the boys want or the hula-hoop all the girls want.

There's always some prize which is cooler than the muggles think that it is, and I'll walk home with it.

Now, you never see books about "how to win at raffles" because unlike Poker and Stock Trading, there's no motivation to suck in players who are just a little bit worse than you.


http://www.wired.com/wiredscience/2011/07/broken-lotteries/

Here's a great article on lotteries, particularly Cash Winfall. CWF was a particularly broken lottery. In a certain season it was possible to purchase enough tickets (say, $100,000 worth) to (almost) guarantee a profit.

https://en.wikipedia.org/wiki/Massachusetts_Lottery#Cash_Win...


If I remember that article correctly, I think it's arguable as to whether the lottery was "broken". The lottery commission was aware about the increased odds, but they created a higher odds game due to user feedback. Massachusetts still made money off of the game (though a smaller margin than other games).

I would argue that a lottery's goal is to make money while providing entertainment, and not necessarily create an "unbeatable" game.

The game was shut down because public outcry at what the public deemed "unfair" and not because it was losing money.


Changing the odds isn't the same as changing the expected value. Cash Windfall modified the EV of the lower prizes by increasing the value.


You're absolutely right, I misspoke.


In france some lotteries are broken since forever [1], "everybody" knows it, and nobody cares. Friends of bar tenants gets the gains. "La française des jeux" get the overall gains. The general public is generally fucked more than it should.

[1] tickets are not random but comes in batch with nearly constant amount of various outcomes: the seller, who you tipically ask for your gain, can take note of what happened in each batch and predict if its remaining part is worth being buyed by a friend. Very easy.


People who design these games think about security. Sometimes (rarely) exploits get unnoticed and go into production.

I'm confused about why we are supposed to believe that there is anything exploitable about this particular card?


Look at all the horror stories of badly written programs or moronic CEO or things like that.

The other parts of the world are fucked up as well. There are probably a lot of "secure" lotteries, but there are probably also a lot of insecure ones.


(http://www.schneier.com/blog/archives/2008/05/random_number_...)

Even smart people using good software can make mistakes.


I know of only one guaranteed way to win from a lottery: don't play it.


No, the guaranteed way to make money from a lottery is to be the guy selling tickets.


Selling lottery tickets can be a losing proposition. In many states, the vendor has to pay for the whole roll as soon as tickets containing half the prize money have been sold. So if I have a roll of 500 tickets costing $5 each, and the first ticket is a $5000 winner and the rest of the tickets only cumulatively win $4999, then I have to pay for the entire roll even though I've only sold one ticket.


They tell you when that happens? Sounds like something that could be easily abused by collusion among a few shopkeepers.


What a strange system, though I'm sure it makes the Lottery's actuaries a lot happier.


The problem is calling the lottery an investment. To me, at least, it's not. I buy maybe 10 a year, just for the hell of it and the "never know" factor, but I am never pulling my hair out at my so far horrible "investment decisions."

You can look at the $10 as being 2-3 Starbucks coffees


You don't even count. You're not playing the lottery any more than I am by picking up a ticket I found off the street.

Just go to your local grocery store or gas station and stand next to the machine or cash register for just 30 minutes and watch the guys that buy a ticket. They're all regulars. They're all putting their hope (even if they tell themselves they're not) in this ticket being the winning ticket. They're buying 2 or 3 tickets a day which is money that most of them really can't afford to just be throwing away (and these are people that honestly would say they can't afford a Starbucks a day, by and large). It's very sad.


Reminds me that long ago I wanted to start a list of better investments for 1€/$. Can't remember much, but one idea was to write a love letter to a millionaire. Any other ideas?


Honestly the best investment is to set it aside in a penny jar until you have a more reasonable amount that you can make more money with.

Make that $10 instead of $1 and open a "mini mutual fund" that angel invests in high risk things like new companies. $10 per "share", 100 people is a $1000 which isn't too bad of an investment to put into a local computer repair business or something.

I don't know about the legalities of something like this, though.

But if your goal is to get the people buying lottery tickets to buy yours instead, that's not going to happen. If you tell them there's a 1 in 10 chance that their money will be doubled in six months or a 1 in a million chance that they'll win the jackpot overnight, these are people that'll go for the latter every time.


Didn't want people to buy anything from me, just "enlighten" them about lotto.

On the other hand I am not even sure if lotto is really such a bad investment. I know the expected value is negative, but there is a chance to become a millionaire after all. If spending 1$ doesn't hurt you much, might be worth a try?


There's another story you have to read: The luckiest woman on earth: Three ways to win the lottery (http://harpers.org/archive/2011/08/0083561). It's for subscribers only, but it's far more interesting than the Jonah Lehrer piece. It's about a woman who's won the lottery (scratch tickets) 3 or 4 times, winning millions each time.

It's been a while since I read it, but as far as I recall, one of the hypotheses about her good fortune (other than luck and some form of inside information) is that she had analyzed how winning tickets are distributed among batches (by cracking the pseudorandom number generator), and tracking which stores are likely to get packages containing winning tickets by the shipping routes.


I find it disturbing that some poeple find it so hard to belive that it might just be chance. It's way more likely to be that. The serial number on the cards are either generated in series (1, 2, 3 ...) or just pseudorandom, but they are not tied to any winnings, it's just a series of numbers so that they can keep track of what goes where.

If it's a serie of numbers you have to find out what the chances of a winning ticket in X-amount of tickets, meaning that you statistically have a chance of a price within the range of X-amount of tickets. But the way they have made it, you statistically have to spend more money than you can win in order to do so, or just about break even.

Now, the fun part is that most of these tickets (atleast where I live) come with pseudorandom serie numbers, so even finding the system in how the numbers are generated is going to be hard, if not even down-right impossible given the sample-size you will be able to buy.

And last but not least, lottery makers are not stupid. They've known about this since the dawn of time. Actually some credit the math behind statistics to gamblers. And you have so many level of pseudorandomness to crack, so, when you're done, statistically we can say that the lottery made it's money anyway, and you probably spent more than you won. And the lottery agency just have to change one constant and they are, from your point of view, totally random again. It's a cat and mouse game you cannot win.


It would be so trivially easy for them to obfuscate the numbers beyond any reversibility. Seeing the general belief on HN that you can hack any arbitrary lottery with some trivial math is pretty disappointing.


There is something to this. I had to do some training years ago at Alberta Lottery in Canada. Scratch tickets are sold in blocks of $100 (100 x $1, 50 x $2, etc).

We were told that each pack contains at least one winning ticket (it might be $5 or it might be $100K).

That's a definite weakness.


Are you considering doing card counting (enter a shop, watch people buy and scratch cards, and start buying after a large streak of non-winning cards)?

Otherwise, I do not see what that information (if it is true) would give you.


I was working at a place that sold these tickets. If you could keep track of each pack that was sold, you could get to the point where you knew your purchase would be a winner.

Obviously not something a person who didn't have the ability to monitor the purchases could do.


i believe the point is that the there is a pattern to the distribution. we can only safely assume the pattern is on a micro level, but it would suggest there are larger patterns at play.

for instance, is it possible to ship 5 rolls with million dollar winnings to the same store in a week? maybe the answer is yes, but i imagine there's a reason to prevent this. in case it's not clear i am just guessing. i don't really know what i'm talking about.


"but it would suggest there are larger patterns at play."

That, I do not see. If there are some guarantees as to having guaranteed prices per roll, one can see the lottery as the sum of small, per-roll lotteries, possibly combined with a larger one to distribute the truly large prices. There is no reason to assume that those per-roll lotteries will be correlated in some way.


that would definitely be an effective way to exploit the weakness, and if the value of your time is low enough, it would be profitable. A slightly more efficient way to exploit it would be to have the shop owner as a friend and have them tell you when a large non-winning streak has occurred.


Well, there's definitely some that aren't perfect. But how many and which? That's for guys like you to find out.

There are professional "cashers" that have figured out how to hack a small percentile of games in MA. They take advantage of a few things, but if you have $100k you are guaranteed to make a profit. Source: http://www.wired.com/wiredscience/2011/07/broken-lotteries/

Now this guy is a trained statistician from MIT and Stanford and has put math behind it. He figured out the tic tac toe game. Source: http://www.wired.com/magazine/2011/01/ff_lottery/all/1

So as you can see all games aren't entirely fool proof. Good luck!


I remember reading the second wired article in print. I highly recommend it — interesting story, good writing.


You don't want theoretical help. You want real-world help. Hang out at the counter where tickets are sold. You're bound to encounter someone who asks what serial numbers the tickets end in. Take that guy out for a drink and find out what he knows, how he knows it, and if it ever worked for him. I've seen several people ask about the ticket serial numbers and not buy, but scratch-offs aren't my thing, so I didn't bother to pursue it. But there's clearly knowledge out there that people have about this. [typo edit]

Also edited to add: Even ask the dealer. He might know something -- although it'd probably be against the rules for him to say anything, even what he's seen. But maybe he can point you to customers who know.


Could be those people are just superstitious and only want tickets including their lucky number, or something like that.


When I worked at a gas station, it was 50-50 between those with lucky numbers and those with theories about where the prizes fell (i.e. higher tickets were less lucky )


I think you need to look up the regulatory bodies for lotteries. They care a lot about this type of stuff, and making sure there is not statistically predictable pattern (essentially the sample size required to find the pattern would be larger then the number of tickets printed). If you do find a pattern, a lot of people will get into trouble because it was their job to make sure that was not one.


I confess to trying this myself after reading the Srivastava story. If you step back from the fact that it's a lottery, there's plenty of money involved, "what are you a gambling idiot?" etc it's actually a really fun problem to tackle. I picked out a similar style of ticket and for $20 I kept myself entertained doing analysis and testing hypotheses for the better part of a weekend. Sadly I was defeated on this occasion having found no obvious weaknesses. The main thing I learned from it all was that while a single scratch ticket is fun and exciting, 5 or more get very boring very fast. I was groaning every time a 'free ticket' showed up.

(Also: in Australia you usually see the next 4 tickets on the roll behind a clear display, so if you ended up with a good trick, even if it required running a script on your smartphone, you could have fun with it)


Interesting read; I was playing with similar thoughts over my lunch break a couple of days ago.

The base of my sample program [implemented in ruby] was based (in theory) of Proportional Betting "The Martingale" - http://www.bjmath.com/bjmath/progress/prog1.htm

The game I picked was "Casino War" [ http://wizardofodds.com/games/casino-war/ ], as it was very quick to implement in a few lines of code. I selected the base rules as played in Garden City Casino [Bay Area] (50c drop per every $100), and came up with the following:

Game/House Rules: - 6 deck of cards. - Played until 1/2 is gone. - 50c drop for every $100 [Example: $200 bet costs $1, $300 $1.5.]

Betting Rules:

- Base Bet is always 1% of current wallet, at starting point - $10. - If the proportional bet can not be covered by wallet, the round is surrendered and the player waits until re-shuffle. [Example: Lost up to $500, next bet is $1000, wallet has $700, game ends/waits and the player accepts a loss of $300.] - Bets are doubled on loss as defined in the Proportional betting link.

Here's my data, though I believe something is wrong due to its results:

- I ran the initial program, as is, expecting the player to play one round every day for 10 years. - Losses and earnings were added together. - The average win % went to 58.4%. - The average cash win [the times the player didn't go bankrupt] was $1590. - Max loss [consecutive] cash $2980. [Bankroll covered over multiple sessions]

* A key point here is the average cash win. It was highly consistent and never below 1500.

I then added a factor that stated in the software:

- If winnings are at $1500, the player stops, takes the winnings and waits for a re-shuffle.

* Win percentage went up to 64.8% !

If anyone is interested, I'd be happy to share/pastebin the code or similar. Overall, due to the percentages I'm assuming something is wrong with my assumptions/gameplay, but so far an interesting experiment.

[Edited for clarity on betting strategy]


That same site has an interesting article on Martingale betting systems: http://wizardofodds.com/gambling/betting-systems/

IIRC, a martingale strategy will eventually destroy you because it requires an exponentially sustainable bankroll to maintain the same risk of ruin.

Also, 3,650 hands is far too small of a sample size for a game with such a small edge and you are probably just witnessing positive variance. See where the law of large numbers leads you and run your simulation for 500,000 hands.


Yes, Martingale's doesn't raise your expected value above zero/negative for any games of chance. Towards infinity, it won't change your outcome -- you will still eventually loose all your money.

If you factor in the times the player went bankrupt, your win percent probably won't look so hot.


I'll clean up my code a bit and post it on pastebin, there's probably a mistake in my logic somewhere.

Overall; I agree [and having played my share of a variety of strategies] I found the data to be confusing, hence my peaked curiosity. :-)


Though it did (in the simulation). The accumulated winnings with the limits on bankrupt and cashing out at 1500 created a over time win percentage in a otherwise negative-biased game?


By definition, if there is negative expected value, simply changing your betting strategy won't help. Any short term fluctuations would be from "luck".

The famous MIT black jack team was able to 'take down the casino' by counting cards and waiting for expected value to swing positive, and then placing large bets at that time. If the game is truly random and negative (like all well-constructed casino games should be) then there should never been an opportunity for positive expected value.


Note that's 3,650 decks / 28,470 hands (not counting "War" hands).

As it was run twice, it's closer to 56,940. (using two different alg.)

Rerunning it (now) produces minimal differences, even at a 1,000 year setup. (3-5% variation)


Googling gave me http://www.scratchoffcodes.com/ I have no idea how legit it is. Never played, but it would be cool to figure out if there was a system.


Looks like those are for (three character) codes under the revealable area of the card. Kind of like a checksum for what was won.

Based on the comments it looks like the reliability is a little bit sketchy.


Many states publish historical winning numbers from various lottos. No need to buy tickets to do statistical analysis on winning numbers.


Hope you get some traction with that project. Would love to see some math wizards look into that.


Your sample size is ridiculously small. Also, the fact that lottery companies are well and alive contradicts the very theory.


Let's be a little more helpful: the sample size is small relative to the feature space. We even have more variables than observations.

A sample of 43 observations might be reasonable if there were few independent variables and these variables had relatively few possible values.


100 is not a sample set. It is a joke.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: