Solution to factorial_ranges