Adding "n-ary" object generator

Generalizes binary, trinary, and similar,
as long as all the valid digits are numbers.
Using "n-ary" generator in "binary" solution
Adding "trinary" solution

Uses "n-ary" generator, so it's really small.