Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 16 https://internationalpubls.com Visualizing and Proving the Collatz Conjecture: Ananta-Graph Approach Vidyashree H R(a)(b), Lakshminarayana S(a), Ajith S(b) (a)REVA University, Bengaluru. (b)Nagarjuna College of Management Studies, Bengaluru. Email Id: vidyashree848@gmail.com, narayan_sl@reva.edu.in, ajith.sdl@gmail.com Article History: Received: 13-10-2024 Revised: 28-11-2024 Accepted: 09-12-2024 Abstract: The Collatz Conjecture, proposed by Lothar Collatz in 1937, is an unsolved mathematical problem often called the “3x+1 problem” or the “Hailstone sequence”. It suggests that starting with any positive integer and applying a specific process: dividing an even number by 2 or multiplying an odd number by 3 and adding 1 will eventually result in the sequence reaching the cycle 4, 2, 1 regardless of the starting value. Despite its simplicity, no one has been able to prove or disprove this conjecture for all positive numbers. The behaviour of the Collatz Conjecture can also be illustrated through a graphical representation, showing how the sequence for different starting numbers evolves before reaching the repeating cycle of 4, 2, 1. In this paper, we highlight the various graphical representations of the Collatz sequence and finally provide the proof of Collatz conjecture by plotting the Ananta-graphs. Keywords: Collatz sequence, Flower pattern, 3x+1 sequence, Ananta-Graphs. Introduction: Definition 1: The Collatz sequence is the sequence of numbers generated by the iterative process defined by the Collatz conjecture. Starting from any positive integer, the sequence is formed by applying the following rules: • If the number is even, divide it by 2. • If the number is odd, multiply it by 3 and add 1. • Repeat this process with the resulting number until you reach 1, at which point the sequence will enter the repeating cycle of 4, 2, 1. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 17 https://internationalpubls.com Example: Starting with n=13 (odd) 13*3+1 = 40 (even) 40/2 = 20 (even) 20/2 = 10 (even) 10/2 = 5 (odd) 5*3+1 = 16 (even) 16/2 = 8 (even) 8/2 = 4 (even) 4/2 = 2 (even) 2/2 = 1 (sequence ends) The sequence for n=7 is: 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1. Definition 2: Ananta-graphs are a graphical representation based on the Collatz conjecture (also known as the 3x+1 problem). The graph visually illustrates the sequence of numbers that follow the conjecture’s rules and ultimately fall into a repeating cycle. The term “Ananta” (Sanskrit for “infinite” or “endless”) reflects the unbounded nature of the positive integers involved in the graph. Structure of the Ananta-graph: • Triangular head: The key feature of the Ananta-Graph is the triangular cycle formed by the vertices 4, 2 and 1. This forms a closed loop that is the final destination of all paths in the graph. • Long tail: Every other positive integer that follows the Collatz sequence eventually converges toward this triangular cycle. This forms the “tail” of the graph. Example: For n=13 Previous results: The Collatz graphs are explored by analyzing the 3n+1 function on congruence classes, focusing on moduli that are powers of 2. These graphs are isomorphic to binary De Bruijn graphs, which are well- structured and display intriguing properties. The research further extends to 2-adic integers, revealing that the isomorphism of these infinite graphs aligns with the conjugacy map previously examined by Bernstein and Lagarias [1]. To study the Collatz conjecture, the paper [2] introduces a clustering approach using Hierarchical Clustering (HC) and Multidimensional Scaling (MDS) algorithms. HC generates two-dimensional graphical outputs like dendrograms and trees, while MDS produces two and three-dimensional charts. It is observed that the three-dimensional MDS map reveals complex patterns that are not easily seen Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 18 https://internationalpubls.com in two-dimensional visuals. The study tested six distance metrics combined with Hamming-like classification, with the ArcCosine-Hamming, Canberra-Hamming and Clark-Hamming distances yielding the clearest structures in the three-dimensional MDS maps. The Collatz problem was examined through the lens of graph theory and the properties of the digital root of natural numbers. A consistent pattern was identified in the iteration of sequence numbers, where the digital root follows a cyclic order. All numbers eventually connect to even numbers with a digital root of 2 and after a series of iterations and cycles, they ultimately reach the number 1 [3]. The Collatz conjecture was analysed by constructing a directed graph that connects all natural numbers. It confirms that the Collatz sequences cover all positive integers and importantly, do not form any nontrivial cycles, reinforcing the hypothesis that all sequences eventually settle into the trivial cycle of 1,2,1,2 and so on. This illustrates the intricate relationship between number theory and graph theory [4]. The Collatz graph was constructed to address the Collatz problem with a regular structure. Using a bottom-up approach with inverse relations, the graph connects each number n to its predecessor m if n is the Collatz functional value of m. The tree-like graph demonstrates that for any seed n, the generated Collatz sequences converge to one. The simple connection rules are introduced to build the graph, ensuring it contains all the positive numbers. This shows that the developed graph generates Collatz trajectories for all integers [5]. Despite extensive computational verification up to very high numerical limits, no rigorous mathematical proof has been found to confirm this conjecture universally. There are no infinite loops existing in the process, except for the trivial loop (1, 4, 2, 1) and no positive integer will diverge to infinity. This is demonstrated using logical reasoning and reinforcing it with a probabilistic approach [6]. The study [7] aims to prove the Collatz conjecture using a theorem-proving system. The approach includes two methods a division sequence to track how many times a number can be divided by 2 and a start conversion to map one division sequence to another. Methodology: In this paper, we provide the proof of the Collatz conjecture by plotting Ananta-graphs, a graphical representation of the Collatz sequence. Computations to generate Ananta-graph: The program generates a graph based on the Collatz conjecture for a given number. It includes a function to convert negative numbers to two’s complement, calculates the Collatz sequence until the number 4 appears twice and then creates a visual graph of the sequence. The graph is displayed using matplotlib and the sequence can be shown in a table or exported to an Excel file. A graphical user interface (GUI) built with Tkinter allows the user to input a number, generate the graph, view the sequence in a table and export the data. The GUI features buttons for generating the graph and exporting the sequence to Excel, as well as error handling for invalid inputs. Below are the functions called for the same process. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 19 https://internationalpubls.com • Twos_complement function: This function handles negative integers by converting them to their two’s complement representation using 8-bit format (i.e., by adding 256 for negative numbers). If the number is positive, it remains unchanged. • Collatz_conjecture function: This function generates the Collatz sequence starting from a given number. It continues until the number 4 appears twice. If the sequence is long, it truncates the middle part and inserts ellipse to simplify the output. • Ananta_graph function: This function creates a graph representing the Collatz sequence. It takes the number as input. generates the sequence and creates a graph where each step in the sequence is a node and the transitions between numbers are the edges. It visualizes and saves the graph using matplotlib. This function is triggered when the user inputs a number and selects a button in the GUI. • Display_sequence_table function: This function takes the number, generates the graph and displays the corresponding Collatz sequence in a table. If the input is invalid, it shows an error message. This function is responsible for clearing any previous data from the table and inserting the Collatz sequence values into the table along with their step numbers. • Export_to_excel function: This function exports the Collatz sequence to an Excel file when it is triggered after generating the graph. It handles the export process only if a valid number is entered. • Create GUI: This sets up the graphical user interface using Tkinter. It includes input fields for entering a number, buttons for generating the graph and exporting data and table to display the sequence. Based on user actions, it runs the application. Algorithm for Ananta-Graph Generator: Input: • A user-provided integer n. Output: • Visualization of the Collatz sequence as an Ananta-Graph. • Display of the Collatz sequence in the table. • Export the sequence to an Excel file. Steps: 1. Initialize the GUI: • Create the main GUI window using the tkinter library. • Add widgets for user input (Entry), buttons, and a table (Treeview) to display results. 2. Two’s complement conversion function (twos_complement): • If n is negative, convert it to its two’s complement representation for an 8-bit number. 3. Collatz Conjecture function (collatz_conjecture): • Start with the input number n. • Generate the sequence by: o Dividing n by 2 if even. o Multiplying n by 3 and adding 1 if odd. • Stop when the number 4 appears for the second time. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 20 https://internationalpubls.com • Append 2 and 1 to complete the sequence. • Shorten the sequence if it has more than 20 elements by adding placeholders (“…….”). 4. Ananta-Graph creation (ananta-graph): • Use the Collatz sequence to construct a graph using networkz. • Add nodes and edges between consecutive numbers in the sequence. • Use a linear layout to position nodes, with the final loop node placed distinctly. • Save and display the graph as an image using matplotlib. 5. Generate Graph and Display sequence: • Retrieve the input number from the GUI Entry field. • Compute the Collatz sequence and display the graph. • Display the sequence in a table format (Treeview). 6. Export Sequence to Excel (export_to_excel): • Convert the Collatz sequence into a DataFrame using pandas. • Save the DataFrame to an Excel file (collatz_sequence.xlsx). • Display a success message or handle errors, if any. 7. GUI interactions: • Generate Graph Button: Calls the generate_graph function to compute the sequence, display the graph, and populate the table. • Export to Excel Button: Exports the displayed sequence to an Excel file. 8. Error Handling: • Display appropriate error messages for invalid inputs or export errors using messagebox. 9. Display Output: • Show the Ananta-Graph visualization and the sequence table. • Save the sequence to Excel. In this paper, we generate the Ananta-graph for the positive integers using Python code based on the above pseudocode. Following are some positive numbers with their Collatz sequence and their Ananta- graph representation. Ananta-graphs with sequence n=7 Collatz sequence: 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 n=15 Collatz sequence: 15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 21 https://internationalpubls.com n=37 Collatz sequence: 37, 112, 56, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 n=59 Collatz sequence: 59, 178, 89, 268, 134, 67, 202, 101, 304, 152, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 n=83 Collatz sequence: 83, 250, 125, 376, 188, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182, 91, 274, 137, 412, 206, 103, 310, 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 n=100 Collatz sequence: 100, 50, 25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 n=155 Collatz sequence: 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 22 https://internationalpubls.com 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 n=217 Collatz sequence: 217, 652, 326, 163, 490, 245, 736, 368, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 n=590 Collatz sequence: 590, 295, 886, 443, 1330, 665, 1996, 998, 499, 1498, 749, 2248, 1124, 562, 281, 844, 422, 211, 634, 317, 952, 476, 238, 119, 358, 179, 538, 269, 808, 404, 202, 101, 304, 152, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 n=2367 Collatz sequence: 2367, 7102, 3551, 10654, 5327, 15982, 7991, 23974, 11987, 35962, 17981, 53944, 26972, 13486, 6743, 20230, 10115, 30346, 15173, 45520, 22760, 11380, 5690, 2845, 8536, 4268, 2134, 1067, 3202, 1601, 4804, 2402, 1201, 3604, 1802, 901, 2704, 1352, 676, 338, 169, 508, 254, 127, 382, 191, 574, 287, 862, 431, 1294, 647, 1942, 971, 2914, 1457, 4372, 2186, 1093, 3280, 1640, 820, 410, 205, 616, 308, 154, 77, 232, 116, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1 Results and discussions: It is observed that all the positive numbers sequence eventually reach the cycle 4, 2, 1 ultimately. It is tested for a very high range of numbers and all those numbers sequence end in the cycle. Ananta- graphs of random positive numbers show that every tested number enters the triangular head of their Ananta-graph representation. This provides the graphical proof of the Collatz conjecture. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 23 https://internationalpubls.com For negative numbers, the Ananta-graph can be plotted by converting them to positive numbers using 2’s complement as mentioned in the pseudocode of the Python program. The 2’s complement of a negative number is a method used in computer systems to represent signed integers in binary. It is done by representing a absolute value in binary, inverting the each digit (1’s complement) and increment it by 1. Note that, in this paper, we have considered 8-bit length. Below are some negative numbers and their positive counterparts using 2’s complement. Negative number Positive number using 2’s complement -3 253 -17 239 -85 171 -101 155 -255 1 The number of iterations/steps taken by the integers are different from each other to reach 1. Integer Number of steps to reach 1 Integer Number of steps to reach 1 1 1 21 8 2 2 22 16 3 8 23 16 4 3 24 11 5 6 25 24 6 9 26 11 7 17 27 112 8 4 28 19 9 20 29 19 10 7 30 19 11 15 31 107 12 10 32 6 13 10 33 27 14 18 34 14 15 18 35 14 16 5 36 22 17 13 37 22 18 21 38 22 19 21 39 35 20 8 40 9 Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 24 https://internationalpubls.com Note that for reference, we have taken the numbers between 1 and 40. The above table contains the number and its iteration count to reach 1 when subjected to Collatz conjecture. Based on this data, following observations are made: 1. Even-Odd rule dynamics: For even numbers, the sequence halves the number to a faster reduction. For odd numbers, the sequence increases the number, often causing a temporary rise before reducing again. This variation creates unpredictable patterns. 2. Step count variation: Different numbers have widely varying step counts. For example: Starting at 6 takes 9 steps to reach 1 whereas larger numbers like 27 takes 112 steps. Strating at 9 takes 20 steps to reach 1 and large numbers like 24 takes 11 steps. There is no clear pattern or formula that can directly predict the number of steps for any arbitrary number without running the sequence. 3. Growth and Collapse Cycles: During the sequence, odd numbers tend to cause temporary spikes in value before eventually collapsing when the even-number rule reduces them. This creates a sawtooth-like pattern in many sequences. This fluctuation between growth and collapse is unpredictable, yet eventually every tested number collapses at 1. 4. Distribution of Step counts: Many small numbers take relatively few steps to reach 1, but as the starting number increases, the number of steps needed to reach 1 tends to grow unpredictably. However, some large numbers behave unexpectedly and take fewer steps than nearby small numbers. This irregularity makes predicting step count challenging. The Collatz sequence is a remarkable example of how basic operations can create complex and fascinating outcomes, with the number of steps being an intriguing feature for deeper exploration. Conclusion: The Collatz conjecture is a profound example of how a seemingly straight forward mathematical process can hide deep, unresolved mysteries. The conjecture’s rules are simple, but the behaviour of the sequence is complex and unpredictable. The sequence often exhibits alternating periods of growth and rapid decline, especially for odd numbers that temporarily increase before eventually collapsing due to repeated division by 2. To study these sequences, we have introduced Ananta-graphs, which Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 6s (2025) 25 https://internationalpubls.com offer a compelling visualization of the Collatz conjecture, where all the positive integers follow a trajectory that eventually leads to the triangular cycle of 4, 2, 1. The graph’s structure, with its triangular head and infinitely branching tail, encapsulates the core idea that no matter how large the number, it will eventually reach the same repeating cycle. This highlights both the elegance and mystery of the Collatz conjecture, as its simple rules produce a complex yet predictable pattern in the graph. The negative numbers are also exposed to Ananta-graphs by converting them to positive numbers using 2’s complement. Ananta-graphs provide an intuitive and structured way to explore the beaviour of sequences and their ultimate convergence, underscoring the potential infinite nature of number exploration. Future work: We would be exploring Ananta-graphs to a great extent by applying various graph concepts in order to prove its existence and uniqueness. The Collatz sequence will be represented in various aspects of graph theory to provide a valid proof using the mathematical tools available. Reference: [1] Thijs Laarhoven, Benne de Weger, The Collatz conjecture and De Bruijn graphs, Indagationes Mathematicae, Volume 24, Issue 4, 2013, Pages 971-983. [2] Machado JAT, Galhano A, Cao Labora D. A Clustering Perspective of the Collatz Conjecture. Mathematics, 9(4), 2021, 314. [3] Bennassar, Miguel C. THE COLLATZ CONJECTURE Interpreted with Graph Theory and the Properties of the Digital Root of Numbers: An Analytical Approach, OSF Preprints, 5 Mar. 2023. [4] B. U. Zaman, Exploring the Collatz Conjecture through Directed Graphs, Preprints, (2024), 2024020842. [5] Wey, Chin-Long, "Proof of Collatz Conjecture by Collatz graph", arXiv preprint arXiv:2309.09991, (2023). [6] Zhou, Xinyi, Proof of the Collatz Conjecture Using Logical and Probabilistic Approaches, OSF Preprints, 13 May 2024. [7] Furuta. M, Proof of Collatz Conjecture Using Division Sequence, Advances in Pure Mathematics, 12, (2022), 96-108.