コード例 #1
0
    public static void Test11()
    {
        const int number = 5;

        PartitionSet set = PartitionsCalculator.Calculate(number);

        Console.WriteLine("Partitions of {0}:", set.Number);
        Console.WriteLine("{0}", set);

        int numPartitions = PartitionsCalculator.NumberOfPartitions(number);

        Console.WriteLine("b({0}) = {1}", number, numPartitions);
    }
コード例 #2
0
    public static void Test10b()
    {
        PartitionSet set = PartitionsCalculator.Calculate(5);

        Console.WriteLine("Partitions of {0}:", set.Number);
        Console.WriteLine("{0}", set);

        int n;

        n = PartitionsCalculator.NumberOfPartitions(5, 1);
        Console.WriteLine("b(5,1) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(5, 2);
        Console.WriteLine("b(5,2) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(5, 3);
        Console.WriteLine("b(5,3) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(5, 4);
        Console.WriteLine("b(5,4) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(5, 5);
        Console.WriteLine("b(5,5) = {0}", n);
        Console.WriteLine();
    }
コード例 #3
0
    public static void Test10a()
    {
        PartitionSet set = PartitionsCalculator.Calculate(7);

        Console.WriteLine("Partitions of {0}:", set.Number);
        Console.WriteLine("{0}", set);

        int n;

        n = PartitionsCalculator.NumberOfPartitions(7, 1);
        Console.WriteLine("b(7,1) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(7, 2);
        Console.WriteLine("b(7,2) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(7, 3);
        Console.WriteLine("b(7,3) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(7, 4);
        Console.WriteLine("b(7,4) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(7, 5);
        Console.WriteLine("b(7,5) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(7, 6);
        Console.WriteLine("b(7,6) = {0}", n);
        n = PartitionsCalculator.NumberOfPartitions(7, 7);
        Console.WriteLine("b(7,7) = {0}", n);
    }