input: Write a function to detect consecutive numbers in a list.
  assert detect_pattern([1, 2, 3, 5, 6, 8, 9, 10]) == [1, 2, 2, 3, 5, 6, 8, 9, 9, 10]
  assert detect_pattern([4, 5, 7, 8, 10]) == [4, 5, 7, 8]
  assert detect_pattern([11, 12, 13, 15, 16, 20]) == [11, 12, 12, 13, 15, 16]
output: def detect_pattern(lst):
      result = []
      i = 0
      while i < len(lst):
          result.append(lst[i])
          if i + 1 < len(lst) and lst[i] + 1 == lst[i + 1]:
              result.append(lst[i + 1])
              i += 1
          i += 1
      return result