主题
Search

硬币问题


设有 n>=2整数 0<a_1<...<a_n,其中 GCD(a_1,a_2,...,a_n)=1。值 a_i 表示 n 种不同硬币的面额,其中这些面额的最大公约数为 1。则可以使用给定硬币表示的金额总和由下式给出

 N=sum_(i=1)^na_ix_i,
(1)

其中 x_i 是给出每种硬币使用数量的非负整数。如果 a_1=1,显然可以表示任何数量的钱 N。然而,在一般情况下,只能产生某些数量 N。例如,如果允许的硬币是 (2,5,10),则不可能表示 N=1 和 3,尽管所有其他数量都可以表示。

确定函数 g(a_1,a_2,...,a_n) 给出最大 N=g(a_1,a_2,...,a_n) 且无解的情况,称为硬币问题,或有时称为换钱问题。给定问题的最大此类 N 称为弗罗贝尼乌斯数 g(a_1,a_2,...)

结果

g(a_1,a_2)=(a_1-1)(a_2-1)-1
(2)
=a_1a_2-(a_1+a_2)
(3)

(Nijenhuis 和 Wilf 1972) 是数学界的共识。这种不可表示的金额总数由下式给出

 1/2(N+1)=1/2(a_1-1)(a_2-1).
(4)

两种面额为 a_1a_2 的硬币的最大不可表示金额 g(a_1,a_2) 总结如下。

a_1a_2g(a_1,a_2)a_1a_2g(a_1,a_2)
2314717
2534923
2755619
2975723
3455827
3575931
37116729
38137841
310177947
451171053

对于三个数字,快速算法也是已知的,但是对于任意数量的数字的更一般问题,如果 n 是固定的 (Kannan 1992) 或 n 是可变的 (Ramírez-Alfonsín 1996),则已知是 NP-hard 的。

对于 n=3 没有闭式解,尽管已知半显式解,该解允许快速计算值 (Selmer 和 Beyer 1978, Rödseth 1978, Greenberg 1988; Beck 和 Robins 2006)。 小 a_i 的值总结如下。

ag(a)ag(a)
(2,3,4)1(2,4,7)5
(2,3,5)1(2,5,6)3
(2,3,6)1(2,5,7)3
(2,3,7)1(2,6,7)5
(2,4,5)3(3,4,5)2

对于 n>4 没有已知的闭式解


另请参阅

弗罗贝尼乌斯数, 贪婪算法, 背包问题, 邮票问题, 子集和问题

使用 Wolfram|Alpha 探索

参考文献

Beck, M. and Robins, S. "The Coin-Exchange Problem of Frobenius." §C1 in Computing the Continuous Discretely. New York: Springer, pp. 3-23, 2006. http://math.sfsu.edu/beck/ccd.html.Berlekamp, E. R.; Conway, J. H; and Guy, R. K. Winning Ways for Your Mathematical Plays, Vol. 2: Games in Particular. London: Academic Press, 1982.Brauer, A. "On a Problem of Partitions." Amer. J. Math. 64, 299-312, 1942.Brauer, A. and Seelbinder, B. M. "On a Problem of Partitions. II." Amer. J. Math. 76, 343-346, 1954.Davison, J. L. "On the Linear Diophantine Problem of Frobenius." J. Number Th. 48, 353-363, 1994.Greenberg, H. "Solution to a Linear Diophantine Equation for Nonnegative Integers." J. Algorithms 9, 343-353, 1988.Guy, R. K. "The Money-Changing Problem." §C7 in Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, pp. 113-114, 1994.Kannan, R. "Lattice Translates of a Polytope and the Frobenius Problem." Combinatorica 12, 161-177, 1992.Nabiyev, V. V. Algorithms: From Theory to Applications. Ankara, Turkey: Seckin, p. 799, 2007.Nijenhuis, A. "A Minimal-Path Algorithm for the 'Money Changing Problem.' " Amer. Math. Monthly 86, 832-835, 1979.Nijenhuis, A. and Wilf, H. S. "Representations of Integers by Linear Forms in Nonnegative Integers." J. Number Th. 4, 98-106, 1972.Ramírez-Alfonsín, J. L. "Complexity of the Frobenius Problem." Combinatorica 16, 143-147, 1996.Ramírez-Alfonsín, J. L. The Diophantine Frobenius Problem. Oxford, England: Oxford University Press, 2005.Rødseth, Ø. J. "On a Linear Diophantine Problem of Frobenius." J. reine angew. Math. 301, 171-178, 1978.Rødseth, Ø. J. "On a Linear Diophantine Problem of Frobenius. II." J. reine angew. Math. 307/308, 431-440, 1979.Selmer, E. S. "The Linear Diophantine Problem of Frobenius." J. reine angew. Math. 293/294, 1-17, 1977.Selmer, E. S. and Beyer, Ö. "On the Linear Diophantine Problem of Frobenius in Three Variables." J. reine angew. Math. 301, 161-170, 1978.Sylvester, J. J. "Question 7382." Mathematical Questions from the Educational Times 41, 21, 1884. Wagon, S. "Greedy Coins." http://library.wolfram.com/infocenter/MathSource/5187/.Wilf, H. "A Circle of Lights Algorithm for the 'Money Changing Problem.' " Amer. Math. Monthly 85, 562-565, 1978.

在 Wolfram|Alpha 中被引用

硬币问题

请引用为

Weisstein, Eric W. "硬币问题。" 来自 MathWorld--Wolfram Web 资源。 https://mathworld.net.cn/CoinProblem.html

主题分类