% for testing purposes it is not convenient to generate
% random numbers because you have generate a lot of
% random numbers before you get numbers with 1, 2, 3, ...
% digits
%
% instead change the value of n to some number with
% the number of digits that you want to test
n = 32

% consider the following values of n having 1 digit
%
% 1, 2, 3, 4, 5, 6, 7, 8, 9
%
% the log-base10 of each of these values is greater than
% or equal to 0 and less than 1
%
% consider the following values of n having 2 digits
%
% 10, 11, 12, ..., 99
%
% the log-base10 of each of these values is greater than
% or equal to 1 and less than 2
%
% consider the following values of n having 3 digits
%
% 100, 101, 102, ..., 999
%
% the log-base10 of each of these values is greater than
% or equal to 2 and less than 3
%
% to get the number of digits we compute the log-base10
% of n, round down, and then add 1
%
% in Matlab, the function log10 is not defined for 
% values of type int64 so we have convert the
numDigits = floor(log10(n)) + 1


% note that this solution fails if n is negative and for exactly
% one other value of n; what other value does this solution
% fail for?
