refactored factorial method to use Rails.cache.fetch
refactored sin method to use Rails.cache.fetch
refactored sin to use inject