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  (2)

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

Reconstruct that number:

Make explicit the bases used:

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:

Introduced in 2015
 (10.2)