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

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).

• Welcome to MSE ! If only all newcomers could write questions with this quality, this is a very interesting question ! Jan 30, 2021 at 18:01
• In such construction, you are basically joining n with 2n and 3n+1. The post you mentioned in the last paragraph explains why lines n–2n create a cardioid. I suppose that lines n–3n+1 will be responsible for nephroid. Jan 30, 2021 at 18:10
• modular arithmetic in multiplication tables of 2 and 3 (youtube.com/watch?app=desktop&v=qhbuKbxJsk8) Jan 30, 2021 at 18:11
• Hi @samerivertwice, for any given Collatz sequence, I convert this sequence to radians using Python's math.radians function, and treat this value as the angular coordinate θ. The radial coordinate r is fixed at 1 for all values. I plot (θ,r) for all values for all sequences, and connect consecutive values within a sequence with lines. Feb 1, 2021 at 2:23
• Here's a suggestion. For each line in your figure, color it red if it is the result of the next term of the sequence going from a smaller number to a larger one, and blue if it is the result of the next term going from a larger number to a smaller one. What do you see? Feb 1, 2021 at 2:53

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.