<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bbchallenge.org/w/index.php?action=history&amp;feed=atom&amp;title=Consistent_Collatz</id>
	<title>Consistent Collatz - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bbchallenge.org/w/index.php?action=history&amp;feed=atom&amp;title=Consistent_Collatz"/>
	<link rel="alternate" type="text/html" href="https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;action=history"/>
	<updated>2026-04-30T17:49:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=7325&amp;oldid=prev</id>
		<title>Polygon: Linked piecewise affine function</title>
		<link rel="alternate" type="text/html" href="https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=7325&amp;oldid=prev"/>
		<updated>2026-04-27T14:50:21Z</updated>

		<summary type="html">&lt;p&gt;Linked piecewise affine function&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:50, 27 April 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &#039;&#039;&#039;consistent Collatz&#039;&#039;&#039; function is a [[Generalized Collatz Function]] (GCF) with the same coefficient in each piecewise affine function. In other words, it is a function &amp;lt;math&amp;gt;g: \mathbb{N} \to \mathbb{N}&amp;lt;/math&amp;gt; defined as:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &#039;&#039;&#039;consistent Collatz&#039;&#039;&#039; function is a [[Generalized Collatz Function]] (GCF) with the same coefficient in each &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Piecewise Affine Function|&lt;/ins&gt;piecewise affine function&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]]&lt;/ins&gt;. In other words, it is a function &amp;lt;math&amp;gt;g: \mathbb{N} \to \mathbb{N}&amp;lt;/math&amp;gt; defined as:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;g(x) = \begin{cases}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;g(x) = \begin{cases}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-6859:rev-7325:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Polygon</name></author>
	</entry>
	<entry>
		<id>https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=6859&amp;oldid=prev</id>
		<title>Polygon: Added Category:Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=6859&amp;oldid=prev"/>
		<updated>2026-03-31T10:52:54Z</updated>

		<summary type="html">&lt;p&gt;Added Category:Functions&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:52, 31 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l152&quot;&gt;Line 152:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 152:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This implementation is probably not suitable for serious use due to having poor constant factors: a faster implementation would use an alternative algorithm for low &amp;lt;math&amp;gt;f(n)&amp;lt;/math&amp;gt; values. It is also intened only for &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, because the complexity result is dependent on modulus by powers of &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; being fast regardless of the size of the dividend, but gmpy2 is only able to store numbers in binary and that operation is quick only if the modulus is a power of the base. As such, a full implementation of efficient consistent Collatz calculation would probably involve writing a new arbitrarily-large-integers library which is able to store numbers in arbitrary bases.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This implementation is probably not suitable for serious use due to having poor constant factors: a faster implementation would use an alternative algorithm for low &amp;lt;math&amp;gt;f(n)&amp;lt;/math&amp;gt; values. It is also intened only for &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, because the complexity result is dependent on modulus by powers of &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; being fast regardless of the size of the dividend, but gmpy2 is only able to store numbers in binary and that operation is quick only if the modulus is a power of the base. As such, a full implementation of efficient consistent Collatz calculation would probably involve writing a new arbitrarily-large-integers library which is able to store numbers in arbitrary bases.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Functions]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-4862:rev-6859:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Polygon</name></author>
	</entry>
	<entry>
		<id>https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=4862&amp;oldid=prev</id>
		<title>Sligocki: Update lede to refer to GCF</title>
		<link rel="alternate" type="text/html" href="https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=4862&amp;oldid=prev"/>
		<updated>2025-10-28T18:30:55Z</updated>

		<summary type="html">&lt;p&gt;Update lede to refer to GCF&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:30, 28 October 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &#039;&#039;&#039;consistent Collatz&#039;&#039;&#039; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sequence &lt;/del&gt;is a [[Collatz&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-like&lt;/del&gt;]] sequence of &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;integers &lt;/del&gt;which can be defined by a recurrence relation of the following form:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &#039;&#039;&#039;consistent Collatz&#039;&#039;&#039; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;function &lt;/ins&gt;is a [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Generalized &lt;/ins&gt;Collatz &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Function&lt;/ins&gt;]] &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(GCF) with the same coefficient in each piecewise affine function. In other words, it is a function &amp;lt;math&amp;gt;g: \mathbb{N} \to \mathbb{N}&amp;lt;/math&amp;gt; defined as:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;math display=&quot;block&quot;&amp;gt;g(x) = \begin{cases}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  a x + b_0 &amp;amp; \text{if } x \equiv 0 \pmod{m} \\&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  a x + b_1 &amp;amp; \text{if } x \equiv 1 \pmod{m} \\&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;              &amp;amp; \vdots \\&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  a x + b_{m-1} &amp;amp; \text{if } x \equiv m-1 \pmod{m} \\&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;\end{cases}&amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;A consistent Collatz sequence is a &lt;/ins&gt;sequence of &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;values obtained by iterating a consistent Collatz function: &amp;lt;math&amp;gt;x_{n+1} = g(x_n)&amp;lt;/math&amp;gt; &lt;/ins&gt;which can &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;alternatively &lt;/ins&gt;be defined by a recurrence relation of the following form:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ {\operatorname{mod}}\ m]&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ {\operatorname{mod}}\ m]&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;where the sequence itself is &amp;lt;math&amp;gt;x_0, x_1, \ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; are positive integers&amp;lt;!-- does negative r work too?--&amp;gt;, and &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a map from integers modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; to (possibly negative) integers (with the values chosen to ensure that all &amp;lt;math&amp;gt;x_n&amp;lt;/math&amp;gt; are integers). The sequence is entirely defined by &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt;, and the value of its first element &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. The recurrence relation is a special case of a Collatz function (e.g. as seen in [[wikipedia:Collatz conjecture#Undecidable generalizations]]) in which all the multipliers are the same (i.e. the same value of &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is used regardless of the value of &amp;lt;math&amp;gt;x_n\ {\operatorname{mod}}\ m&amp;lt;/math&amp;gt;)&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;where the sequence itself is &amp;lt;math&amp;gt;x_0, x_1, \ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; are positive integers&amp;lt;!-- does negative r work too?--&amp;gt;, and &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a map from integers modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; to (possibly negative) integers (with the values chosen to ensure that all &amp;lt;math&amp;gt;x_n&amp;lt;/math&amp;gt; are integers). The sequence is entirely defined by &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt;, and the value of its first element &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Many small [[cryptids]] work by calculating the elements of a consistent Collatz sequence modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, and deciding whether or not to halt based on the remainders. For example, [[Hydra]] calculates the consistent Collatz sequence with &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r=3&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J=\{0 \mapsto 0, 1 \mapsto -1\}&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;x_0=3&amp;lt;/math&amp;gt;, halting only if the sequence has contained more than twice as many even elements as odd elements. &amp;lt;math&amp;gt;m=2, r=3&amp;lt;/math&amp;gt; seems to be particularly common among small cryptids, due to creating the simplest consistent Collatz sequences that have nontrivial behaviour; however, other values have been observed, such as [[Bigfoot]]&amp;#039;s &amp;lt;math&amp;gt;m=81, r=256&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Many small [[cryptids]] work by calculating the elements of a consistent Collatz sequence modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, and deciding whether or not to halt based on the remainders. For example, [[Hydra]] calculates the consistent Collatz sequence with &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r=3&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J=\{0 \mapsto 0, 1 \mapsto -1\}&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;x_0=3&amp;lt;/math&amp;gt;, halting only if the sequence has contained more than twice as many even elements as odd elements. &amp;lt;math&amp;gt;m=2, r=3&amp;lt;/math&amp;gt; seems to be particularly common among small cryptids, due to creating the simplest consistent Collatz sequences that have nontrivial behaviour; however, other values have been observed, such as [[Bigfoot]]&amp;#039;s &amp;lt;math&amp;gt;m=81, r=256&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sligocki</name></author>
	</entry>
	<entry>
		<id>https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=4386&amp;oldid=prev</id>
		<title>MrSolis: 0_o</title>
		<link rel="alternate" type="text/html" href="https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=4386&amp;oldid=prev"/>
		<updated>2025-10-07T23:21:13Z</updated>

		<summary type="html">&lt;p&gt;0_o&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:21, 7 October 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &amp;#039;&amp;#039;&amp;#039;consistent Collatz&amp;#039;&amp;#039;&amp;#039; sequence is a [[Collatz-like]] sequence of integers which can be defined by a recurrence relation of the following form:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &amp;#039;&amp;#039;&amp;#039;consistent Collatz&amp;#039;&amp;#039;&amp;#039; sequence is a [[Collatz-like]] sequence of integers which can be defined by a recurrence relation of the following form:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ \&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;textrm&lt;/del&gt;{mod}\ m]&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{&lt;/ins&gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;operatorname&lt;/ins&gt;{mod&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}&lt;/ins&gt;}\ m]&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;where the sequence itself is &amp;lt;math&amp;gt;x_0, x_1, \ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; are positive integers&amp;lt;!-- does negative r work too?--&amp;gt;, and &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a map from integers modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; to (possibly negative) integers (with the values chosen to ensure that all &amp;lt;math&amp;gt;x_n&amp;lt;/math&amp;gt; are integers). The sequence is entirely defined by &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt;, and the value of its first element &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;. The recurrence relation is a special case of a Collatz function (e.g. as seen in [[wikipedia:Collatz conjecture#Undecidable generalizations]]) in which all the multipliers are the same (i.e. the same value of &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is used regardless of the value of &amp;lt;math&amp;gt;x_n\ \&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;textrm&lt;/del&gt;{mod}\ m&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;where the sequence itself is &amp;lt;math&amp;gt;x_0, x_1, \ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; are positive integers&amp;lt;!-- does negative r work too?--&amp;gt;, and &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a map from integers modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; to (possibly negative) integers (with the values chosen to ensure that all &amp;lt;math&amp;gt;x_n&amp;lt;/math&amp;gt; are integers). The sequence is entirely defined by &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt;, and the value of its first element &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;. The recurrence relation is a special case of a Collatz function (e.g. as seen in [[wikipedia:Collatz conjecture#Undecidable generalizations]]) in which all the multipliers are the same (i.e. the same value of &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is used regardless of the value of &amp;lt;math&amp;gt;x_n\ &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{&lt;/ins&gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;operatorname&lt;/ins&gt;{mod&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}&lt;/ins&gt;}\ m&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Many small [[cryptids]] work by calculating the elements of a consistent Collatz sequence modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, and deciding whether or not to halt based on the remainders. For example, [[Hydra]] calculates the consistent Collatz sequence with &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r=3&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J=\{0 \mapsto 0, 1 \mapsto -1\}&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;x_0=3&amp;lt;/math&amp;gt;, halting only if the sequence has contained more than twice as many even elements as odd elements. &amp;lt;math&amp;gt;m=2, r=3&amp;lt;/math&amp;gt; seems to be particularly common among small cryptids, due to creating the simplest consistent Collatz sequences that have nontrivial behaviour; however, other values have been observed, such as [[Bigfoot]]&amp;#039;s &amp;lt;math&amp;gt;m=81, r=256&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Many small [[cryptids]] work by calculating the elements of a consistent Collatz sequence modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, and deciding whether or not to halt based on the remainders. For example, [[Hydra]] calculates the consistent Collatz sequence with &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r=3&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J=\{0 \mapsto 0, 1 \mapsto -1\}&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;x_0=3&amp;lt;/math&amp;gt;, halting only if the sequence has contained more than twice as many even elements as odd elements. &amp;lt;math&amp;gt;m=2, r=3&amp;lt;/math&amp;gt; seems to be particularly common among small cryptids, due to creating the simplest consistent Collatz sequences that have nontrivial behaviour; however, other values have been observed, such as [[Bigfoot]]&amp;#039;s &amp;lt;math&amp;gt;m=81, r=256&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l9&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Efficiently calculating consistent Collatz sequences ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Efficiently calculating consistent Collatz sequences ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For any given Collatz sequence, it is possible to calculate its sequence of remainders &amp;lt;math&amp;gt;x_n\ \&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;textrm&lt;/del&gt;{mod}\ m&amp;lt;/math&amp;gt; in amortized [[wikipedia:quasilinear time|quasilinear time]]. This can be accomplished via the use of two helper sequences:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For any given Collatz sequence, it is possible to calculate its sequence of remainders &amp;lt;math&amp;gt;x_n\ &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{&lt;/ins&gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;operatorname&lt;/ins&gt;{mod&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}&lt;/ins&gt;}\ m&amp;lt;/math&amp;gt; in amortized [[wikipedia:quasilinear time|quasilinear time]]. This can be accomplished via the use of two helper sequences:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;w_n = x_n\ \&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;textrm&lt;/del&gt;{mod}\ m^{f(n)}&amp;lt;/math&amp;gt;, except &amp;lt;math&amp;gt;w_0 = x_0&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;w_n = x_n\ &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{&lt;/ins&gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;operatorname&lt;/ins&gt;{mod&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}&lt;/ins&gt;}\ m^{f(n)}&amp;lt;/math&amp;gt;, except &amp;lt;math&amp;gt;w_0 = x_0&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;j_n = m^{f(n)}x_n - r^{f(n)}x_{n-f(n)}&amp;lt;/math&amp;gt;, with &amp;lt;math&amp;gt;j_0&amp;lt;/math&amp;gt; undefined (the algorithm never uses it)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;j_n = m^{f(n)}x_n - r^{f(n)}x_{n-f(n)}&amp;lt;/math&amp;gt;, with &amp;lt;math&amp;gt;j_0&amp;lt;/math&amp;gt; undefined (the algorithm never uses it)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot;&gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The algorithm itself is:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The algorithm itself is:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;j_n = m^{f(n)-1} J[w_{n-1}\ \&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;textrm&lt;/del&gt;{mod}\ m] + \Sigma_{e=1}^{\log_2 f(n)}\left(m^{f(n)-2^e}r^{2^{e-1}}j_{n-2^{e-1}}\right)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;j_n = m^{f(n)-1} J[w_{n-1}\ &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{&lt;/ins&gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;operatorname&lt;/ins&gt;{mod&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}&lt;/ins&gt;}\ m] + \Sigma_{e=1}^{\log_2 f(n)}\left(m^{f(n)-2^e}r^{2^{e-1}}j_{n-2^{e-1}}\right)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;w&amp;#039;_n = j_n + r^{f(n)} w_{n-f(n)} \mod m^{2f(n)}&amp;lt;/math&amp;gt; (i.e. all the calculations are done modulo &amp;lt;math&amp;gt;m^{2f(n)}&amp;lt;/math&amp;gt;, saving time in cases where &amp;lt;math&amp;gt;w_{n-f(n)}&amp;lt;/math&amp;gt; happens to be much larger than &amp;lt;math&amp;gt;m^{2f(n)}&amp;lt;/math&amp;gt;)&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;w&amp;#039;_n = j_n + r^{f(n)} w_{n-f(n)} \mod m^{2f(n)}&amp;lt;/math&amp;gt; (i.e. all the calculations are done modulo &amp;lt;math&amp;gt;m^{2f(n)}&amp;lt;/math&amp;gt;, saving time in cases where &amp;lt;math&amp;gt;w_{n-f(n)}&amp;lt;/math&amp;gt; happens to be much larger than &amp;lt;math&amp;gt;m^{2f(n)}&amp;lt;/math&amp;gt;)&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;w_n = w&amp;#039;_n \div m^{f(n)}&amp;lt;/math&amp;gt; (which should always be an integer).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;w_n = w&amp;#039;_n \div m^{f(n)}&amp;lt;/math&amp;gt; (which should always be an integer).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>MrSolis</name></author>
	</entry>
	<entry>
		<id>https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=603&amp;oldid=prev</id>
		<title>Sligocki: link collatz-like</title>
		<link rel="alternate" type="text/html" href="https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=603&amp;oldid=prev"/>
		<updated>2024-08-06T19:52:57Z</updated>

		<summary type="html">&lt;p&gt;link collatz-like&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:52, 6 August 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &#039;&#039;&#039;consistent Collatz&#039;&#039;&#039; sequence is a sequence of integers which can be defined by a recurrence relation of the following form:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A &#039;&#039;&#039;consistent Collatz&#039;&#039;&#039; sequence is a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Collatz-like]] &lt;/ins&gt;sequence of integers which can be defined by a recurrence relation of the following form:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ \textrm{mod}\ m]&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ \textrm{mod}\ m]&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-600:rev-603:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Sligocki</name></author>
	</entry>
	<entry>
		<id>https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=600&amp;oldid=prev</id>
		<title>Ais523: clarify the relationship to generalized Collatz functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=600&amp;oldid=prev"/>
		<updated>2024-08-05T22:59:34Z</updated>

		<summary type="html">&lt;p&gt;clarify the relationship to generalized Collatz functions&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:59, 5 August 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ \textrm{mod}\ m]&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ \textrm{mod}\ m]&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;where the sequence itself is &amp;lt;math&amp;gt;x_0, x_1, \ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; are positive integers&amp;lt;!-- does negative r work too?--&amp;gt;, and &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a map from integers modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; to (possibly negative) integers (with the values chosen to ensure that all &amp;lt;math&amp;gt;x_n&amp;lt;/math&amp;gt; are integers). The sequence is entirely defined by &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt;, and the value of its first element &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;where the sequence itself is &amp;lt;math&amp;gt;x_0, x_1, \ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; are positive integers&amp;lt;!-- does negative r work too?--&amp;gt;, and &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a map from integers modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; to (possibly negative) integers (with the values chosen to ensure that all &amp;lt;math&amp;gt;x_n&amp;lt;/math&amp;gt; are integers). The sequence is entirely defined by &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt;, and the value of its first element &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. The recurrence relation is a special case of a Collatz function (e.g. as seen in [[wikipedia:Collatz conjecture#Undecidable generalizations]]) in which all the multipliers are the same (i.e. the same value of &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is used regardless of the value of &amp;lt;math&amp;gt;x_n\ \textrm{mod}\ m&amp;lt;/math&amp;gt;)&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Many small [[cryptids]] work by calculating the elements of a consistent Collatz sequence modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, and deciding whether or not to halt based on the remainders. For example, [[Hydra]] calculates the consistent Collatz sequence with &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r=3&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J=\{0 \mapsto 0, 1 \mapsto -1\}&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;x_0=3&amp;lt;/math&amp;gt;, halting only if the sequence has contained more than twice as many even elements as odd elements. &amp;lt;math&amp;gt;m=2, r=3&amp;lt;/math&amp;gt; seems to be particularly common among small cryptids, due to creating the simplest consistent Collatz sequences that have nontrivial behaviour; however, other values have been observed, such as [[Bigfoot]]&amp;#039;s &amp;lt;math&amp;gt;m=81, r=256&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Many small [[cryptids]] work by calculating the elements of a consistent Collatz sequence modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, and deciding whether or not to halt based on the remainders. For example, [[Hydra]] calculates the consistent Collatz sequence with &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r=3&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J=\{0 \mapsto 0, 1 \mapsto -1\}&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;x_0=3&amp;lt;/math&amp;gt;, halting only if the sequence has contained more than twice as many even elements as odd elements. &amp;lt;math&amp;gt;m=2, r=3&amp;lt;/math&amp;gt; seems to be particularly common among small cryptids, due to creating the simplest consistent Collatz sequences that have nontrivial behaviour; however, other values have been observed, such as [[Bigfoot]]&amp;#039;s &amp;lt;math&amp;gt;m=81, r=256&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-588:rev-600:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Ais523</name></author>
	</entry>
	<entry>
		<id>https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=588&amp;oldid=prev</id>
		<title>Ais523: a class of sequences, including that used by Hydra/Antihydra, that can be calculated in quasilinear time</title>
		<link rel="alternate" type="text/html" href="https://wiki.bbchallenge.org/w/index.php?title=Consistent_Collatz&amp;diff=588&amp;oldid=prev"/>
		<updated>2024-08-04T00:25:43Z</updated>

		<summary type="html">&lt;p&gt;a class of sequences, including that used by Hydra/Antihydra, that can be calculated in quasilinear time&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A &amp;#039;&amp;#039;&amp;#039;consistent Collatz&amp;#039;&amp;#039;&amp;#039; sequence is a sequence of integers which can be defined by a recurrence relation of the following form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;mx_{n+1} = rx_n + J[x_n\ \textrm{mod}\ m]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the sequence itself is &amp;lt;math&amp;gt;x_0, x_1, \ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; are positive integers&amp;lt;!-- does negative r work too?--&amp;gt;, and &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a map from integers modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; to (possibly negative) integers (with the values chosen to ensure that all &amp;lt;math&amp;gt;x_n&amp;lt;/math&amp;gt; are integers). The sequence is entirely defined by &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt;, and the value of its first element &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Many small [[cryptids]] work by calculating the elements of a consistent Collatz sequence modulo &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, and deciding whether or not to halt based on the remainders. For example, [[Hydra]] calculates the consistent Collatz sequence with &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;r=3&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;J=\{0 \mapsto 0, 1 \mapsto -1\}&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;x_0=3&amp;lt;/math&amp;gt;, halting only if the sequence has contained more than twice as many even elements as odd elements. &amp;lt;math&amp;gt;m=2, r=3&amp;lt;/math&amp;gt; seems to be particularly common among small cryptids, due to creating the simplest consistent Collatz sequences that have nontrivial behaviour; however, other values have been observed, such as [[Bigfoot]]&amp;#039;s &amp;lt;math&amp;gt;m=81, r=256&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Efficiently calculating consistent Collatz sequences ==&lt;br /&gt;
&lt;br /&gt;
For any given Collatz sequence, it is possible to calculate its sequence of remainders &amp;lt;math&amp;gt;x_n\ \textrm{mod}\ m&amp;lt;/math&amp;gt; in amortized [[wikipedia:quasilinear time|quasilinear time]]. This can be accomplished via the use of two helper sequences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;w_n = x_n\ \textrm{mod}\ m^{f(n)}&amp;lt;/math&amp;gt;, except &amp;lt;math&amp;gt;w_0 = x_0&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;j_n = m^{f(n)}x_n - r^{f(n)}x_{n-f(n)}&amp;lt;/math&amp;gt;, with &amp;lt;math&amp;gt;j_0&amp;lt;/math&amp;gt; undefined (the algorithm never uses it)&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;f(n)&amp;lt;/math&amp;gt; is the largest power of 2 that divides into &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Time complexity ===&lt;br /&gt;
&lt;br /&gt;
The algorithm works by calculating &amp;lt;math&amp;gt;j_n&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;w_n&amp;lt;/math&amp;gt; for each &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; in turn, with the only operations used being additions, subtractions, and multiplications of numbers whose number of digits is proportional to &amp;lt;math&amp;gt;f(n)&amp;lt;/math&amp;gt;; division and modulo by powers of &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;; and calculation of &amp;lt;math&amp;gt;r^t&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;t \leq f(n)&amp;lt;/math&amp;gt;. Because the values of &amp;lt;math&amp;gt;r^t&amp;lt;/math&amp;gt; can be memoized, and it is possible to trivialise the division and modulus operations by storing the numbers in base &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt;, this means that the only slow operations are additions and subtractions taking &amp;lt;math&amp;gt;O(f(n))&amp;lt;/math&amp;gt; time, and multiplications taking &amp;lt;math&amp;gt;O(f(n) \log f(n) \log \log f(n))&amp;lt;/math&amp;gt; time (and there are &amp;lt;math&amp;gt;O(\log f(n))&amp;lt;/math&amp;gt; such operations performed), so the calculation of each &amp;lt;math&amp;gt;w_n, j_n&amp;lt;/math&amp;gt; pair takes time quasilinear in &amp;lt;math&amp;gt;f(n)&amp;lt;/math&amp;gt;. &amp;lt;math&amp;gt;\Sigma_{t=1}^n{f(t)}=O(n \log n)&amp;lt;/math&amp;gt;: as such, the calculation of the entire sequences &amp;lt;math&amp;gt;w_0, \ldots, w_n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j_0, \ldots, j_n&amp;lt;/math&amp;gt; takes time quasilinear in &amp;lt;math&amp;gt;n \log n&amp;lt;/math&amp;gt;, thus quasilinear in &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Details of the algorithm ===&lt;br /&gt;
&lt;br /&gt;
The algorithm itself is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;j_n = m^{f(n)-1} J[w_{n-1}\ \textrm{mod}\ m] + \Sigma_{e=1}^{\log_2 f(n)}\left(m^{f(n)-2^e}r^{2^{e-1}}j_{n-2^{e-1}}\right)&amp;lt;/math&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;w&amp;#039;_n = j_n + r^{f(n)} w_{n-f(n)} \mod m^{2f(n)}&amp;lt;/math&amp;gt; (i.e. all the calculations are done modulo &amp;lt;math&amp;gt;m^{2f(n)}&amp;lt;/math&amp;gt;, saving time in cases where &amp;lt;math&amp;gt;w_{n-f(n)}&amp;lt;/math&amp;gt; happens to be much larger than &amp;lt;math&amp;gt;m^{2f(n)}&amp;lt;/math&amp;gt;)&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;w_n = w&amp;#039;_n \div m^{f(n)}&amp;lt;/math&amp;gt; (which should always be an integer).&lt;br /&gt;
&lt;br /&gt;
(If &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; is odd, then &amp;lt;math&amp;gt;f(n) = 1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\log_2 f(n) = 0&amp;lt;/math&amp;gt;, and the sum in the calculation of &amp;lt;math&amp;gt;j_n&amp;lt;/math&amp;gt; is a degenerate sum with no elements.)&lt;br /&gt;
&lt;br /&gt;
=== Sketch proof of correctness ===&lt;br /&gt;
&lt;br /&gt;
The proof that the algorithm is correct starts with the definition &amp;lt;math&amp;gt;j_n = m^{f(n)}x_n - r^{f(n)}x_{n-f(n)}&amp;lt;/math&amp;gt;, adds a degenerate sum (that sums to zero) to produce the following expression:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;j_n = m^{f(n)}x_n + \Sigma_{e=1}^{\log_2 f(n)}\left(-m^{f(n)-2^{e-1}}r^{2^{e-1}}x_{n-2^{e-1}}+m^{f(n)-2^{e-1}}r^{2^{e-1}}x_{n-2^{e-1}}\right) - r^{f(n)}x_{n-f(n)}&amp;lt;/math&amp;gt; (with each element of the sum being of the form &amp;lt;math&amp;gt;-q+q&amp;lt;/math&amp;gt; and thus 0)&lt;br /&gt;
&lt;br /&gt;
and then rebrackets by grouping the term before the sum with the first half of the first element of the sum, the second half of the first element of the sum with the first half of the second element of the sum, etc., and finally the second half of the last element of the sum with the term after the sum. From there, the proof is mostly just a matter of expanding definitions.&lt;br /&gt;
&lt;br /&gt;
=== Possible tricks to optimize the implementation ===&lt;br /&gt;
&lt;br /&gt;
Once the algorithm produces a value of &amp;lt;math&amp;gt;j_n&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;w_n&amp;lt;/math&amp;gt;, it happens that it will never again read a value &amp;lt;math&amp;gt;j_{n&amp;#039;}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;w_{n&amp;#039;}&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;f(n)=f(n&amp;#039;)&amp;lt;/math&amp;gt;. As such, it is possible to save memory by storing only one value of &amp;lt;math&amp;gt;j_n&amp;lt;/math&amp;gt; and one value of &amp;lt;math&amp;gt;w_n&amp;lt;/math&amp;gt; for each &amp;lt;math&amp;gt;f(n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It is probably faster to switch to an alternative implementation (e.g. simple repeated multiplication) when the &amp;lt;math&amp;gt;f(n)&amp;lt;/math&amp;gt; values are small, because at that point the numbers are small enough to fit into a machine register; this does not improve the asymptotic behaviour of the implementation but is likely to speed it up by a reasonably high constant factor.&lt;br /&gt;
&lt;br /&gt;
Every &amp;lt;math&amp;gt;w&amp;#039;_n&amp;lt;/math&amp;gt; is necessarily a multiple of &amp;lt;math&amp;gt;m^{f(n)}&amp;lt;/math&amp;gt;. It seems like that might provide some sort of shortcut to calculate it faster, although the details are currently unclear.&lt;br /&gt;
&lt;br /&gt;
=== Proof-of-concept implementation ===&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s a proof-of-concept implementation, using Python 3 and gmpy2 (configured to calculate [[Hydra]], but it could easily be adapted for other consistent Collatz sequences with &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
import gmpy2&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
# The Rules of Hydra:&lt;br /&gt;
# if x_n = 2y + 0, then x_{n+1} = 3y + 0, i.e. 2x_{n+1} = 3x_n + 0&lt;br /&gt;
# if x_n = 2y + 1, then x_{n+1} = 3y + 1, i.e. 2x_{n+1} = 3x_n - 1&lt;br /&gt;
m = 2        # modulus; denominator of the ratio between successive elements&lt;br /&gt;
r = 3        # numerator of the ratio between successive elements&lt;br /&gt;
J = [0, -1]  # J[x_n % m] is the difference between m*x_{n+1} and r*x_n&lt;br /&gt;
x_0 = 3      # first term of the sequence&lt;br /&gt;
&lt;br /&gt;
def f(n):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;The largest power of 2 that divides into the argument&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    return n &amp;amp; ~(n - 1)&lt;br /&gt;
&lt;br /&gt;
global mod_m_exp&lt;br /&gt;
if m == 2:&lt;br /&gt;
    mod_m_exp = lambda v,e: gmpy2.f_mod_2exp(v, e)&lt;br /&gt;
else:&lt;br /&gt;
    mod_m_exp = lambda v,e: gmpy2.f_mod(v, gmpy2.pow(m, e))&lt;br /&gt;
&lt;br /&gt;
global div_m_exp&lt;br /&gt;
if m == 2:&lt;br /&gt;
    div_m_exp = lambda v,e: gmpy2.f_div_2exp(v, e)&lt;br /&gt;
else:&lt;br /&gt;
    div_m_exp = lambda v,e: gmpy2.f_div(v, gmpy2.pow(m, e))&lt;br /&gt;
&lt;br /&gt;
global mul_m_exp&lt;br /&gt;
if m == 2:&lt;br /&gt;
    mul_m_exp = lambda v,e: gmpy2.mpz(v) &amp;lt;&amp;lt; e&lt;br /&gt;
else:&lt;br /&gt;
    mul_m_exp = lambda v,e: gmpy2.mul(v, gmpy2.pow(m, e))&lt;br /&gt;
&lt;br /&gt;
r_exp_cache = {1: gmpy2.mpz(r)}&lt;br /&gt;
def r_exp(e):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Returns r raised to the power of e. e must be a power of 2.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    global r_exp_cache&lt;br /&gt;
    if not e in r_exp_cache:&lt;br /&gt;
        r_exp_cache[e] = gmpy2.square(r_exp(e/2))&lt;br /&gt;
    return r_exp_cache[e]&lt;br /&gt;
&lt;br /&gt;
# The bulk of the calculation is to calculate w_n and j_n for each n.&lt;br /&gt;
# The definitions are:&lt;br /&gt;
# w_n = x_n mod m**f(n)&lt;br /&gt;
# j_n = m**f(n) * x_n - r**f(n) * x_{n-f(n)}&lt;br /&gt;
# The output from the program is the sequence of x_n mod m.&lt;br /&gt;
# This can be calculated by taking the values of w_n mod m.&lt;br /&gt;
w = {0: x_0}  # most recently seen w for each f value&lt;br /&gt;
j = {}        # most recently seen j for each f value&lt;br /&gt;
&lt;br /&gt;
modulus_count = {0: 0, 1: 0}&lt;br /&gt;
&lt;br /&gt;
n = 0&lt;br /&gt;
perf_counter_timestamp = time.perf_counter_ns()&lt;br /&gt;
while True:&lt;br /&gt;
    last_f = f(n)&lt;br /&gt;
    last_x_mod_m = mod_m_exp(w[last_f], 1)&lt;br /&gt;
    # print(last_x_mod_m, end=&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    modulus_count[last_x_mod_m] += 1&lt;br /&gt;
    if n % 1000000 == 0:&lt;br /&gt;
        last_timestamp = perf_counter_timestamp&lt;br /&gt;
        perf_counter_timestamp = time.perf_counter_ns()&lt;br /&gt;
        print(&amp;quot;Reached n = &amp;quot;, n, &amp;quot;; modulus counts: &amp;quot;, modulus_count,&lt;br /&gt;
              &amp;quot;; time for last 1000000 elements = &amp;quot;,&lt;br /&gt;
              (perf_counter_timestamp - last_timestamp) // 1000000,&lt;br /&gt;
              &amp;quot; ms&amp;quot;, sep=&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    n = n + 1&lt;br /&gt;
    cur_f = f(n)&lt;br /&gt;
&lt;br /&gt;
    # j can be a sum of multiple terms; J[last_x_mod_m] is always present&lt;br /&gt;
    # but if f &amp;gt; 1 there are other terms too&lt;br /&gt;
    m_shift = cur_f - 1&lt;br /&gt;
    r_shift = 1&lt;br /&gt;
    new_j = mul_m_exp(J[last_x_mod_m], m_shift)&lt;br /&gt;
    while m_shift &amp;gt;= r_shift:&lt;br /&gt;
        m_shift -= r_shift&lt;br /&gt;
        new_j += mul_m_exp(j[r_shift] * r_exp(r_shift), m_shift)&lt;br /&gt;
        r_shift *= 2&lt;br /&gt;
    j[cur_f] = new_j&lt;br /&gt;
&lt;br /&gt;
    # w can be calculated directly from the new j and the appropriate past w&lt;br /&gt;
    wrap = lambda v: mod_m_exp(v, cur_f * 2)&lt;br /&gt;
    past_w = w[f(n - f(n))]&lt;br /&gt;
    new_w = wrap(wrap(new_j) + wrap(wrap(r_exp(cur_f)) * wrap(past_w)))&lt;br /&gt;
    assert(mod_m_exp(new_w, cur_f) == 0)&lt;br /&gt;
    new_w = div_m_exp(new_w, cur_f)&lt;br /&gt;
    w[cur_f] = new_w&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This implementation is probably not suitable for serious use due to having poor constant factors: a faster implementation would use an alternative algorithm for low &amp;lt;math&amp;gt;f(n)&amp;lt;/math&amp;gt; values. It is also intened only for &amp;lt;math&amp;gt;m=2&amp;lt;/math&amp;gt;, because the complexity result is dependent on modulus by powers of &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; being fast regardless of the size of the dividend, but gmpy2 is only able to store numbers in binary and that operation is quick only if the modulus is a power of the base. As such, a full implementation of efficient consistent Collatz calculation would probably involve writing a new arbitrarily-large-integers library which is able to store numbers in arbitrary bases.&lt;/div&gt;</summary>
		<author><name>Ais523</name></author>
	</entry>
</feed>