Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

NumberDecompose

NumberDecompose[x,{u1,,un}]
returns a list of coefficients {c1,,cn} of a decomposition of the number x in the basis {u1,,un}.

DetailsDetails

  • The basis {u1,,un} must be a list of nonincreasing positive numbers.
  • The result has the same length of the basis, even if the initial coefficients are zero.
  • The coefficients {c1,,cn-1} are integers, but cn will be exact or not depending on the precision of x and the basis elements.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Decompose an amount of money in different denominations:

In[1]:=
Click for copyable input
Out[1]=

Decompose an amount of seconds in days, hours, minutes, and seconds:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2015
(10.2)