-Changed method to determine needed size of output array size from sqrt of input to logarithm digitalis of input.
-Added if-else construct to determine if input is negative and therefore output-array has to be size n+1 instead of n