added implementation for fourth number - TODO: must refactor conditional complexity
refactored to use a recursive function implementation