
Help me Hack the Lottery or, the worst $90 investment ever - stephensikes
http://ssikes.com/post/19800951554/hack-the-lottery-or-the-worst-90-investment-ever
======
nullflux
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.

~~~
nullflux
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.

~~~
msellout
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.

~~~
nullflux
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.)

------
Tichy
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>

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

------
PaulHoule
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.

------
shocks
<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...](https://en.wikipedia.org/wiki/Massachusetts_Lottery#Cash_Winfall)

~~~
EvanKelly
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.

~~~
joezydeco
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.

~~~
EvanKelly
You're absolutely right, I misspoke.

------
nooop
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.

------
starfox
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?

~~~
nooop
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.

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

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

~~~
colindowling
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.

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

------
pron
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.

~~~
vegardx
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.

~~~
esrauch
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.

------
joshmlewis
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!

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

------
mikecane
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.

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

~~~
mitchellhislop
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 )

------
Rhapso
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.

------
flashingleds
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)

------
noal
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]

~~~
nullflux
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.

~~~
mckilljoy
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.

~~~
noal
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?

~~~
mckilljoy
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.

------
K2h
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.

~~~
barefoot
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.

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

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

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

~~~
msellout
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.

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

