- Home
- Premium Memberships
- Lottery Results
- Forums
- Predictions
- Lottery Post Videos
- News
- Search Drawings
- Search Lottery Post
- Lottery Systems
- Lottery Charts
- Lottery Wheels
- Worldwide Jackpots
- Quick Picks
- On This Day in History
- Blogs
- Online Games
- Premium Features
- Contact Us
- Whitelist Lottery Post
- Rules
- Lottery Book Store
- Lottery Post Gift Shop
The time is now 12:52 am
You last visited
March 29, 2024, 12:34 am
All times shown are
Eastern Time (GMT-5:00)
C code For Generating Key Numbers For The P3
Published:
Updated:
Hello:
A few members have asked me for the code I used to create keyNumberFinderP3.
Todd suggested pasting it into a blog, and I'm going to do this here.
First a few requirements:
1. This code is ANSI C and should be compiled into a console executable.
2. Copy the code, which starts below the asterisks, into your compiler's editor and save as keyNumberFinderP3.c
3. Once the code has been compiled into an executable move it to a working directory, where you'll have to also create a text draw file consisting of 20 past draws. One draw on a line, no spaces or delimiters. Latest draw first and oldest draw last. This file should be called drawsP3.txt
4. To run the program click on the keyNumberFinderP3.exe icon. You'll see the results come up in a DOS window.
5. keyNumberFinderP3.exe may generate more than one set of key numbers. In such a case, pick one set of 4 and stay with that set.
6. Key numbers are only good for 5 days. After 5 days, update drawsP3.txt. Don't worry about having more than 20 draws in the past draw file, the program only looks at the latest 20.
Good luck and please share your results and methods.
jayemmar
*****************************************************************************
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
int i, j, temp1, temp2, temp3, temp4, a1, a2, a3, a4, a;
int drawCount, hit, results;
FILE *in;
int drawArray[20];
int arrayOfFours[210] =
{123,124,125,126,127,128,129,134,135,136,137,138,139,
145,146,147,148,149,156,157,158,159,167,168,169,178,
179,189,234,235,236,237,238,239,245,246,247,248,249,
256,257,258,259,267,268,269,278,279,289,345,346,347,
348,349,356,357,358,359,367,368,369,378,379,389,456,
457,458,459,467,468,469,478,479,489,567,568,569,578,
579,589,678,679,689,789,1234,1235,1236,1237,1238,1239,1245,
1246,1247,1248,1249,1256,1257,1258,1259,1267,1268,1269,1278,1279,
1289,1345,1346,1347,1348,1349,1356,1357,1358,1359,1367,1368,1369,
1378,1379,1389,1456,1457,1458,1459,1467,1468,1469,1478,1479,1489,
1567,1568,1569,1578,1579,1589,1678,1679,1689,1789,2345,2346,2347,
2348,2349,2356,2357,2358,2359,2367,2368,2369,2378,2379,2389,2456,
2457,2458,2459,2467,2468,2469,2478,2479,2489,2567,2568,2569,2578,
2579,2589,2678,2679,2689,2789,3456,3457,3458,3459,3467,3468,3469,
3478,3479,3489,3567,3568,3569,3578,3579,3589,3678,3679,3689,3789,
4567,4568,4569,4578,4579,4589,4678,4679,4689,4789,5678,5679,5689,
5789,6789};
/*
**Open files
*/
in = fopen("drawsP3.txt", "r");
if(in == NULL)
{
printf("error in opening drawsP3.txt\n");
getch();
exit(0);
}
/*
** Get the past 20 draws into memory and then
** loop through the first 20 draws and see if
** there's a key number set for these draws
*/
i = 0;
while(!feof(in) && i < 20)
{
fscanf(in, "%d", &a);
drawArray[i] = a;
i++;
drawCount++;
}
drawCount = i;
results = 0;
start:
for(i = 0; i < 210; i++)
{ hit = 0;
/*
** Peel off the digits from the key number set
*/
temp1 = arrayOfFours[i]/1000;
temp2 = (arrayOfFours[i] - 1000*temp1)/100;
temp3= (arrayOfFours[i] - 1000*temp1 - 100*temp2)/10;
temp4 = (arrayOfFours[i] - 1000*temp1 - 100*temp2 - 10*temp3);
for(j = 0; j < drawCount; j++)
{
/*
** Peel off the digits from this draw
*/
a = drawArray[j];
a1 = a/100;
a2 = (a - 100*a1)/10;
a3= (a - 100*a1 - 10*a2);
/*
** Check to see if at least one digit matches one
** in the key set
*/
if((a1 == temp1 || a1 == temp2 || a1 == temp3 || a1 == temp4)
||(a2 == temp1 || a2 == temp2 || a2 == temp3 || a2 == temp4)
||(a3 == temp1 || a3 == temp2 || a3 == temp3 || a3 == temp4))
{
/*
** Bump the match count when a match occurs
*/
hit++;
}
}
/*
** If the at least one number
** in the key number set matched
** for all draws, print out the key number set
*/
if(hit == drawCount)
{
printf("Key Number Set -> %i-%i-%i-%i\n",
temp1, temp2, temp3, temp4);
/*
** Signal that a key number set was found
*/
results = 1;
}
}
/*
** If no key number set was found, drop the last draw
** and search again
*/
if(results == 0)
{
drawCount = drawCount - 1;
goto start;
}
/*
** Tell the user how many reductions it took
** to find a key number set.
*/
printf("Final draw count used to find key number set was %i\n", drawCount);
printf("Enter any key to exit\n");
getch();
close(in);
}
Comments
I can't get it to work, same as with the other program before, Can you please post the source code of the program?
Thanks for any help!
Post a Comment
Please Log In
To use this feature you must be logged into your Lottery Post account.
Not a member yet?
If you don't yet have a Lottery Post account, it's simple and free to create one! Just tap the Register button and after a quick process you'll be part of our lottery community.
Register