PERF: Avoid np.divmod in maybe_sequence_to_range
xref https://github.com/pandas-dev/pandas/pull/57534#issuecomment-1957832841

Made a `is_range` method (like `is_range_indexer`) that avoids a `np.divmod` operation

```python
In [1]: from pandas import *; import numpy as np
   ...: np.random.seed(123)
   ...: size = 1_000_000
   ...: ngroups = 1000
   ...: data = Series(np.random.randint(0, ngroups, size=size))
+ /opt/miniconda3/envs/pandas-dev/bin/ninja
[1/1] Generating write_version_file with a custom command

In [2]: %timeit data.groupby(data).groups
14 ms ± 552 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)  # PR

In [3]: %timeit data.groupby(data).groups
17.8 ms ± 84.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)  # main
```

Any other feedback here @jbrockmendel @WillAyd?