Know all combinations of 5 digits from 1 to 14

Solved
Warrenj Posted messages 3 Registration date   Status Membre Last intervention   -  
mariam-j Posted messages 44 Registration date   Status Membre Last intervention   -
Hello there, I would like to know if it's possible to find all the possible combinations of 5 digits ranging from 1 to 14 without repetition? So in any order, which might make it easier for you, for example

-12345✅
-54321❌
Without repetition.
Waiting for a math expert???? thank you.

1 réponse

alex64-PB Posted messages 589 Registration date   Status Membre Last intervention   79
 
Hello
here is the calculation in the general case:


in your case, there are 2002 possible combinations

1
Warrenj Posted messages 3 Registration date   Status Membre Last intervention   1
 
Thank you very much, I'm not an expert in Math, but is there a way to come up with all the combinations, or if it's lengthy you can give me the method and I'll apply it to come up with all those combinations?
0
alex64-PB Posted messages 589 Registration date   Status Membre Last intervention   79 > Warrenj Posted messages 3 Registration date   Status Membre Last intervention  
 
it's possible but you need a special program to display them.

check out this link
https://forums.commentcamarche.net/profile/user/via55
1
Warrenj Posted messages 3 Registration date   Status Membre Last intervention   1 > alex64-PB Posted messages 589 Registration date   Status Membre Last intervention  
 
Sure, thank you very much, I'm checking that out right away.
0
mariam-j Posted messages 44 Registration date   Status Membre Last intervention   39 > Warrenj Posted messages 3 Registration date   Status Membre Last intervention  
 

In Basic: ("n" is 14, here there are 3 loops for 5 digits you need to do 5 loops)
a$ contains the 14 numbers in alphanumeric form (it’s more convenient)
Line 5 is the display of a combination at each loop exit

for i=1 to n for j=i+1 to n for k=j+1 to n for m=k+1 to n-1 #w.txt,word$(a$,i);" ";word$(a$,j);" ";word$(a$,k);" ";word$(a$,m) next m next k next j next i



You just have to think and adapt it in the language of your choice

1