Solve the programming task below in a Python markdown code block.
Impliment the reverse function, which takes in input n and reverses it. For instance, `reverse(123)` should return `321`. You should do this without converting the inputted number into a string.
Also feel free to reuse/extend the following starter code:
```python
def reverse(n):
```