Пример #1
0
    public static void frobenius_number_order2_test( )

    //****************************************************************************80
    //
    //  Purpose:
    //
    //   FROBENIUS_NUMBER_ORDER2_TEST tests FROBENIUS_NUMBER_ORDER2.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    20 January 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int c1     = 0;
        int c2     = 0;
        int f1     = 0;
        int f2     = 0;
        int n_data = 0;

        Console.WriteLine("");
        Console.WriteLine("FROBENIUS_NUMBER_ORDER2_TEST");
        Console.WriteLine("  FROBENIUS_NUMBER_ORDER2 computes Frobenius numbers of order 2.");
        Console.WriteLine("");
        Console.WriteLine("        C1        C1   exact F  comput F");
        Console.WriteLine("");

        n_data = 0;

        for ( ; ;)
        {
            Burkardt.Values.Frobenius.frobenius_number_order2_values(ref n_data, ref c1, ref c2, ref f1);

            if (n_data == 0)
            {
                break;
            }

            f2 = Frobenius.frobenius_number_order2(c1, c2);

            Console.WriteLine("  " + c1.ToString().PadLeft(8)
                              + "  " + c2.ToString().PadLeft(8)
                              + "  " + f1.ToString().PadLeft(8)
                              + "  " + f2.ToString().PadLeft(8) + "");
        }
    }
Пример #2
0
    public static void frobenius_number_data_values_test()
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    FROBENIUS_NUMBER_DATA_VALUES_TEST tests FROBENIUS_NUMBER_DATA_VALUES.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    27 January 2015
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int f     = 0;
        int order = 0;

        Console.WriteLine("");
        Console.WriteLine("FROBENIUS_NUMBER_DATA_VALUES_TEST:");
        Console.WriteLine("  FROBENIUS_NUMBER_DATA_VALUES returns the corresponding");
        Console.WriteLine("  coin denominations.");
        int n_data = 0;

        for (;;)
        {
            Frobenius.frobenius_number_order_values(ref n_data, ref order);
            if (n_data == 0)
            {
                break;
            }

            int[] c = new int[order];
            Frobenius.frobenius_number_data_values(ref n_data, order, ref c, ref f);
            Console.WriteLine("");
            Console.WriteLine("  Order = " + order + "");
            string cout = "";
            int    i;
            for (i = 0; i < order; i++)
            {
                cout += "  " + c[i].ToString().PadLeft(8);
            }

            Console.WriteLine(cout);
            Console.WriteLine("  Frobenius number = " + f + "");
        }
    }
Пример #3
0
    public static void frobenius_number_order2_values_test()
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    FROBENIUS_NUMBER_ORDER2_VALUES_TEST tests FROBENIUS_NUMBER_ORDER2_VALUES.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    20 January 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int c1 = 0;
        int c2 = 0;
        int f  = 0;

        Console.WriteLine("");
        Console.WriteLine("FROBENIUS_NUMBER_ORDER2_VALUES_TEST:");
        Console.WriteLine("  FROBENIUS_NUMBER_ORDER2_VALUES returns values of ");
        Console.WriteLine("  the Frobenius number of order 2.");
        Console.WriteLine("");
        Console.WriteLine("         C1        C2          F(C1,C2)");
        Console.WriteLine("");
        int n_data = 0;

        for (;;)
        {
            Frobenius.frobenius_number_order2_values(ref n_data, ref c1, ref c2, ref f);
            if (n_data == 0)
            {
                break;
            }

            Console.WriteLine("  " + c1.ToString().PadLeft(8)
                              + "  " + c2.ToString().PadLeft(8)
                              + "  " + f.ToString().PadLeft(8) + "");
        }
    }
Пример #4
0
    public static void frobenius_number_order_values_test()
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    FROBENIUS_NUMBER_ORDER_VALUES tests FROBENIUS_NUMBER_ORDER_VALUES.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    27 January 2015
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int order = 0;

        Console.WriteLine("");
        Console.WriteLine("FROBENIUS_NUMBER_ORDER_VALUES_TEST:");
        Console.WriteLine("  FROBENIUS_NUMBER_ORDER_VALUES returns the order for");
        Console.WriteLine("  a Frobenius problem;");
        Console.WriteLine("");
        Console.WriteLine("   Problem   ORDER");
        Console.WriteLine("");
        int n_data = 0;

        for (;;)
        {
            Frobenius.frobenius_number_order_values(ref n_data, ref order);
            if (n_data == 0)
            {
                break;
            }

            Console.WriteLine("");
            Console.WriteLine("  " + n_data.ToString().PadLeft(4)
                              + "  " + order.ToString().PadLeft(4) + "");
        }
    }