主題
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 沒有已知的閉式解


另請參閱

弗羅貝尼烏斯數, 貪婪演算法, 揹包問題, 郵票問題, 子集和問題

使用 探索

參考文獻

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.

在 中被引用

硬幣問題

請引用為

Weisstein, Eric W. "硬幣問題。" 來自 Web 資源。 https://mathworld.tw/CoinProblem.html

主題分類