Given an input n, if n is of the form 3k then output 5k+6
if n is of the form 3k+1 then output 5k+9
if n is of the form 3k+2 then halt
So starting with 0, which is of the form 3x0, we go to 5x0+6=6, then to 5x2+6=16. Because 16 is 3x5+1 we then go to 25+9=34, etc.
The bb program is made such that one computation of the function takes an insane long time.
By the way Conway proved [0] that any computer program can be rewritten in the form of these collatz like functions. So they are pretty prowerful.
[0]: https://en.wikipedia.org/wiki/Collatz_conjecture#Undecidable...