Beispiel #1
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 + "");
        }
    }
Beispiel #2
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) + "");
        }
    }