TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Has this form of the shortcut Collatz conjecture been studied?

1 pointsby rpzalmost 2 years ago

1 comment

rpzalmost 2 years ago
I was messing around looking into the collatz conjecture in q&#x2F;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.<p>note: no operator precedence in q&#x2F;k<p><pre><code> 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 </code></pre> After some algebra I arrived at<p><pre><code> cc:{(x*1+x)-(x div 2)*1+2*x} </code></pre> Figured I&#x27;d share what I found since I don&#x27;t see this formula mentioned on <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Collatz_conjecture" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Collatz_conjecture</a> . Has anybody else encountered this formula?<p>I&#x27;ve linked a chart of the function with its definition in more familiar mathematical notation. It&#x27;s extended onto the reals by utilizing the floor function.<p>PS: Notation is a tool of thought!