# [Python 3.8+], 45 bytes

<!-- language-all: lang-python -->

    a=n=1
    while print(a:=[a*n,a//n][a>n])!=0:n+=1

A full program which prints \$a(n)\$ for all natural numbers.

**[Try it online!][TIO-khxsbnhv]**

---
As a recursive function, 53:

    f=lambda v,n=1,a=1:a*(v<n)or f(v,n+1,[a*n,a//n][a>n])

[Python 3.8+]: https://docs.python.org/3.8/
[TIO-khxsbnhv]: https://tio.run/##K6gsycjPM7YoKPr/P9E2z9aQqzwjMydVoaAoM69EI9HKNjpRK08nUV8/LzY60S4vVlPR1sAqT9vW8P9/AA "Python 3.8 (pre-release) – Try It Online"