Write a function to find nth centered hexagonal number.
def centered_hexagonal_number(n):
  return 3 * n * (n - 1) + 1
<s>[INST]<<SYS>>Given a task and its code, generate test cases for the code.<</SYS>>Write a function to find nth centered hexagonal number.
def centered_hexagonal_number(n):
  return 3 * n * (n - 1) + 1[/INST]assert centered_hexagonal_number(10) == 271
assert centered_hexagonal_number(2) == 7
assert centered_hexagonal_number(9) == 217</s>