Ejemplo n.º 1
0
        static void OeisPartitions()
        {
            var t    = Partitions.PartitionTree(6);
            var tour = new Tour(t);

            Console.WriteLine("A228100 (Fenner-Loizou tree, level order)");
            Traverse(tour, Traversal.PostOrder, Visitor.Conjugate, Direction.RightLeft);
            //Traverse(tour, Traversal.LevelOrder, Visitor.Partition, Direction.LeftRight);
            Console.ReadLine();

            Console.WriteLine("A036036 (Hindenburg, Abramowitz-Stegun)");
            Traverse(tour, Traversal.PreOrder, Visitor.ReverseConjugate, Direction.LeftRight);
            //Traverse(tour, Traversal.BranchOrder, Visitor.ReverseConjugate, Direction.RightLeft);
            Console.ReadLine();

            Console.WriteLine("A080577 (Mathematica, Sage, Magma)");
            Traverse(tour, Traversal.PostOrder, Visitor.Partition, Direction.RightLeft);
            //Traverse(tour, Traversal.LevelOrder, Visitor.Conjugate, Direction.LeftRight);
            Console.ReadLine();

            Console.WriteLine("A080576 (Maple)");
            Traverse(tour, Traversal.PreOrder, Visitor.Reverse, Direction.LeftRight);
            //Traverse(tour, Traversal.BranchOrder, Visitor.Reverse, Direction.RightLeft);
            Console.ReadLine();

            Console.WriteLine("A036037");
            Traverse(tour, Traversal.PreOrder, Visitor.Conjugate, Direction.LeftRight);
            //Traverse(tour, Traversal.BranchOrder, Visitor.Conjugate, Direction.RightLeft);
            Console.ReadLine();

            Console.WriteLine("A182937");
            Traverse(tour, Traversal.PreOrder, Visitor.Partition, Direction.RightLeft);
            //Traverse(tour, Traversal.BranchOrder, Visitor.Partition, Direction.LeftRight);
            Console.ReadLine();

            Console.WriteLine("A193073");
            Traverse(tour, Traversal.PreOrder, Visitor.Partition, Direction.LeftRight);
            //Traverse(tour, Traversal.BranchOrder, Visitor.Partition, Direction.RightLeft);
            Console.ReadLine();

            ShowAllTraversals(t);
            Console.ReadLine();

            // Prime-encodings
            // A036035, A059901, A063008, A227955, A228099
        }
Ejemplo n.º 2
0
        private void buttonRun_Click(object sender, EventArgs e)
        {
            seq = comboBoxOEIS.SelectedIndex;
            if (seq > 0)
            {
                var oeis = Generator.oeis;
                WriteLineToBox(oeis[seq - 1].Item1);
            }

            if (n != lastn)
            {
                tree  = Partitions.PartitionTree(n);
                lastn = n;
            }

            var tour = new Tour(tree);

            Generator.Traverse(tour, traversal, visitor, direction);
            var count = tree.Count(tree.GetRoot()).ToString();

            WriteLineToBox("Number of partitions: " + count);
            WriteLineToBox("");
        }