by rpz on 8/18/23, 3:27 AM with 1 comments
by rpz on 8/18/23, 3:27 AM
note: no operator precedence in q/k
q)cc:{(x+(2*x*m)+m:x mod 2)div 2}
q)cc til 20
0 2 1 5 2 8 3 11 4 14 5 17 6 20 7 23 8 26 9 29
After some algebra I arrived at cc:{(x*1+x)-(x div 2)*1+2*x}
Figured I'd share what I found since I don't see this formula mentioned on https://en.wikipedia.org/wiki/Collatz_conjecture . Has anybody else encountered this formula?I've linked a chart of the function with its definition in more familiar mathematical notation. It's extended onto the reals by utilizing the floor function.
PS: Notation is a tool of thought!