input: Write a function to calculate the nth centered hexagonal number.
  assert centered_hexagonal(10) == 271
  assert centered_hexagonal(2) == 7
  assert centered_hexagonal(9) == 217
output: def centered_hexagonal(n):
      return 3 * n * (n - 1) + 1