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 allclose all

Basic Examples  (1)

Express an integer as a list of digits in a mixed radix numerical system:

Reconstruct that number:

Scope  (5)

Use IntegerDigits with a mixed radix:

Use FromDigits with a mixed radix:

Use BaseForm with a mixed radix:

Use IntegerLength with a mixed radix:

Use IntegerReverse with a mixed radix:

Applications  (3)

A primorial number system uses a mixed radix of primes:

A factorial number system uses a range of integers as mixed radix. The last digit is always 0:

Construct a list from the names of tactical units in a Roman army:

A legion was made of 10 cohorts, a cohort of 6 centuries, a century of 10 contuberniae, and a contubernia of 8 soldiers:

Decompose a number of Roman soldiers in these tactical units:

Conversely, this is the number of soldiers in a legion:

Properties & Relations  (6)

IntegerDigits with a single base is equivalent to a MixedRadix list repeating that base:

The inverse operation of IntegerDigits with a mixed radix is performed by FromDigits with the same mixed radix:

The digit at a given position can be between 0 and the corresponding base minus one:

The next number will need one more digit:

That result is equivalent to using a list of bases prepended with Infinity:

Any positive integer is then representable:

The use of the Infinity base is made explicit by BaseForm:

An empty list of bases is effectively equivalent to the list {Infinity}:

IntegerDigits with a MixedRadix specification performs a NumberDecompose operation:

FromDigits with a MixedRadix specification performs a NumberCompose operation:

Wolfram Research (2015), MixedRadix, Wolfram Language function, https://reference.wolfram.com/language/ref/MixedRadix.html.

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_2023_mixedradix, author="Wolfram Research", title="{MixedRadix}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/MixedRadix.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_mixedradix, organization={Wolfram Research}, title={MixedRadix}, year={2015}, url={https://reference.wolfram.com/language/ref/MixedRadix.html}, note=[Accessed: 19-March-2024 ]}