Skip to content

NumeralSystemShape ​

What a system's numerals look like, as a Dictionary: whether it is a bijection, which integers it spells, and with which digits.

NumeralSystemShape(system)Bijective, Integers, and when they apply Digits (one set, or one per place), Width and Rule
Typed signatures
TypePackageApplies
(any) -> dictionarynumeralsalways

Domain: Numeral systems

Details
  • Digits is one set when every place shares it, and a list — most significant first — when places differ, as in a mixed radix or a residue system
  • Rule names a constraint no per-place bound captures: Zeckendorf's no two adjacent ones, Ostrowski's ceiling rule
  • A residue system whose moduli share a factor still spells every integer below ∏mi\prod m_i, but not uniquely: Bijective is False

Examples

Basic #

4 and 6 share a factor, so this is not a bijection

live ↗
InNumeralSystemShape(ResidueNumerals([4,6]))\mathrm{NumeralSystemShape}(\mathrm{ResidueNumerals}(\bigl\lbrack4, 6\bigr\rbrack))Out{Bijective→False,  Integers→0..23,  Digits→[0..3,0..5],  Width→2}\left\lbrace \text{Bijective}→\mathrm{False},\;\text{Integers}→0..23,\;\text{Digits}→\bigl\lbrack0..3, 0..5\bigr\rbrack,\;\text{Width}→2\right\rbrace
Scope #
live ↗
InNumeralSystemShape(ZeckendorfNumerals)\mathrm{NumeralSystemShape}(\mathrm{ZeckendorfNumerals})Out{Bijective→True,  Integers→N,  Digits→0..1,  Rule→no two adjacent ones}\left\lbrace \text{Bijective}→\mathrm{True},\;\text{Integers}→ℕ,\;\text{Digits}→0..1,\;\text{Rule}→ \text{no two adjacent ones}\right\rbrace

ordinary base 2, in the same shape every other system reports

live ↗
InNumeralSystemShape(PositionalNumerals(2))\mathrm{NumeralSystemShape}(\mathrm{PositionalNumerals}(2))Out{Bijective→True,  Integers→N,  Digits→0..1}\left\lbrace \text{Bijective}→\mathrm{True},\;\text{Integers}→ℕ,\;\text{Digits}→0..1\right\rbrace

every integer, negatives included, with no sign

live ↗
InNumeralSystemShape(BalancedNumerals(3))\mathrm{NumeralSystemShape}(\mathrm{BalancedNumerals}(3))Out{Bijective→True,  Integers→Z,  Digits→(−1)..1}\left\lbrace \text{Bijective}→\mathrm{True},\;\text{Integers}→ℤ,\;\text{Digits}→(-1)..1\right\rbrace
About
Examples4

See also: IntegerDigits, FromDigits