I can make a nice clean object out of the data from a local lotto history/tracker website.
If I pull all the numbers into an array I could count the frequency and then generate a set of numbers scored by frequency/how often they appeared in the draws.
Alternatively I could count how many days have passed for each draw and then generate a set of numbers scored on recency where it is an average of all the days passed for each number in the draws.
Finally a pair of slider inputs could allow us to make a final sort based on if the user wants to prioritize the frequency vs. recency.
Frequency (number drawn, number of draws):
7, 4
12, 1
22, 5
...
Recency (days ago added and divided by the total count):
7, ||(14 + 31 + 77 + 105)/4 = ||56.75
12, 14
22, 38.92
...
Looking at the sample data, if there's a preference for frequency then the numbers picked would likely be 22, 7, and then some others due to them sorting high. If the preference swings to overdue numbers then we would expect 7 and 22 to be picked before 12.
To get this we'd want to multiply the frequency by a factor that scales based on the weight, and then we could use the sort order of summed arrays to get a weighted sort, assuming we can scale the Frequency to be in the same range as the Recency?
This last part is really what is kicking my butt for logic as I've never had to solve it before. I asked AI for help but it gets my goals all wrong and just ignores the Frequency weight and gives the numbers sorted by recency. I can get overdue numbers, the most recent numbers, and shades in between, but the amount of times they showed up does not have enough weight to change the sort?
Perhaps there's a glaring way to get the averages of both sorts and then auto scale the frequency values to better match the recency? 🤔