WLJS LogoWLJS Notebook

NumberDecompose

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

Examples

Decompose into hours, minutes, seconds:

NumberDecompose[3723, {3600, 60, 1}]
(* {1, 2, 3} *)

Money decomposition:

NumberDecompose[87, {20, 10, 5, 1}]
(* {4, 0, 1, 2} *)

Time units:

NumberDecompose[90061, {86400, 3600, 60, 1}]
(* {1, 1, 1, 1} *)

Please visit the official Wolfram Language Reference for more details.

On this page