Hi and welcome,e.g.(~collatz = { arg start, limit = 1000;var num = start, col = [start], count = 1;while { (num != 1) and: { count <= limit } }{num = num.even.if { num.div(2) }{ num * 3 + 1 };col = col.add(num);count = count + 1;};col})~collatz.(23)-> [ 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1 ]GreetingsDaniel-----------------------------
http://daniel-mayer.at-----------------------------