๐ Baseโb Recursive Listing Method
๐ง Concept
- Idea: Because of positional representation, each digit โswitchesโ every power of the base according to how far it is from the smallest unit.
- Implication: For base $b$, the $2^\text{nd}$ row (from the top) changes every $b$ entries, the $3^\text{rd}$ row every $b^2$ entries, etc.
- Result: To list all combinations up to some digit depth, draw blocks whose sizes are powers of $b$ and recursively split each block into $b$ parts.
๐ข Example: base $3$, up to the $3^\text{rd}$ digit (MSD โ LSD)
First row (MSD):
- Block size: $3^2=9$
- Action: Write each digit $0,1,2$ exactly $9$ times in sequence.
Second row (middle digit):
- Inside each MSD block of $9$: split into $3$ parts of size $3$ and label them $0,1,2$.
Third row (LSD):
- Inside each sizeโ$3$ block: split into $3$ single entries and label them $0,1,2$.
This produces every ternary triple from $000$ to $222$ in lexicographic order.
๐งญ General method (baseโagnostic)
$b$ for base
- At the Most Significant Digit (leftmost digit),
- List $b^{(\text{positions from the first digit})}$
- Incrementally from $0$ to $(\text{base}-1)$,
- Then split each part into $b$ parts recursively until you reach the LSD.
- List $b^{(\text{positions from the first digit})}$
Recursively here means you do the same splitting for each sub-part
Last updated on