WeixiangYan/CodeTransOcean huggingface dataset:
Task: Permutations

C: #include <stdio.h>
int main (int argc, char *argv[]) {

	if (argc < 2) {
        printf("Enter an argument. Example 1234 or dcba:\n");
        return 0;
	}

        int x;
        for (x = 0; argv[1][x] != '\0'; x++);

	int f, v, m;
	 for(f=0; f < x; f++) {
    	 for(v = x-1; v > f; v-- ) {
     	 if (argv[1][v-1] > argv[1][v]) {
	m=argv[1][v-1];
	argv[1][v-1]=argv[1][v];
	argv[1][v]=m;
    }
  }
}


    char a[x];
	int k=0;
	int fact=k+1;
             while (k!=x) {
                   a[k]=argv[1][k];
               	   k++;
		  fact = k*fact;
                   }
                   a[k]='\0';

           int i, j;
           int y=0;
           char c;
          while (y != fact) {
          printf("%s\n", a);
          i=x-2;
          while(a[i] > a[i+1] ) i--;
          j=x-1;
          while(a[j] < a[i] ) j--;
      c=a[j];
      a[j]=a[i];
      a[i]=c;
i++;
for (j = x-1; j > i; i++, j--) {
  c = a[i];
  a[i] = a[j];
  a[j] = c;
      }
y++;
   }
}




Go: package main

import "fmt"

func main() {
    demoPerm(3)
}

func demoPerm(n int) {
    
    s := make([]int, n)
    for i := range s {
        s[i] = i + 1
    }
    
    
    permute(s, func(p []int) { fmt.Println(p) })
}



func permute(s []int, emit func([]int)) {
    if len(s) == 0 {
        emit(s)
        return
    }
    
    
    
    
    
    var rc func(int)
    rc = func(np int) {
        if np == 1 {
            emit(s)
            return
        }
        np1 := np - 1
        pp := len(s) - np1
        
        rc(np1)
        for i := pp; i > 0; i-- {
            s[i], s[i-1] = s[i-1], s[i]
            rc(np1)
        }
        
        w := s[0]
        copy(s, s[1:pp+1])
        s[pp] = w
    }
    rc(len(s))
}
Task: Permutations

C: #include <stdio.h>
int main (int argc, char *argv[]) {

	if (argc < 2) {
        printf("Enter an argument. Example 1234 or dcba:\n");
        return 0;
	}

        int x;
        for (x = 0; argv[1][x] != '\0'; x++);

	int f, v, m;
	 for(f=0; f < x; f++) {
    	 for(v = x-1; v > f; v-- ) {
     	 if (argv[1][v-1] > argv[1][v]) {
	m=argv[1][v-1];
	argv[1][v-1]=argv[1][v];
	argv[1][v]=m;
    }
  }
}


    char a[x];
	int k=0;
	int fact=k+1;
             while (k!=x) {
                   a[k]=argv[1][k];
               	   k++;
		  fact = k*fact;
                   }
                   a[k]='\0';

           int i, j;
           int y=0;
           char c;
          while (y != fact) {
          printf("%s\n", a);
          i=x-2;
          while(a[i] > a[i+1] ) i--;
          j=x-1;
          while(a[j] < a[i] ) j--;
      c=a[j];
      a[j]=a[i];
      a[i]=c;
i++;
for (j = x-1; j > i; i++, j--) {
  c = a[i];
  a[i] = a[j];
  a[j] = c;
      }
y++;
   }
}





Java: 
module Permutations
    {
    static Int[][] permut(Int items)
        {
        if (items <= 1)
            {
            
            return items == 1 ? [[0]] : [];
            }

        
        
        Int[][] pattern = permut(items - 1);

        
        
        Int[][] result = new Int[][];
        for (Int prefix : 0 ..< items)
            {
            for (Int[] suffix : pattern)
                {
                result.add(new Int[items](i -> i == 0 ? prefix : (prefix + suffix[i-1] + 1) % items));
                }
            }
        return result;
        }

    void run()
        {
        @Inject Console console;
        console.print($"permut(3) = {permut(3)}");
        }
    }
Task: Permutations

C: #include <stdio.h>
int main (int argc, char *argv[]) {

	if (argc < 2) {
        printf("Enter an argument. Example 1234 or dcba:\n");
        return 0;
	}

        int x;
        for (x = 0; argv[1][x] != '\0'; x++);

	int f, v, m;
	 for(f=0; f < x; f++) {
    	 for(v = x-1; v > f; v-- ) {
     	 if (argv[1][v-1] > argv[1][v]) {
	m=argv[1][v-1];
	argv[1][v-1]=argv[1][v];
	argv[1][v]=m;
    }
  }
}


    char a[x];
	int k=0;
	int fact=k+1;
             while (k!=x) {
                   a[k]=argv[1][k];
               	   k++;
		  fact = k*fact;
                   }
                   a[k]='\0';

           int i, j;
           int y=0;
           char c;
          while (y != fact) {
          printf("%s\n", a);
          i=x-2;
          while(a[i] > a[i+1] ) i--;
          j=x-1;
          while(a[j] < a[i] ) j--;
      c=a[j];
      a[j]=a[i];
      a[i]=c;
i++;
for (j = x-1; j > i; i++, j--) {
  c = a[i];
  a[i] = a[j];
  a[j] = c;
      }
y++;
   }
}







Python: import itertools
for values in itertools.permutations([1,2,3]):
    print (values)
Task: Permutations

C: #include <stdio.h>
int main (int argc, char *argv[]) {

	if (argc < 2) {
        printf("Enter an argument. Example 1234 or dcba:\n");
        return 0;
	}

        int x;
        for (x = 0; argv[1][x] != '\0'; x++);

	int f, v, m;
	 for(f=0; f < x; f++) {
    	 for(v = x-1; v > f; v-- ) {
     	 if (argv[1][v-1] > argv[1][v]) {
	m=argv[1][v-1];
	argv[1][v-1]=argv[1][v];
	argv[1][v]=m;
    }
  }
}


    char a[x];
	int k=0;
	int fact=k+1;
             while (k!=x) {
                   a[k]=argv[1][k];
               	   k++;
		  fact = k*fact;
                   }
                   a[k]='\0';

           int i, j;
           int y=0;
           char c;
          while (y != fact) {
          printf("%s\n", a);
          i=x-2;
          while(a[i] > a[i+1] ) i--;
          j=x-1;
          while(a[j] < a[i] ) j--;
      c=a[j];
      a[j]=a[i];
      a[i]=c;
i++;
for (j = x-1; j > i; i++, j--) {
  c = a[i];
  a[i] = a[j];
  a[j] = c;
      }
y++;
   }
}








VB: Public Sub Permute(n As Integer, Optional printem As Boolean = True)

 
Dim P() As Integer
Dim t As Integer, i As Integer, j As Integer, k As Integer
Dim count As Long
Dim Last As Boolean
 
If n <= 1 Then

  Debug.Print "Please give a number greater than 1"
  Exit Sub

End If


ReDim P(n)

For i = 1 To n
  P(i) = i
Next

count = 0
Last = False
 
Do While Not Last
   
   If printem Then

      For t = 1 To n
        Debug.Print P(t);
      Next

      Debug.Print

   End If
   
count = count + 1

Last = True
i = n - 1

   Do While i > 0

     If P(i) < P(i + 1) Then

       Last = False
       Exit Do

     End If

     i = i - 1
   Loop

  j = i + 1
  k = n
  
  While j < k
    
    t = P(j)
    P(j) = P(k)
    P(k) = t
    j = j + 1
    k = k - 1
  Wend
  
  j = n
  
  While P(j) > P(i)
    j = j - 1
  Wend
  
  j = j + 1
  
  t = P(i)
  P(i) = P(j)
  P(j) = t
Loop 
 
Debug.Print "Number of permutations: "; count
 
End Sub
Task: Permutations


C++: #include <algorithm>
#include <string>
#include <vector>
#include <iostream>

template<class T>
void print(const std::vector<T> &vec)
{
    for (typename std::vector<T>::const_iterator i = vec.begin(); i != vec.end(); ++i)
    {
        std::cout << *i;
        if ((i + 1) != vec.end())
            std::cout << ",";
    }
    std::cout << std::endl;
}

int main()
{
    
    std::string example("Hello");
    std::sort(example.begin(), example.end());
    do {
        std::cout << example << '\n';
    } while (std::next_permutation(example.begin(), example.end()));

    
    std::vector<int> another;
    another.push_back(1234);
    another.push_back(4321);
    another.push_back(1234);
    another.push_back(9999);

    std::sort(another.begin(), another.end());
    do {
        print(another);
    } while (std::next_permutation(another.begin(), another.end()));

    return 0;
}


C#: public static class Extension
{
    public static IEnumerable<IEnumerable<T>> Permutations<T>(this IEnumerable<T> values) where T : IComparable<T>
    {
        if (values.Count() == 1)
            return new[] { values };
        return values.SelectMany(v => Permutations(values.Where(x => x.CompareTo(v) != 0)), (v, p) => p.Prepend(v));
    }
}
Task: Permutations


C++: #include <algorithm>
#include <string>
#include <vector>
#include <iostream>

template<class T>
void print(const std::vector<T> &vec)
{
    for (typename std::vector<T>::const_iterator i = vec.begin(); i != vec.end(); ++i)
    {
        std::cout << *i;
        if ((i + 1) != vec.end())
            std::cout << ",";
    }
    std::cout << std::endl;
}

int main()
{
    
    std::string example("Hello");
    std::sort(example.begin(), example.end());
    do {
        std::cout << example << '\n';
    } while (std::next_permutation(example.begin(), example.end()));

    
    std::vector<int> another;
    another.push_back(1234);
    another.push_back(4321);
    another.push_back(1234);
    another.push_back(9999);

    std::sort(another.begin(), another.end());
    do {
        print(another);
    } while (std::next_permutation(another.begin(), another.end()));

    return 0;
}




Java: 
module Permutations
    {
    static Int[][] permut(Int items)
        {
        if (items <= 1)
            {
            
            return items == 1 ? [[0]] : [];
            }

        
        
        Int[][] pattern = permut(items - 1);

        
        
        Int[][] result = new Int[][];
        for (Int prefix : 0 ..< items)
            {
            for (Int[] suffix : pattern)
                {
                result.add(new Int[items](i -> i == 0 ? prefix : (prefix + suffix[i-1] + 1) % items));
                }
            }
        return result;
        }

    void run()
        {
        @Inject Console console;
        console.print($"permut(3) = {permut(3)}");
        }
    }
Task: Permutations



C#: public static class Extension
{
    public static IEnumerable<IEnumerable<T>> Permutations<T>(this IEnumerable<T> values) where T : IComparable<T>
    {
        if (values.Count() == 1)
            return new[] { values };
        return values.SelectMany(v => Permutations(values.Where(x => x.CompareTo(v) != 0)), (v, p) => p.Prepend(v));
    }
}


Go: package main

import "fmt"

func main() {
    demoPerm(3)
}

func demoPerm(n int) {
    
    s := make([]int, n)
    for i := range s {
        s[i] = i + 1
    }
    
    
    permute(s, func(p []int) { fmt.Println(p) })
}



func permute(s []int, emit func([]int)) {
    if len(s) == 0 {
        emit(s)
        return
    }
    
    
    
    
    
    var rc func(int)
    rc = func(np int) {
        if np == 1 {
            emit(s)
            return
        }
        np1 := np - 1
        pp := len(s) - np1
        
        rc(np1)
        for i := pp; i > 0; i-- {
            s[i], s[i-1] = s[i-1], s[i]
            rc(np1)
        }
        
        w := s[0]
        copy(s, s[1:pp+1])
        s[pp] = w
    }
    rc(len(s))
}
Task: Permutations



C#: public static class Extension
{
    public static IEnumerable<IEnumerable<T>> Permutations<T>(this IEnumerable<T> values) where T : IComparable<T>
    {
        if (values.Count() == 1)
            return new[] { values };
        return values.SelectMany(v => Permutations(values.Where(x => x.CompareTo(v) != 0)), (v, p) => p.Prepend(v));
    }
}



Java: 
module Permutations
    {
    static Int[][] permut(Int items)
        {
        if (items <= 1)
            {
            
            return items == 1 ? [[0]] : [];
            }

        
        
        Int[][] pattern = permut(items - 1);

        
        
        Int[][] result = new Int[][];
        for (Int prefix : 0 ..< items)
            {
            for (Int[] suffix : pattern)
                {
                result.add(new Int[items](i -> i == 0 ? prefix : (prefix + suffix[i-1] + 1) % items));
                }
            }
        return result;
        }

    void run()
        {
        @Inject Console console;
        console.print($"permut(3) = {permut(3)}");
        }
    }
Task: Permutations



C#: public static class Extension
{
    public static IEnumerable<IEnumerable<T>> Permutations<T>(this IEnumerable<T> values) where T : IComparable<T>
    {
        if (values.Count() == 1)
            return new[] { values };
        return values.SelectMany(v => Permutations(values.Where(x => x.CompareTo(v) != 0)), (v, p) => p.Prepend(v));
    }
}





Python: import itertools
for values in itertools.permutations([1,2,3]):
    print (values)
Task: Permutations



C#: public static class Extension
{
    public static IEnumerable<IEnumerable<T>> Permutations<T>(this IEnumerable<T> values) where T : IComparable<T>
    {
        if (values.Count() == 1)
            return new[] { values };
        return values.SelectMany(v => Permutations(values.Where(x => x.CompareTo(v) != 0)), (v, p) => p.Prepend(v));
    }
}






VB: Public Sub Permute(n As Integer, Optional printem As Boolean = True)

 
Dim P() As Integer
Dim t As Integer, i As Integer, j As Integer, k As Integer
Dim count As Long
Dim Last As Boolean
 
If n <= 1 Then

  Debug.Print "Please give a number greater than 1"
  Exit Sub

End If


ReDim P(n)

For i = 1 To n
  P(i) = i
Next

count = 0
Last = False
 
Do While Not Last
   
   If printem Then

      For t = 1 To n
        Debug.Print P(t);
      Next

      Debug.Print

   End If
   
count = count + 1

Last = True
i = n - 1

   Do While i > 0

     If P(i) < P(i + 1) Then

       Last = False
       Exit Do

     End If

     i = i - 1
   Loop

  j = i + 1
  k = n
  
  While j < k
    
    t = P(j)
    P(j) = P(k)
    P(k) = t
    j = j + 1
    k = k - 1
  Wend
  
  j = n
  
  While P(j) > P(i)
    j = j - 1
  Wend
  
  j = j + 1
  
  t = P(i)
  P(i) = P(j)
  P(j) = t
Loop 
 
Debug.Print "Number of permutations: "; count
 
End Sub
Task: Permutations




Go: package main

import "fmt"

func main() {
    demoPerm(3)
}

func demoPerm(n int) {
    
    s := make([]int, n)
    for i := range s {
        s[i] = i + 1
    }
    
    
    permute(s, func(p []int) { fmt.Println(p) })
}



func permute(s []int, emit func([]int)) {
    if len(s) == 0 {
        emit(s)
        return
    }
    
    
    
    
    
    var rc func(int)
    rc = func(np int) {
        if np == 1 {
            emit(s)
            return
        }
        np1 := np - 1
        pp := len(s) - np1
        
        rc(np1)
        for i := pp; i > 0; i-- {
            s[i], s[i-1] = s[i-1], s[i]
            rc(np1)
        }
        
        w := s[0]
        copy(s, s[1:pp+1])
        s[pp] = w
    }
    rc(len(s))
}


Java: 
module Permutations
    {
    static Int[][] permut(Int items)
        {
        if (items <= 1)
            {
            
            return items == 1 ? [[0]] : [];
            }

        
        
        Int[][] pattern = permut(items - 1);

        
        
        Int[][] result = new Int[][];
        for (Int prefix : 0 ..< items)
            {
            for (Int[] suffix : pattern)
                {
                result.add(new Int[items](i -> i == 0 ? prefix : (prefix + suffix[i-1] + 1) % items));
                }
            }
        return result;
        }

    void run()
        {
        @Inject Console console;
        console.print($"permut(3) = {permut(3)}");
        }
    }
Task: Permutations





Java: 
module Permutations
    {
    static Int[][] permut(Int items)
        {
        if (items <= 1)
            {
            
            return items == 1 ? [[0]] : [];
            }

        
        
        Int[][] pattern = permut(items - 1);

        
        
        Int[][] result = new Int[][];
        for (Int prefix : 0 ..< items)
            {
            for (Int[] suffix : pattern)
                {
                result.add(new Int[items](i -> i == 0 ? prefix : (prefix + suffix[i-1] + 1) % items));
                }
            }
        return result;
        }

    void run()
        {
        @Inject Console console;
        console.print($"permut(3) = {permut(3)}");
        }
    }




VB: Public Sub Permute(n As Integer, Optional printem As Boolean = True)

 
Dim P() As Integer
Dim t As Integer, i As Integer, j As Integer, k As Integer
Dim count As Long
Dim Last As Boolean
 
If n <= 1 Then

  Debug.Print "Please give a number greater than 1"
  Exit Sub

End If


ReDim P(n)

For i = 1 To n
  P(i) = i
Next

count = 0
Last = False
 
Do While Not Last
   
   If printem Then

      For t = 1 To n
        Debug.Print P(t);
      Next

      Debug.Print

   End If
   
count = count + 1

Last = True
i = n - 1

   Do While i > 0

     If P(i) < P(i + 1) Then

       Last = False
       Exit Do

     End If

     i = i - 1
   Loop

  j = i + 1
  k = n
  
  While j < k
    
    t = P(j)
    P(j) = P(k)
    P(k) = t
    j = j + 1
    k = k - 1
  Wend
  
  j = n
  
  While P(j) > P(i)
    j = j - 1
  Wend
  
  j = j + 1
  
  t = P(i)
  P(i) = P(j)
  P(j) = t
Loop 
 
Debug.Print "Number of permutations: "; count
 
End Sub
Task: Permutations




Go: package main

import "fmt"

func main() {
    demoPerm(3)
}

func demoPerm(n int) {
    
    s := make([]int, n)
    for i := range s {
        s[i] = i + 1
    }
    
    
    permute(s, func(p []int) { fmt.Println(p) })
}



func permute(s []int, emit func([]int)) {
    if len(s) == 0 {
        emit(s)
        return
    }
    
    
    
    
    
    var rc func(int)
    rc = func(np int) {
        if np == 1 {
            emit(s)
            return
        }
        np1 := np - 1
        pp := len(s) - np1
        
        rc(np1)
        for i := pp; i > 0; i-- {
            s[i], s[i-1] = s[i-1], s[i]
            rc(np1)
        }
        
        w := s[0]
        copy(s, s[1:pp+1])
        s[pp] = w
    }
    rc(len(s))
}




Python: import itertools
for values in itertools.permutations([1,2,3]):
    print (values)
Task: Permutations




Go: package main

import "fmt"

func main() {
    demoPerm(3)
}

func demoPerm(n int) {
    
    s := make([]int, n)
    for i := range s {
        s[i] = i + 1
    }
    
    
    permute(s, func(p []int) { fmt.Println(p) })
}



func permute(s []int, emit func([]int)) {
    if len(s) == 0 {
        emit(s)
        return
    }
    
    
    
    
    
    var rc func(int)
    rc = func(np int) {
        if np == 1 {
            emit(s)
            return
        }
        np1 := np - 1
        pp := len(s) - np1
        
        rc(np1)
        for i := pp; i > 0; i-- {
            s[i], s[i-1] = s[i-1], s[i]
            rc(np1)
        }
        
        w := s[0]
        copy(s, s[1:pp+1])
        s[pp] = w
    }
    rc(len(s))
}





VB: Public Sub Permute(n As Integer, Optional printem As Boolean = True)

 
Dim P() As Integer
Dim t As Integer, i As Integer, j As Integer, k As Integer
Dim count As Long
Dim Last As Boolean
 
If n <= 1 Then

  Debug.Print "Please give a number greater than 1"
  Exit Sub

End If


ReDim P(n)

For i = 1 To n
  P(i) = i
Next

count = 0
Last = False
 
Do While Not Last
   
   If printem Then

      For t = 1 To n
        Debug.Print P(t);
      Next

      Debug.Print

   End If
   
count = count + 1

Last = True
i = n - 1

   Do While i > 0

     If P(i) < P(i + 1) Then

       Last = False
       Exit Do

     End If

     i = i - 1
   Loop

  j = i + 1
  k = n
  
  While j < k
    
    t = P(j)
    P(j) = P(k)
    P(k) = t
    j = j + 1
    k = k - 1
  Wend
  
  j = n
  
  While P(j) > P(i)
    j = j - 1
  Wend
  
  j = j + 1
  
  t = P(i)
  P(i) = P(j)
  P(j) = t
Loop 
 
Debug.Print "Number of permutations: "; count
 
End Sub
Task: Permutations







Python: import itertools
for values in itertools.permutations([1,2,3]):
    print (values)


VB: Public Sub Permute(n As Integer, Optional printem As Boolean = True)

 
Dim P() As Integer
Dim t As Integer, i As Integer, j As Integer, k As Integer
Dim count As Long
Dim Last As Boolean
 
If n <= 1 Then

  Debug.Print "Please give a number greater than 1"
  Exit Sub

End If


ReDim P(n)

For i = 1 To n
  P(i) = i
Next

count = 0
Last = False
 
Do While Not Last
   
   If printem Then

      For t = 1 To n
        Debug.Print P(t);
      Next

      Debug.Print

   End If
   
count = count + 1

Last = True
i = n - 1

   Do While i > 0

     If P(i) < P(i + 1) Then

       Last = False
       Exit Do

     End If

     i = i - 1
   Loop

  j = i + 1
  k = n
  
  While j < k
    
    t = P(j)
    P(j) = P(k)
    P(k) = t
    j = j + 1
    k = k - 1
  Wend
  
  j = n
  
  While P(j) > P(i)
    j = j - 1
  Wend
  
  j = j + 1
  
  t = P(i)
  P(i) = P(j)
  P(j) = t
Loop 
 
Debug.Print "Number of permutations: "; count
 
End Sub
Task: Permutations


C++: #include <algorithm>
#include <string>
#include <vector>
#include <iostream>

template<class T>
void print(const std::vector<T> &vec)
{
    for (typename std::vector<T>::const_iterator i = vec.begin(); i != vec.end(); ++i)
    {
        std::cout << *i;
        if ((i + 1) != vec.end())
            std::cout << ",";
    }
    std::cout << std::endl;
}

int main()
{
    
    std::string example("Hello");
    std::sort(example.begin(), example.end());
    do {
        std::cout << example << '\n';
    } while (std::next_permutation(example.begin(), example.end()));

    
    std::vector<int> another;
    another.push_back(1234);
    another.push_back(4321);
    another.push_back(1234);
    another.push_back(9999);

    std::sort(another.begin(), another.end());
    do {
        print(another);
    } while (std::next_permutation(another.begin(), another.end()));

    return 0;
}






Python: import itertools
for values in itertools.permutations([1,2,3]):
    print (values)
Task: Permutations


C++: #include <algorithm>
#include <string>
#include <vector>
#include <iostream>

template<class T>
void print(const std::vector<T> &vec)
{
    for (typename std::vector<T>::const_iterator i = vec.begin(); i != vec.end(); ++i)
    {
        std::cout << *i;
        if ((i + 1) != vec.end())
            std::cout << ",";
    }
    std::cout << std::endl;
}

int main()
{
    
    std::string example("Hello");
    std::sort(example.begin(), example.end());
    do {
        std::cout << example << '\n';
    } while (std::next_permutation(example.begin(), example.end()));

    
    std::vector<int> another;
    another.push_back(1234);
    another.push_back(4321);
    another.push_back(1234);
    another.push_back(9999);

    std::sort(another.begin(), another.end());
    do {
        print(another);
    } while (std::next_permutation(another.begin(), another.end()));

    return 0;
}







VB: Public Sub Permute(n As Integer, Optional printem As Boolean = True)

 
Dim P() As Integer
Dim t As Integer, i As Integer, j As Integer, k As Integer
Dim count As Long
Dim Last As Boolean
 
If n <= 1 Then

  Debug.Print "Please give a number greater than 1"
  Exit Sub

End If


ReDim P(n)

For i = 1 To n
  P(i) = i
Next

count = 0
Last = False
 
Do While Not Last
   
   If printem Then

      For t = 1 To n
        Debug.Print P(t);
      Next

      Debug.Print

   End If
   
count = count + 1

Last = True
i = n - 1

   Do While i > 0

     If P(i) < P(i + 1) Then

       Last = False
       Exit Do

     End If

     i = i - 1
   Loop

  j = i + 1
  k = n
  
  While j < k
    
    t = P(j)
    P(j) = P(k)
    P(k) = t
    j = j + 1
    k = k - 1
  Wend
  
  j = n
  
  While P(j) > P(i)
    j = j - 1
  Wend
  
  j = j + 1
  
  t = P(i)
  P(i) = P(j)
  P(j) = t
Loop 
 
Debug.Print "Number of permutations: "; count
 
End Sub