Using Artificial Intelligence Techniques And SQL To Optimize A Lottery Application

synthetic Intelligence or “AI” can be described as the “ability of a machine to research from previous experience in an try and expect destiny occasions”. whilst this could seem a forlorn hope in making lottery predictions, let’s examine if this is probably viable.

The massive hassle in analysing lottery consequences is the huge number of feasible combos. In a trendy “40 x 6” ball sport there are three,838,380 strains to select from.

generating A place to begin For A Lotto AI machine

It makes feel to lessen the viable number pool earlier than we put into effect any AI possibilities. i will use the “high” possibility gadget which assumes there might be 2 primes, 1 odd and three even numbers in every triumphing line.

we’ll try and use AI to organization the high effects into some type of sample once they do occur.

as an instance, the closing 6 weeks outcomes of NZ Lotto had been:







The numbers in results 2,3,4 and 6 meet the top machine criteria so we simplest need to study those traces. If we are able to establish a sample inside the prime effects then we can substantially lessen our combos for whilst the top system numbers arise.

we’ll use the structured question Language, or sq., to question the top device database of all viable lottery mixtures; a total 575,586 traces of 6 numbers.

The shape of the database is as follows:

quantity sorts: prime,high,unusual,even,even,even

Column call: n1,n2,n3,n4,n5,n6

as an example:


the usage of A square question To apprehend The Lottery pattern

What i will do is create a square question that selects every line of prevailing prime machine numbers. we will then integrate the queries in an “and/or” announcement to cowl the extraordinary situations.

on this way, we are able to study the commonalities among the exclusive consequences, similar to a actual existence AI software.

most of the top results above contained at the least one quantity divisible via 4. we are able to cover that state of affairs with this question:

n4percent4=zero or n5%4=0 or n6percent4=zero

data lower back: 525,690

The percentage symbol is a unique code in sq. which gives us the remainder from dividing the 2 numbers.

every prime line appears to have as a minimum two numbers within 4 of each other. we’re going to cover that opportunity like this:




records again: 305,316

we are able to now integrate the queries with the subsequent command:

(n4percent4=0 or n5percent4=zero or n6percent4=zero)







The mixed query back 276,210 mixtures, a reduction of round 40%, which within reason staggering.

I noticed the primary even number was constantly identical to or less than 14 and after I factored that parameter in, the mixtures returned have been one hundred sixty five,726.

In future weeks i’ll observe different commonplace factors, as an instance aside from numbers from current effects.


this article explored the opportunity of the usage of AI strategies and sq. to lessen viable mixtures. by using analysing effects that meet certain parameters it ought to be feasible to lessen line numbers and enhance our lottery probabilities.