Powerball Generator!
|
05-23-2024, 09:42 PM
Post: #1
|
|||
|
|||
Powerball Generator!
...who doesn't need a handy Powerball generator every now and then?
Picks 1st five numbers between 1-69, no-dupes, then picks the lucky Powerball number between 1-26! Uses the Alpha Register to format the output, a 1x6 array, and the fancy [FIND] function to keep duplicates in check! 00 { 127-Byte Prgm } 01 LBL "PBALL" 02 CLA 03 CLD 04 6 05 1 06 DIM "PBALL" 07 INDEX "PBALL" 08 1.00501 09 STO "CNT" 10 LBL 01 11 RCL "CNT" 12 1 13 STOIJ 14 RAN 15 100 16 × 17 IP 18 STO 10 19 69 20 X<>Y 21 X>Y? 22 GTO 01 23 X≤0? 24 GTO 01 25 [FIND] 26 GTO 01 27 STOEL 28 ├" " 29 AIP 30 ISG "CNT" 31 GTO 01 32 LBL 02 33 6 34 1 35 STOIJ 36 RAN 37 100 38 × 39 IP 40 STO 10 41 26 42 X<>Y 43 X>Y? 44 GTO 02 45 X≤0? 46 GTO 02 47 STOEL 48 ├" PB: " 49 AIP 50 AVIEW 51 END |
|||
05-24-2024, 12:36 PM
Post: #2
|
|||
|
|||
RE: Powerball Generator!
If I run this program and win, do I have to split the winnings?
|
|||
05-24-2024, 04:18 PM
Post: #3
|
|||
|
|||
RE: Powerball Generator! | |||
09-13-2024, 04:11 AM
Post: #4
|
|||
|
|||
RE: Powerball Generator!
If I run this program will (Underlined), I win?
Fingers Crossed |
|||
09-13-2024, 07:18 AM
(This post was last modified: 09-13-2024 10:25 AM by Thomas Klemm.)
Post: #5
|
|||
|
|||
RE: Powerball Generator!
A bit shorter:
Code: 00 { 95-Byte Prgm } Changes The subroutine at LBL 00 generates a random number from 1 to X. This makes the checks at the boundaries unnecessary. I also use the register 00 instead of the global variable "CNT". But that's more a matter of taste. There's no obvious reason to store a result in the register 10 since it's never used. So I removed it. I also removed CLD since I don't think it's needed. If the increment of a loop control number is 1, it can be omitted as it is the default. |
|||
09-13-2024, 07:37 AM
(This post was last modified: 09-13-2024 09:58 PM by Thomas Klemm.)
Post: #6
|
|||
|
|||
RE: Powerball Generator!
If the result in "PBALL" is no longer needed, it can be converted into a [ 5×1 matrix ] and the storage of the Powerball lucky number is no longer necessary:
Code: 00 { 81-Byte Prgm } |
|||
09-13-2024, 08:26 PM
Post: #7
|
|||
|
|||
RE: Powerball Generator!
My Texas Lottery HP 42S program:
LBL “LOT” RAN 54 * 1 + IP STOP GTO “LOT” RTN I like generating 1 number at a time for filling out my single ticket purchase each week. R/S for each additional number, R/S if I get a repeated number. On my HP 50, I programmed it to only present a non reapeating 1 row matrix of 6 numbers. I would have the same chance of a win if I simply chose 1,2,3,4,5,6 ! |
|||
09-13-2024, 10:20 PM
Post: #8
|
|||
|
|||
RE: Powerball Generator!
(09-13-2024 08:26 PM)lrdheat Wrote: On my HP 50, I programmed it to only present a non reapeating 1 row matrix of 6 numbers. We can adapt the existing program very easily: Code: 00 { 53-Byte Prgm } |
|||
09-14-2024, 11:27 AM
Post: #9
|
|||
|
|||
RE: Powerball Generator!
(09-13-2024 08:26 PM)lrdheat Wrote: ... On my HP 50, I programmed it to only present a non repeating 1 row matrix of 6 numbers. Indeed the chance of winning is minuscule but at least we get some entertainment by programming our HP's This is my Powerball program for the HP 50 using ListExt and LSORT. It returns a list of 5 numbers in the range 1..69 on level 2 and a number in the range 1..26 on level 1. For MegaMillions (the other US multi-state lottery) replace the 69 with 70 and replace the 26 with 25. Code:
|
|||
09-14-2024, 12:41 PM
Post: #10
|
|||
|
|||
RE: Powerball Generator!
Now if someone could just come up with a program that generates the winning numbers
A1 HP-15C (2234A02xxx), HP-16C (2403A02xxx), HP-15C CE (9CJ323-03xxx), HP-20S (2844A16xxx), HP-12C+ (9CJ251) |
|||
09-14-2024, 03:13 PM
(This post was last modified: 09-14-2024 03:14 PM by C.Ret.)
Post: #11
|
|||
|
|||
RE: Powerball Generator!
(09-14-2024 12:41 PM)AnnoyedOne Wrote: Now if someone could just come up with a program that generates the winning numbers It is possible, but it requires a lot more calculations than what I see in the codes above. But if by chance you have an HP-41C (or something perfectly compatible), then there is still time to play the Power Balls that this program displays: P.S.: Know that I will only take a tiny fraction of the winnings, but for all the players who win by using my code. |
|||
09-14-2024, 03:45 PM
Post: #12
|
|||
|
|||
RE: Powerball Generator!
(09-14-2024 03:13 PM)C.Ret Wrote: P.S.: Know that I will only take a tiny fraction of the winnings... Would 10% be enough? With payment after I receive the winnings! A1 HP-15C (2234A02xxx), HP-16C (2403A02xxx), HP-15C CE (9CJ323-03xxx), HP-20S (2844A16xxx), HP-12C+ (9CJ251) |
|||
09-14-2024, 04:43 PM
Post: #13
|
|||
|
|||
RE: Powerball Generator! | |||
09-14-2024, 06:40 PM
Post: #14
|
|||
|
|||
RE: Powerball Generator!
(09-13-2024 08:26 PM)lrdheat Wrote: I would have the same chance of a win if I simply chose 1,2,3,4,5,6 ! Back when I was a teenager, I said this same thing to an uncle of mine in upstate New York, when they had a state lottery and I wanted to buy a ticket. My uncle had been around (horses, poker, other types of gambling), and he said that I was incorrect in my assertion (NOT the words he used). I didn’t believe him. Many years later, I did some research on conditional probabilities (conditional because you are choosing a set of numbers based on what you have already chosen, in order for them to be so close to each other). Turns out he was correct: some sets of lottery numbers are less likely to occur than others. The lessons: always listen to your elders, because you might learn something. Also, math is interesting. DGM HP25, HP55, HP27S, HP18C, HP19C, HP16C, HP67, HP28, HP41, HP75, HP71, HP48C, HP49G, HP30B, HP50G, HP Prime (not necessarily in that order) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)