MixedRadix[{b1,…,bn}]
represents the list of bases of a numerical system in which different digits have different bases.
MixedRadix
MixedRadix[{b1,…,bn}]
represents the list of bases of a numerical system in which different digits have different bases.
Details
- A numeric system with bases {b1,…,bn} can express numbers from 0 to b1×b2×…×bn-1. Larger numbers are represented using an extended list of bases, effectively prepended with base Infinity.
Examples
open all close allBasic Examples (1)
Scope (5)
Use IntegerDigits with a mixed radix:
IntegerDigits[534, MixedRadix[{15, 10, 5}]]Use FromDigits with a mixed radix:
FromDigits[{10, 6, 4}, MixedRadix[{15, 10, 5}]]Use BaseForm with a mixed radix:
BaseForm[{10, 6, 4}, MixedRadix[{15, 10, 5}]]Use IntegerLength with a mixed radix:
IntegerLength[1024, MixedRadix[{6, 4, 2}]]Use IntegerReverse with a mixed radix:
IntegerReverse[1024, MixedRadix[{6, 4, 2}]]Applications (3)
A primorial number system uses a mixed radix of primes:
IntegerDigits[10 ^ 6, MixedRadix[{19, 17, 13, 11, 7, 5, 3, 2}]]A factorial number system uses a range of integers as mixed radix. The last digit is always 0:
IntegerDigits[437, MixedRadix[{6, 5, 4, 3, 2, 1}]]Construct a list from the names of tactical units in a Roman army:
units = {"legion", "cohort", "century", "contubernia", "soldier"};A legion was made of 10 cohorts, a cohort of 6 centuries, a century of 10 contuberniae, and a contubernia of 8 soldiers:
bases = MixedRadix[{10, 6, 10, 8}];Decompose a number of Roman soldiers in these tactical units:
IntegerDigits[16894, bases]Thread[units -> %]Conversely, this is the number of soldiers in a legion:
FromDigits[{1, 0, 0, 0, 0}, bases]Properties & Relations (6)
IntegerDigits with a single base is equivalent to a MixedRadix list repeating that base:
IntegerDigits[4237, 10]IntegerDigits[4237, MixedRadix[{10, 10, 10, 10}]]The inverse operation of IntegerDigits with a mixed radix is performed by FromDigits with the same mixed radix:
IntegerDigits[2135, MixedRadix[{10, 8, 6, 4, 2}]]FromDigits[%, MixedRadix[{10, 8, 6, 4, 2}]]The digit at a given position can be between 0 and the corresponding base minus one:
n = 10 9 8 7 - 1IntegerDigits[n, MixedRadix[{10, 9, 8, 7}]]The next number will need one more digit:
IntegerDigits[n + 1, MixedRadix[{10, 9, 8, 7}]]That result is equivalent to using a list of bases prepended with Infinity:
IntegerDigits[n + 1, MixedRadix[{Infinity, 10, 9, 8, 7}]]Any positive integer is then representable:
IntegerDigits[10 ^ 5, MixedRadix[{Infinity, 10, 9, 8, 7}]]The use of the Infinity base is made explicit by BaseForm:
IntegerDigits[10 ^ 5, MixedRadix[{10, 9, 8, 7}]]BaseForm[%, MixedRadix[{10, 9, 8, 7}]]An empty list of bases is effectively equivalent to the list {Infinity}:
IntegerDigits[1000, MixedRadix[{}]]IntegerDigits[1000, MixedRadix[{Infinity}]]IntegerDigits with a MixedRadix specification performs a NumberDecompose operation:
IntegerDigits[10 ^ 4, MixedRadix[{24, 60, 60}]]NumberDecompose[10 ^ 4, {60 60, 60, 1}]FromDigits with a MixedRadix specification performs a NumberCompose operation:
FromDigits[{2, 46, 40}, MixedRadix[{24, 60, 60}]]NumberCompose[{2, 46, 40}, {60 60, 60, 1}]Related Guides
History
Text
Wolfram Research (2015), MixedRadix, Wolfram Language function, https://reference.wolfram.com/language/ref/MixedRadix.html.
CMS
Wolfram Language. 2015. "MixedRadix." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MixedRadix.html.
APA
Wolfram Language. (2015). MixedRadix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MixedRadix.html
BibTeX
@misc{reference.wolfram_2026_mixedradix, author="Wolfram Research", title="{MixedRadix}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/MixedRadix.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_mixedradix, organization={Wolfram Research}, title={MixedRadix}, year={2015}, url={https://reference.wolfram.com/language/ref/MixedRadix.html}, note=[Accessed: 12-June-2026]}