Jump to content

Combo of chars


 Share

Recommended Posts

hi guys, sorry for my bad english;

I'm trying to do a script where i put in for example 1 and the script will show me

0 1 2 3 4 5 6 7 8 9

if i put in 2

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 .... 99

if i put in 3

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ... 999

AND THE ANSWER IS:

is possible do this with alphabet?

put in 1 return:

A B C D E F G H I J K L M N .... Z

put in 2 return:

A B C D E F G H I L M N ... Z AA AB AC AD AE ... ZZ

and putting 3 return:

A B C D E F G H I L M N ... Z AA AB AC AD AE ... ZZ AAA AAB AAC AAD .... ZZZ

[font=courier new, courier, monospace]Una piccola riflessione: [/font] [font=courier new, courier, monospace]Se guardassi la Terra da un pianeta distante 1 anno luce, vedresti la terra 1 anno prima di quell'istante! Quindi se tu potessi arrivare a quella distanza impiegando solo 6 mesi (quindi viaggiando a 2 volte la velocita della luce) vedresti il mondo com'era 6 mesi prima della partenza.. il passato![/font]
Link to comment
Share on other sites

Here is something for start:

$s = ''
For $i = 1 To 10
    $s &= Chr($i+47)
Next
MsgBox(0,'',$s)
thanks this will be useful in further! now i was trying to calculate the number of combinations using this:

$Combinations = (factorial($n + $k - 1)) / (((factorial($k))*factorial((n-1)))

but i can't find the function FACTORIAL (n!)

Edited by Giordy
[font=courier new, courier, monospace]Una piccola riflessione: [/font] [font=courier new, courier, monospace]Se guardassi la Terra da un pianeta distante 1 anno luce, vedresti la terra 1 anno prima di quell'istante! Quindi se tu potessi arrivare a quella distanza impiegando solo 6 mesi (quindi viaggiando a 2 volte la velocita della luce) vedresti il mondo com'era 6 mesi prima della partenza.. il passato![/font]
Link to comment
Share on other sites

thanks this will be useful in further! now i was trying to calculate the number of combinations using this:

$Combinations = (factorial($n + $k - 1)) / (((factorial($k))*factorial((n-1)))

but i can't find the function FACTORIAL (n!)

OK THIS IS A GOOD START:

#include<string.au3>
#include<math.au3>

$Elementi = "ABCDEF"
$NumElem = StringLen($Elementi)
$Posti = 2

$n = $NumElem
$k = $Posti

; (n + k - 1)! / ((k!(n-1)!)

$membro1 = _MathFactorial($n + $k - 1)
$membro2 = _MathFactorial($k)
$membro3 = _MathFactorial($n-1)

$Combinazioni = ($membro1) / (($membro2)*$membro3)

MsgBox(0,0,$Combinazioni)



Func _MathFactorial($mfFactor, $mfStop = 0)
    If Not (StringIsInt($mfFactor)) OR (Int($mfFactor) < 0) Then
        SetError(1)
        Return 0
    Else
        $mfFactor = Int($mfFactor)
    EndIf
    If $mfFactor = 0 Then Return 1
    
    Dim $return = 1
    While $mfFactor > $mfStop
        $return *= $mfFactor
        $mfFactor -= 1
    WEnd
    Return $return
EndFunc

now i have a limit of 17 characters :mellow:

Edited by Giordy
[font=courier new, courier, monospace]Una piccola riflessione: [/font] [font=courier new, courier, monospace]Se guardassi la Terra da un pianeta distante 1 anno luce, vedresti la terra 1 anno prima di quell'istante! Quindi se tu potessi arrivare a quella distanza impiegando solo 6 mesi (quindi viaggiando a 2 volte la velocita della luce) vedresti il mondo com'era 6 mesi prima della partenza.. il passato![/font]
Link to comment
Share on other sites

this is cool i made what i was trying to do!

$Elementi = "ABC"
$NumElem = StringLen($Elementi)

$ArrayElementi = StringSplit($Elementi,"")

For $Posti = 1 To 8
Switch $Posti
    
    Case 1 
        
        For $q=1 To $NumElem
            $string = $ArrayElementi[$q]
            Funzione()
        Next
        
    Case 2
        
        For $q=1 To $NumElem
            For $w=1 To $NumElem
                $string = $ArrayElementi[$q]&$ArrayElementi[$w]
                Funzione()
            Next
        Next
        
    Case 3
        
        For $q=1 To $NumElem
            For $w=1 To $NumElem
                For $e=1 To $NumElem
                    $string = $ArrayElementi[$q]&$ArrayElementi[$w]&$ArrayElementi[$e]
                    Funzione()
                Next
            Next
        Next
        
    Case 4
        
        For $q=1 To $NumElem
            For $w=1 To $NumElem
                For $e=1 To $NumElem
                    For $r = 1 To $NumElem          
                        $string = $ArrayElementi[$q]&$ArrayElementi[$w]&$ArrayElementi[$e]&$ArrayElementi[$r]
                        Funzione()
                    Next
                Next
            Next
        Next
        
    Case 5
        
        For $q=1 To $NumElem
            For $w=1 To $NumElem
                For $e=1 To $NumElem
                    For $r = 1 To $NumElem
                        For $t = 1 To $NumElem
                            $string = $ArrayElementi[$q]&$ArrayElementi[$w]&$ArrayElementi[$e]&$ArrayElementi[$r]&$ArrayElementi[$t]
                            Funzione()
                        Next
                    Next
                Next
            Next
        Next

    Case 6
        
        For $q=1 To $NumElem
            For $w=1 To $NumElem
                For $e=1 To $NumElem
                    For $r = 1 To $NumElem
                        For $t = 1 To $NumElem
                            For $y = 1 To $NumElem
                                $string = $ArrayElementi[$q]&$ArrayElementi[$w]&$ArrayElementi[$e]&$ArrayElementi[$r]&$ArrayElementi[$t]&$ArrayElementi[$y]
                                Funzione()
                            Next
                        Next
                    Next
                Next
            Next
        Next
        
    Case 7

        For $q=1 To $NumElem
            For $w=1 To $NumElem
                For $e=1 To $NumElem
                    For $r = 1 To $NumElem
                        For $t = 1 To $NumElem
                            For $y = 1 To $NumElem
                                For $u = 1 To $NumElem
                                    $string = $ArrayElementi[$q]&$ArrayElementi[$w]&$ArrayElementi[$e]&$ArrayElementi[$r]&$ArrayElementi[$t]&$ArrayElementi[$y]&$ArrayElementi[$u]
                                    Funzione()
                                Next
                            Next
                        Next
                    Next
                Next
            Next
        Next
        
    Case 8

        For $q=1 To $NumElem
            For $w=1 To $NumElem
                For $e=1 To $NumElem
                    For $r = 1 To $NumElem
                        For $t = 1 To $NumElem
                            For $y = 3 To $NumElem
                                For $u = 1 To $NumElem
                                    For $i = 1 To $NumElem
                                        $string = $ArrayElementi[$q]&$ArrayElementi[$w]&$ArrayElementi[$e]&$ArrayElementi[$r]&$ArrayElementi[$t]&$ArrayElementi[$y]&$ArrayElementi[$u]&$ArrayElementi[$i]
                                        Funzione()
                                    Next
                                Next
                            Next
                        Next
                    Next
                Next
            Next
        Next

EndSwitch

Next

Func Funzione()
    
    ToolTip($string)
EndFunc
[font=courier new, courier, monospace]Una piccola riflessione: [/font] [font=courier new, courier, monospace]Se guardassi la Terra da un pianeta distante 1 anno luce, vedresti la terra 1 anno prima di quell'istante! Quindi se tu potessi arrivare a quella distanza impiegando solo 6 mesi (quindi viaggiando a 2 volte la velocita della luce) vedresti il mondo com'era 6 mesi prima della partenza.. il passato![/font]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...