make digits with arithmetic, not table lookup

I believe the arithmetic method is the more conventional
way to do this.