Skip to main content
3 of 4
added 225 characters in body
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Python 3.8+,  45  39 bytes

-2 thanks to xnor (while print(...)!=0:while[print(...)]:)
-4 thanks to Neil ([a*n,a//n][a>n]a//n or a*n)

a=n=1
while[print(a:=a//n or a*n)]:n+=1

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

Try it online!


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])
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282