input: Write a python function to compute the sum of all numbers from 1 to n.
  assert sum_to_n(10) == 55
  assert sum_to_n(5) == 15
  assert sum_to_n(0) == 0
  assert sum_to_n(-5) == 0
output: def sum_to_n(n):
      if n < 1:
          return 0
      return n * (n + 1) // 2