This page represents musings and explorative thoughts on algorithms and code to predict lottery numbers, based on analysis of past winning numbers.
DO NOT take ANY of this seriously!!!! This is JUST FOR FUN!!!! These algorighms should NEVER be used to actually pick lottery numbers!!! You'd be better off using family birthdays!
The ONLY useful content of these musing is the demonstration of how to use ChatGPT prompts to help generate sample code (either in Perl or Python).
We've all had those days:
"I *REALLY* want to quit my job!", or:
"I *REALLY* want to RETIRE!", which is quickly followed by:
"But I don't have enough savings." <heavy sigh>, followed by:
"If I could only win the lottery..."
Unfortunately, lottery quick pick numbers seem to have worse than random odds. You might as well give the money away, and hope it somehow benefits someone.
But would it be possible to put some thought into picking numbers.
Some lottery games even pay if you get some, but not all, numbers.
If you could at least rule out numbers that are unlikely to show up on the next pick, then you'd at least be better off than picking completely random numbers.
The Texas Lottery maintains a web site that allows unlikely to match the previous set of numbers (or probably ANY prior winning set of numbers.
However - if you look at winning number sets, there are some counter-intuitive occurrences:
There are often cases where one or more numbers are in a sequence (i.e. 32, 33 or 45, 47).
There are often cases where a picked number happens to be in the last set of winning numbers.
Statistically, all numbers are equally likely.
If one was to attempt to write a program to generate (probably not winning) lottery numbers, this program would need routines to:
Pick a series of random numbers from 0 or 1 to (whatever the max number is).
The set of numbers cannot pick the same number more than once.
It would be helpful to have a weighting value for each valid number that can be picked.
For any kind of prior number analysis, a routine is needed to read in the CSV file of prior winning number sets. Additional analysis subroutines might look for:
Prior instances of number sequences.
Prior instances of repeated numbers.
6 numbers
Numbers picked from 1 to 54
Each pick set costs $1
For an additional dollar, NON-JACKPOT prizes are increased up to $10,000. This might be helpful for cases where we assume that we might use numerical analysis to help pick "more likely" sets - but that the odds of hitting a jackpot are still ridiculously remote. In a recent pick:
Odds of winning and associated winnings:
6 of 6> 1:25,827,165
5 of 6 > 1:89,678 Prize: $2000+ With Bonus: base prize + $10,000
4 of 6 > 1:1526 Prize: $50+ With Bonus: base prize + $100
3 of 6 > 1:75 Prize: $3 With Bonus: base prize + $10
2 of 6 > (low) No prize, With Bonus: $2
Observation - if at least 2 numbers match, you at least break even on the ticket price.
Prizes from 12/3/25:
6 of 6: $6.75M (no winners)
5 of 6: $1798 (8 winners); With Extra: $11798 (3 winners)
4 of 6: $45 (465 winners); With Extra: $145 (182 winners)
3 of 6: $3 (9180 winners); With Extra: $13 (3240 winners)
2 of 6: $0 With Extra: $2 (27,414 winners)
Note: a jackpot of $3.5M with 30 annual payments at 2% would be about $150K/year.