# Wolfram Language™

## Decomposition of Numbers

NumberDecompose expresses a number into multiples of units, like currency denominations.

The Bahamian currency (BSD) uses the following banknote denominations.

In:= `denominations = {100, 50, 20, 10, 5, 3, 2, 1, 1/2};`

BSD allows for more possible ways of breaking a given amount into bills relative to other currencies due to the presence of the BSD 3 note. These are the quotients between consecutive denominations.

In:= `Divide @@@ Subsequences[denominations, {2}]`
Out= In most currency systems, only quotients 2 and 5/2 are present, but in this case there are also 5/3 and 3/2.

In:= ```Divide @@@ Subsequences[denominations, {2}]; BarChart[%]```
Out= Decompose an amount of Bahamian dollars in the available banknote denominations.

In:= `NumberDecompose[598.50, denominations]`
Out= Recover the initial amount using NumberCompose.

In:= `NumberCompose[{5, 1, 2, 0, 1, 1, 0, 0, 1.}, denominations]`
Out= This is the amount of money obtained with a banknote of each denomination.

In:= `NumberCompose[Table[1, Length@denominations], denominations] // N`
Out= 