Hacker News new | past | comments | ask | show | jobs | submit login
Has this form of the shortcut Collatz conjecture been studied? (desmos.com)
1 point by rpz on Aug 18, 2023 | hide | past | favorite | 1 comment



I was messing around looking into the collatz conjecture in q/k4 and I realized that I could write the short cut collatz function without any conditionals as follows by taking advantage of the fact that you can use the result of x mod 2 to zero out some terms when x is even.

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!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: