Why does plotting Collatz sequences in polar coordinates produce a cardioid and nephroid

collatz conjecturenumber theorypolar coordinates

I generated the Collatz sequences for the first 2,000 starting integers, and plotted these sequences "on top of each other" in polar coordinates, using a fixed radius and with each element in the sequence as theta (converted to radians, i.e., modulo 360). Successive elements within each sequence are connected by (semi-transparent) lines.

Following these steps produced the image below, where we can clearly see two shapes (a cardioid and nephroid). (The Python code that generates this image is available here. The total number of elements in the 2,000 sequences is 136,100, so the total number of lines plotted in the image below is 136,100 – 2,000 = 134,100.)

Link to generated image (high-quality) or lower quality

My question is: Why do a cardioid and nephroid clearly appear? Is there something notable about the Collatz sequences that produce these shapes, or is this unrelated to the intricacies of the Collatz sequences, and that other unrelated integer sequences also produce similar shapes?

As of now, I haven't seen any substantive references online to nephroids and the Collatz conjecture together.

A post here describes how you can generate a cardioid in polar coordinates by drawing lines between evenly spaced points on a circle, but this doesn't relate to the Collatz sequences, and doesn't construct a nephroid.

Update:

Based on the discussion, the cardioid can be generated based on the envelope of lines drawn between points around a circle, with each line drawn between point line between points n and 2n (mod N), as described here. The nephroid is based on the same concept for points between n and 3n, as described here. The Collatz sequence contains both behaviors: some elements in sequence follow 2n->n (the order of the two doesn't matter if we are connecting lines), and some elements follow n->3n+1 (but the +1 component is negligible for the overall shape), resulting in the cardioid and nephroid.

Update #2:

Per a suggestion by heropup below, I've redrawn the image where for each line connecting terms (N,N+1) in a sequence, the line is red if N+1 > N and blue if N+1 < N. From this and per the update above, we can clearly see that the nephroid is red and the cardioid is blue.

Link to colored generated image (high-quality) or lower quality

(This now probably looks better on a white background but takes a long time to generate).

Best Answer

Update from OP

Based on the discussion, the cardioid can be generated based on the envelope of lines drawn between points around a circle, with each line drawn between point line between points n and 2n (mod N), as described here. The nephroid is based on the same concept for points between n and 3n, as described here. The Collatz sequence contains both behaviors: some elements in sequence follow $2n\to n$ (the order of the two doesn't matter if we are connecting lines), and some elements follow $n\to3n+1$ (but the $+1$ component is negligible for the overall shape), resulting in the cardioid and nephroid.