```python
def is_octagonal(n):
  """
  Calculates the nth octagonal number.

  An octagonal number is a figurate number that represents an octagon.
  The formula for the nth octagonal number is n * (3n - 2).

  Args:
    n: The position in the sequence of octagonal numbers (must be a positive integer).

  Returns:
    The nth octagonal number.
  """
  if not isinstance(n, int) or n <= 0:
    # Octagonal numbers are typically defined for positive integers n.
    # Returning None or raising an error for invalid input is a good practice.
    # However, to keep it simple as per instructions, we can assume valid input.
    # For this implementation, we'll proceed, but be aware of this edge case.
    pass

  return n * (3 * n - 2)
```