generate all 7-letter formations, maximum 3 letters repeated.

piter

Active Member
Joined
Jul 22, 2011
Messages
314
Office Version
  1. 2016
Platform
  1. Windows
generate all 7-letter formations, maximum 3 letters repeated.
ex = aaabcde ... bbbcccd, etc.
we have 10 letters = abcdefghij to conbine the formations with 7 letters
please!
 
Last lottery draw was = 07 11 12 17 25 29 30, logo
then it would be in the lines = abbbccc / in the abdeggi columns (which lack to make these patterns)
each draw has the two patterns x lines carteziano type
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
After looking at your post 6 again, I think I detected your pattern. It appears to count up like an odometer, with the added provision that each digit must be greater than or equal to the digit on its left. Using that logic, I duplicated your list from post 6. Using 4 letters, the list grew to 120 items.

To try this code, open a new workbook. Press Alt-F11 to open the VBA editor. From the menu, click Insert > Module. Paste the following code into the window that opens:

Rich (BB code):
Public MyDict

Sub GetCombs()

    Set MyDict = CreateObject("Scripting.Dictionary")
    Call Recur("abcdefghij", 0, "")
    
    Range("A1").Resize(MyDict.Count) = WorksheetFunction.Transpose(MyDict.keys)
    
End Sub

Sub Recur(chars, depth, sofar)
Dim i As Long
    
    If depth = 7 Then
        MyDict.Add sofar, 1
        Exit Sub
    End If
    
    For i = InStr(chars, Right(sofar, 1)) To Len(chars)
        Call Recur(chars, depth + 1, sofar & Mid(chars, i, 1))
    Next i

End Sub
Place the cursor in the GetCombs routine and press F5. It should generate the list in the workbook in column A. There are 11440 items.

Note that this routine requires each letter in the list to be different.


Note: I just saw your latest post. I'm still not clear on what you're looking for. But if you're looking for something to help with lottery picks, be aware that this kind of analysis usually doesn't help.
 
Upvote 0
ok ERIC! almost there, but inside the trainings can not have letters repeated more than 3 times
the maximum repetition limit is 3 letters 10 possible letters
can not have ijjjjjj = exclude by passing the limit of 3 letters
aabbjjj = yes because it has a maximum of three letters, it is logical if in each colua I have 3 numbers I can not have 4 repetitions understand!
 
Upvote 0
Rich (BB code):
Public MyDict

Sub GetCombs()

    Set MyDict = CreateObject("Scripting.Dictionary")
    Call Recur("abcdefghij", 0, "")
    
    Range("A1").Resize(MyDict.Count) = WorksheetFunction.Transpose(MyDict.keys)
    
End Sub

Sub Recur(chars, depth, sofar)
Dim i As Long
    
    If depth = 7 Then
        MyDict.Add sofar, 1
        Exit Sub
    End If
    
    For i = InStr(chars, Right(sofar, 1)) To Len(chars)
        If Right(sofar, 3) <> String(3, Mid(chars, i, 1)) Then
            Call Recur(chars, depth + 1, sofar & Mid(chars, i, 1))
        End If
    Next i

End Sub
 
  • Like
Reactions: shg
Upvote 0
Eric, re your code, a max of three repeats of each symbol is allowed.

There are 8 partitions of 7 with no number greater than 3: 3+3+1, 3+2+2, 3+2+1+1, ... 1+1+1+1+1+1+1

For the first one, there are 10 choose 2 = 45 ways to choose the 'three-fers', and 8 choose 1 = 8 ways to choose the 'one-fer', so 360 ways total.

Similarly,

A​
B​
C​
D​
E​
F​
1​
3​
2​
1​
Check
Ways
2​
2​
0​
1​
7​
360​
E2: =COMBIN(10, A2) * COMBIN(10 - A2, B2) * COMBIN(10 - SUM(A2:B2), C2)
3​
1​
2​
0​
7​
360​
4​
1​
1​
2​
7​
2520​
5​
1​
0​
4​
7​
1260​
6​
0​
3​
1​
7​
840​
7​
0​
2​
3​
7​
2520​
8​
0​
1​
5​
7​
1260​
9​
0​
0​
7​
7​
120​
10​
Total
9240​

That gives 9240 combinations.

EDIT: Reckon I should have run your later code :)
 
Last edited:
Upvote 0
Very nice analysis, shg. My latest macro indeed returns 9240 combinations, so that's a nice check.
 
  • Like
Reactions: shg
Upvote 0
ok perfect, very good job, ERIC AND SHG, congratulations,
Okay, thank you for resolving the issue.
 
Upvote 0
Decade 0 01-09 A
Decade 1 10-19 B
Decade 2 20-29 C
Decade 3 30-39 D
Decade 4 40-49 E

So, for example, the last UK lotto draw was 2-3-5 -15-22-29 which would translate into AAABCC. I split these up into front and back triples, e.g. AAA, BCC.

I just noticed that there are several patterns that have NEVER come out in the 20 year history of the UK Lotto. Not to say they won't ever appear, but these combos are seriouslyunlikely!

For the Front three, combos AEE, CCE, BEE, DEE, CEE or EEE have not appeared to date. So, if your system spits out a combo that has 40's in the front three of the combo, delete it. Most sum filters would automatically delete these combos anyway.

For the Back three, ABB, ADE, AAC, AAA, ABC, AAD and AAE have not appeared in the first 20 years of draws. I am a bit surprised to see ADE on the list as I wouldn't be surprised to see a combo with 4 single digits, a thirty and a forty -- but it hasn't happened yet.

On the other hand, 59% of the first three follow patterns ABC, AAB, ABB, BBC and AAAlisted in order of most appearances. For the back end, the top triples are DEE, DDE, CDE, EEE and CDD accounting for 67% of all draws.
 
Upvote 0
objetivo filter 3 letters
For the front end triple, only 16 combinations make up 95% of the winning combinations. These are (listed by number of hits):
AAB, ABB, ABC, AAC, AAA, BBC, ACC, BCC, BBB, ACD, BCD, ABD, AAD, CCC, CCD and BBD

And, for the back-end triple only 15 combinations are used 95% of the time:
DEE, DDE, CDE, EEE, CDD, CEE, CCD, CCE, DDD, BCE, BDE, BCD, BDD, CCC and BBD.
 
Upvote 0

Forum statistics

Threads
1,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top