The beauty of mixed-radix bases
firefly.nu
firefly.nu
But maybe the definition isn't this picky. They certainly feel like different concepts to me though.
And giving arrays the same treatment then seems reasonable for consistency?
I always saw 0-based indices as offsets. Ie like their C interpretation, where a[i] is defined to be the same as * (a+i), not the less natural *(a+i+1).
But I can see some points for 1 based indexing, too.
(Anecdote from university: the math faculty had a building that started numbering the ground floor as -1. Perhaps just to one up (or is that one down?) the computer scientists who always feel smug about counting from 0.)
Compare the locations of the 1's in `array` (the output with 0's and 1's) with the final output (`0 1 1` is the index of the first 1, `1 1 2` is the index of the second 1).
Does that help? I mainly wanted to show how the base conversion <=> array index relationship could be used in practice.