Skip to content
fx-blog

I Built a Lottery App That Refuses to Predict the Jackpot

Hot numbers and AI predictions promise a jackpot edge that does not exist. vietlott-lab computes Vietlott odds exactly, picks tickets that win any prize more often (23.01% against 22.06% for ten Mega tickets), and says on the pick screen that no pick changes the jackpot odds.

Harry4 min readBeginner
  • Judgment
MarkdownSave

Key takeaways

  • No choice of numbers changes the jackpot odds: ten distinct Mega 6/45 tickets win it 1 time in 814,506, whichever ten they are.
  • Tickets that overlap less win some prize more often: 23.01% for ten picked Mega tickets against 22.06% for ten random ones.
  • The odds are exact: the engine scores a ticket set against all 8.1 million possible Mega draws, as bitmasks.
  • Over 1,274 past Mega draws the six hottest numbers matched 0.794 per draw, against 0.800 for any fixed six.
  • Each tool in the Built with AI series has an honesty line: the thing it says plainly it cannot do, held by a test or a screen.
Contents

TL;DR Hot numbers and "AI predictions" promise an edge on the jackpot that does not exist, and at the minimum jackpot a ticket still loses about 73% of its price on average. vietlott-lab computes Vietlott lottery odds exactly, picks tickets that win some prize more often (23.01% against 22.06% for ten random Mega 6/45 tickets), and prints beside them that the jackpot odds are the same for any ten.

Do this: run vlott pick mega 10 and read the jackpot line before the percentage above it.

Which ten Mega 6/45 tickets give you the best shot at the jackpot? Any ten. Ten distinct tickets win it with probability 10 in 8,145,060, whichever ten they hold.

So vietlott-lab, a Python CLI with a VS Code panel for Vietnam's Vietlott games, says that on the screen where you pick. Then it improves the one thing a pick can improve.

Built with AI, five tools built with an AI coding agent, one post each:

  1. I Built a Lottery App That Refuses to Predict the Jackpot (you are here): exact odds.
  2. A Spider Crawls Over My Screen and Remembers What It Read: a searchable screen log.
  3. An AI Meeting Assistant That Never Hears the Audio: answers from captions.
  4. One Skill Folder That Works in Every Coding Agent: rules every agent reads.
  5. An LLM Proxy That Retries a 429 Before Your Client Sees It: rate limits, in the open.

Not covered: prompting and model choice.

Every tool in this series has an honesty line

You can read each of the five the same way:

  1. Input: a real problem, and one honesty line: the thing the tool must say plainly it cannot do.
  2. Process: an AI coding agent writes the code. A test that can fail, or the screen itself, holds the line.
  3. Output: a tool that states its limit where you will see it, and a repo you can clone.

For vietlott-lab it is short. No pick changes the jackpot odds.

What ten tickets can buy

Less overlap. Two tickets that share four numbers tend to win on the same draws, so vlott pick searches for the set of N tickets most likely to win any prize:

textvlott pick mega 10 --seed 3 (excerpt)
  P(at least one ticket wins any prize): 23.01%  (exact)
  same count of random tickets:          22.06%
  P(Jackpot):  1 in 814,506  -- the same for ANY 10 distinct tickets
  expected return: 26,960 VND   expected loss: 73,040 VND

The Pick tab in VS Code: ten Mega tickets, 23.0% to win any prize, jackpot odds of 1 in 814,506 for any ten, and the expected loss

Exact means every possible draw

The engine scores your tickets against all 8.1 million Mega draws, or 29 million for Power 6/55. No simulation.

How vietlott-lab works: the VS Code panel runs the Python CLI with --json, which checks every possible draw as bitmasks

Tickets and draws are bitmasks, so matches are popcount(ticket & draw), run by numpy over every draw at once. The VS Code panel only runs vlott --json, so every number on screen comes from the tested Python code.

The hot-number test was allowed to fail

Hot numbers are the oldest promised edge. Before each of 1,274 past Mega draws, vlott stats takes the six numbers drawn most so far and counts how many the draw contained:

Pick Matches per draw
Six hottest so far 0.794
Any fixed six 0.800
Six coldest so far 0.813

Across 1,374 draws the frequency test gives p = 0.88: no evidence of bias.

The Stats tab: draw counts over 1,374 Mega draws, a bias test with p = 0.88, and hot numbers matching 0.79 against 0.81 for cold

Try it

Python 3.10 or later:

Try it
git clone https://gitlab.com/agentic-fx/vietlott-lab.git
cd vietlott-lab
python -m venv .venv
.venv\Scripts\activate          # macOS/Linux: source .venv/bin/activate
pip install -e ".[dev]"
vlott fetch all
vlott pick mega 10

Limits: history comes from a public mirror (vietlott.vn refuses connections from outside Vietnam), and the prize tables in games.py need checking against vietlott.vn. Play only with money you can afford to lose.

Every draw checked, and the jackpot line printed beside the pick: that is the part to look for in any odds tool. The honesty line held because every number came from my own CLI. Part 2 starts from input I don't control: whatever is on my screen. When an AI reads it, what may leave the PC, and how would you know?

Read this with your AI

textPaste into your AI
Read the post "I Built a Lottery App That Refuses to Predict the Jackpot".
1. Explain in 3 bullets why tickets that overlap less raise
   P(win any prize) but not P(jackpot).
2. Ask me 2 questions to check I understood expected value; wait, then correct me.
3. Name the honesty line of a tool I use, and what in it could fail.

FAQ

Can vietlott-lab predict the next Vietlott draw?

No. Every draw is independent and every combination is equally likely. The app says so, and tests hot and cold numbers on past draws to show they do not help.

What does the ticket picker improve, then?

The chance that at least one of your tickets wins some prize, by making the tickets overlap as little as possible. The jackpot odds and the expected loss stay the same.

When does a Vietlott ticket break even?

For Mega 6/45, only at a jackpot of about 78 billion VND, and that ignores sharing the jackpot. At the minimum jackpot, ten tickets costing 100,000 VND return 26,960 VND on average.

Sources

  1. vietlott-lab on GitLab
  2. Historical draw data: vietvudanh/vietlott-data

Was this useful?

Only you and the owner see your answer and rating. Send private feedback

Enjoyed it? Support fx-blog with a coffee.

Comments

Oldest first

No comments yet. Start the conversation.

You sign in first; what you typed stays here. · 0 / 2,000