Search for a tool
Collatz Conjecture

Tool to test the Collatz conjecture (or Hailstone or 3n+1) and variants that divide a number by 2 if it is even and else multiply it by 3 and add 1.

Results

Collatz Conjecture -

Tag(s) : Mathematics, Fun/Miscellaneous

Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Feedback and suggestions are welcome so that dCode offers the best 'Collatz Conjecture' tool for free! Thank you!

# Collatz Conjecture

## Custom Conjecture

### What is the Collatz conjecture? (Definition)

The Collatz Conjecture (or Syracuse Conjecture), also known as the 3n+1 problem, states that applying the 3n+1 algorithm to any positive integer will always end up with the number 1.

### What is the 3n+1 algorithm? (Calculation principle)

Take a number number $n$ (non-zero positive integer), if $n$ is even, divide it by $2$, else multiply by $3$ and add $1$. Start again by giving $n$ the value of the result previously obtained.

Mathematically the algorithm is defined by the function $f$: $$f_{3n+1}(n) = \begin{cases}{ \frac{n}{2}} & {\text{if }}n \equiv 0 \mod{2} \\ 3n+1 & {\text{if }} n \equiv 1 \mod{2} \end{cases}$$

Example: $n=10$, $10$ is even, divide it by $2$ and get $5$,
$5$ is odd, multiply it by $3$ and add $1$ to get $16$,
Continue the sequence to get $8$, $4$, $2$ and $1$.

When the value $1$ is obtained, continuation is generally considered complete, because the algorithm renders in an infinite loop of 4, 2, 1, 4, 2, 1, 4, 2, 1.

The sequence is generally considered to be finished at 1, because otherwise the following numbers are 4, 2, 1, 4, 2, 1, 4, 2, 1 which are repeated endlessly.

Some numbers have surprising sequences (called trajectories) like 27, 255, 447, 639 or 703.

### What is the shortcut version?

If the number $n$ is odd, then multiplying it by $3$ and adding $1$ necessarily makes it even, the next step is necessarily a division by 2.

The compressed (or shortened) version merges the $3x+1$ and $x/2$ calculations into a single step $(3x+1)/2$

### Is there any number that does not obey the Collatz Conjecture rules?

No, nobody has found a number for which it does not work but nobody has found any mathematical proof that the conjecture is always true.

This is why the conjecture is also called the Syracuse problem or the Collatz problem and it is not a theorem.

Anyone finding a number that does not end at 1 will then have solved the conjecture by proving it to be false.

### Was the Collatz conjecture solved?

No, there have been some real advances recently but the Syracuse conjecture remains unsolved despite dozens of pseudo-scientists who have claimed to have a proof.

### What are remarkable properties of this conjecture?

A number never appears twice in the sequence.

Any sequence ends with a series of powers of 2.

An odd number is always followed by an even number.

The numbers 5 and 32 give the same result.

### How to code Collatz conjecture?

There are several ways to program source code for the 3x+1 algorithm:// Javascriptfunction step(n) { if (n%2 == 0) return n/2; return 3*n+1;}function collatz(n) { var nb = 1; while (n != 1) { n = step(n); nb++; } return nb;}// Pythondef collatz(x): while x != 1: if x % 2 > 0: x =((3 * x) + 1) list_.append(x) else: x = (x / 2) list_.append(x) return list_

### What are the other names of this conjecture?

The Collatz conjecture/problem is also known as

— 3n+1 conjecture (or 3x+1)

— Hailstone conjecture

— Ulam conjecture

— Kakutani's problem

— Thwaites conjecture

— Hasse's algorithm

Syracuse problem

— HOTPO (Half Or Triple Plus One)

The name Syracuse comes from the Syracuse University, a city in the state of New York in the United States.

### What are the numbers with a given stopping time?

This table is for numbers until 1000 (total time/iterations => numbers)

0 1 2 4 8 16 5, 32 10, 64 3, 20, 21, 128 6, 40, 42, 256 12, 13, 80, 84, 85, 512 24, 26, 160, 168, 170 48, 52, 53, 320, 336, 340, 341 17, 96, 104, 106, 113, 640, 672, 680, 682 34, 35, 192, 208, 212, 213, 226, 227 11, 68, 69, 70, 75, 384, 416, 424, 426, 452, 453, 454 22, 23, 136, 138, 140, 141, 150, 151, 768, 832, 848, 852, 853, 904, 906, 908, 909 7, 44, 45, 46, 272, 276, 277, 280, 282, 300, 301, 302 14, 15, 88, 90, 92, 93, 544, 552, 554, 560, 564, 565, 600, 602, 604, 605 28, 29, 30, 176, 180, 181, 184, 186, 201 9, 56, 58, 60, 61, 352, 360, 362, 368, 369, 372, 373, 401, 402, 403 18, 19, 112, 116, 117, 120, 122, 704, 720, 724, 725, 736, 738, 739, 744, 746, 753, 802, 803, 804, 805, 806 36, 37, 38, 224, 232, 234, 240, 241, 244, 245, 267 72, 74, 76, 77, 81, 448, 464, 468, 469, 480, 482, 483, 488, 490, 497, 534, 535, 537 25, 144, 148, 149, 152, 154, 162, 163, 896, 928, 936, 938, 960, 964, 965, 966, 976, 980, 981, 985, 994, 995 49, 50, 51, 288, 296, 298, 304, 308, 309, 321, 324, 325, 326, 331 98, 99, 100, 101, 102, 576, 592, 596, 597, 608, 616, 618, 625, 642, 643, 648, 650, 652, 653, 662, 663, 713, 715 33, 196, 197, 198, 200, 202, 204, 205, 217 65, 66, 67, 392, 394, 396, 397, 400, 404, 405, 408, 410, 433, 434, 435, 441, 475 130, 131, 132, 133, 134, 784, 788, 789, 792, 794, 800, 808, 810, 816, 820, 821, 833, 857, 866, 867, 868, 869, 870, 875, 882, 883, 950, 951, 953, 955 43, 260, 261, 262, 264, 266, 268, 269, 273, 289 86, 87, 89, 520, 522, 524, 525, 528, 529, 532, 533, 536, 538, 546, 547, 555, 571, 577, 578, 579, 583, 633, 635 172, 173, 174, 177, 178, 179 57, 59, 344, 346, 348, 349, 354, 355, 356, 357, 358, 385, 423 114, 115, 118, 119, 688, 692, 693, 696, 698, 705, 708, 709, 710, 712, 714, 716, 717, 729, 761, 769, 770, 771, 777, 846, 847 39, 228, 229, 230, 236, 237, 238 78, 79, 456, 458, 460, 461, 465, 472, 473, 474, 476, 477, 507, 513 153, 156, 157, 158, 912, 916, 917, 920, 922, 930, 931, 943, 944, 945, 946, 947, 948, 949, 952, 954, 971, 987 305, 306, 307, 312, 314, 315, 316, 317 105, 610, 611, 612, 613, 614, 624, 628, 629, 630, 631, 632, 634, 647, 683, 687 203, 209, 210, 211 406, 407, 409, 418, 419, 420, 421, 422, 431, 455 135, 139, 812, 813, 814, 817, 818, 819, 827, 836, 837, 838, 840, 841, 842, 843, 844, 845, 862, 863, 910, 911 270, 271, 278, 279, 281, 287, 303 540, 541, 542, 545, 551, 556, 557, 558, 561, 562, 563, 574, 575, 606, 607 185, 187, 191 361, 363, 367, 370, 371, 374, 375, 382, 383 123, 127, 721, 722, 723, 726, 727, 734, 735, 740, 741, 742, 747, 748, 749, 750, 764, 765, 766, 809, 891 246, 247, 249, 254, 255 481, 489, 492, 493, 494, 498, 499, 508, 509, 510, 539 169, 961, 962, 963, 969, 978, 979, 984, 986, 988, 989, 996, 997, 998, 999 329, 338, 339, 359 641, 657, 658, 659, 665, 676, 677, 678, 718, 719 219, 225, 239 427, 438, 439, 443, 450, 451, 478, 479 159, 854, 855, 876, 877, 878, 886, 887, 900, 901, 902, 907, 956, 957, 958 295, 318, 319 569, 585, 590, 591, 601, 636, 637, 638 379, 393, 425 758, 759, 767, 779, 786, 787, 801, 849, 850, 851 283 505, 511, 519, 566, 567 377 673, 679, 681, 699, 711, 754, 755 251 502, 503 167, 897, 905, 923 334, 335 111, 603, 615, 668, 669, 670 222, 223 444, 445, 446 799, 807, 888, 890, 892, 893 297 593, 594, 595 395 790, 791, 793 263 526, 527 175 350, 351 700, 701, 702 233 466, 467 155, 839, 932, 933, 934, 939 310, 311 103, 559, 620, 621, 622 206, 207 412, 413, 414 137, 745, 824, 826, 828, 829 274, 275 91, 548, 549, 550 182, 183, 993 364, 365, 366 121, 671, 728, 730, 732, 733, 743 242, 243 447, 484, 485, 486, 495 161, 894, 895, 968, 970, 972, 973, 977, 990, 991 322, 323 107, 644, 645, 646, 651 214, 215 71, 428, 429, 430 142, 143, 795, 856, 858, 860, 861 47, 284, 285, 286 94, 95, 568, 570, 572, 573 31, 188, 189, 190 62, 63, 376, 378, 380, 381 124, 125, 126, 752, 756, 757, 760, 762 41, 248, 250, 252, 253 82, 83, 496, 500, 501, 504, 506 27, 164, 165, 166, 992, 1000 54, 55, 328, 330, 332, 333, 337 108, 109, 110, 656, 660, 661, 664, 666, 674, 675 216, 218, 220, 221 73, 432, 436, 437, 440, 442, 449 145, 146, 147, 864, 872, 874, 880, 881, 884, 885, 898, 899, 903, 927 290, 291, 292, 293, 294, 299 97, 580, 581, 582, 584, 586, 587, 588, 589, 598, 599 193, 194, 195, 199 386, 387, 388, 389, 390, 391, 398, 399 129, 772, 773, 774, 776, 778, 780, 781, 782, 783, 785, 796, 797, 798 257, 258, 259, 265 514, 515, 516, 517, 518, 521, 523, 530, 531 171 342, 343, 345, 347, 353 684, 685, 686, 689, 690, 691, 694, 695, 697, 706, 707 231, 235 457, 459, 462, 463, 470, 471 913, 914, 915, 918, 919, 921, 924, 925, 926, 929, 935, 940, 941, 942, 959 313 609, 617, 619, 623, 626, 627, 639 411, 415, 417 811, 815, 822, 823, 825, 830, 831, 834, 835 543, 553 731, 737, 751 487, 491 967, 974, 975, 982, 983 327 649, 654, 655, 667 859, 865, 873, 879, 889 763, 775 703 937 871

### What are the numbers with a given highest number reached?

This table shows numbers until 1000 (max number reached => numbers)

1 1 2 4 8 3, 5, 6, 10, 12, 16 20 24 32 13, 26, 40 48 7, 9, 11, 14, 17, 18, 22, 28, 34, 36, 44, 52 56 21, 42, 64 68 72 80 84 19, 25, 29, 38, 50, 58, 76, 88 96 33, 66, 100 104 37, 74, 112 116 128 132 45, 90, 136 144 49, 98, 148 152 15, 23, 30, 35, 46, 53, 60, 70, 92, 106, 120, 140, 160 168 176 180 61, 122, 184 192 43, 57, 65, 86, 114, 130, 172, 196 200 69, 138, 208 212 224 228 51, 77, 102, 154, 204, 232 240 81, 162, 244 85, 170, 256 260 264 272 276 93, 186, 280 288 296 39, 59, 67, 78, 89, 101, 118, 134, 156, 178, 202, 236, 268, 304 308 312 320 324 336 75, 113, 150, 226, 300, 340 344 117, 234, 352 356 360 368 372 384 392 133, 266, 400 404 408 416 141, 282, 424 99, 149, 198, 298, 396, 448 452 456 464 468 157, 314, 472 480 488 512 115, 153, 173, 230, 306, 346, 460, 520 528 177, 354, 532 536 181, 362, 544 552 560 564 576 87, 131, 174, 197, 262, 348, 394, 524, 592 596 600 608 612 205, 410, 616 624 123, 139, 185, 209, 246, 278, 370, 418, 492, 556, 628 213, 426, 640 648 672 680 229, 458, 688 692 696 704 708 237, 474, 712 720 241, 482, 724 163, 217, 245, 326, 434, 490, 652, 736 740 744 768 261, 522, 784 788 792 800 79, 105, 119, 158, 179, 210, 238, 269, 316, 358, 420, 476, 538, 632, 716, 808 816 273, 546, 820 277, 554, 832 836 840 848 852 289, 578, 868 896 301, 602, 904 912 135, 203, 270, 305, 406, 540, 610, 812, 916 920 309, 618, 928 936 944 948 187, 211, 249, 281, 317, 374, 422, 498, 562, 634, 748, 844, 952 960 321, 642, 964 325, 650, 976 980 984 996 151, 201, 227, 302, 341, 402, 454, 604, 682, 804, 908 349, 698 357, 714 369, 738 373, 746 385, 770 397, 794 267, 401, 534, 802 405, 810 421, 842 433, 866 453, 906 307, 409, 461, 614, 818, 922 465, 930 469, 938 477, 954 493, 986 331, 441, 497, 662, 882, 994 513 525 529 315, 355, 473, 533, 630, 710, 946 541 363, 545, 726 219, 247, 329, 371, 438, 494, 557, 658, 742, 876, 988 561 565 577 597 403, 537, 605, 806 613 625 279, 419, 558, 629, 838 435, 653, 870 657 693 705 709 717 721 483, 725, 966 741 295, 393, 443, 499, 590, 665, 749, 786, 886, 998 753 769 789 805 813 817 547, 729, 821 555, 833 837 375, 563, 750, 845 853 579, 869 877 909 271, 361, 379, 407, 427, 481, 505, 542, 569, 611, 641, 673, 722, 758, 814, 854, 897, 917, 962 945 949 961 507, 571, 643, 761, 857, 965 981 439, 585, 659, 878, 989 997 303, 455, 606, 683, 910 423, 635, 715, 846, 953 723 739, 985 771 519, 779 699, 787 475, 535, 633, 713, 803, 950 819 843 867 583, 777, 875 883 367, 489, 551, 734, 827, 931, 978 631, 747, 841, 947 963 127, 169, 191, 225, 254, 287, 338, 339, 382, 431, 450, 451, 508, 509, 574, 601, 647, 676, 677, 678, 764, 765, 801, 862, 900, 901, 902, 971 979 663, 995 711 955 727, 969 759 855 603, 679, 905 591, 887 951 687 987 559, 745, 839, 993 847, 891 27, 31, 41, 47, 54, 55, 62, 63, 71, 73, 82, 83, 91, 94, 95, 97, 103, 107, 108, 109, 110, 111, 121, 124, 125, 126, 129, 137, 142, 143, 145, 146, 147, 155, 159, 161, 164, 165, 166, 167, 171, 175, 182, 183, 188, 189, 190, 193, 194, 195, 199, 206, 207, 214, 215, 216, 218, 220, 221, 222, 223, 231, 233, 235, 239, 242, 243, 248, 250, 251, 252, 253, 257, 258, 259, 263, 265, 274, 275, 283, 284, 285, 286, 290, 291, 292, 293, 294, 297, 299, 310, 311, 313, 318, 319, 322, 323, 327, 328, 330, 332, 333, 334, 335, 337, 342, 343, 345, 347, 350, 351, 353, 359, 364, 365, 366, 376, 377, 378, 380, 381, 386, 387, 388, 389, 390, 391, 395, 398, 399, 411, 412, 413, 414, 415, 417, 425, 428, 429, 430, 432, 436, 437, 440, 442, 444, 445, 446, 449, 457, 459, 462, 463, 466, 467, 470, 471, 478, 479, 484, 485, 486, 487, 491, 496, 500, 501, 502, 503, 504, 506, 514, 515, 516, 517, 518, 521, 523, 526, 527, 530, 531, 539, 543, 548, 549, 550, 553, 566, 567, 568, 570, 572, 573, 580, 581, 582, 584, 586, 587, 588, 589, 593, 594, 595, 598, 599, 607, 609, 617, 619, 620, 621, 622, 623, 626, 627, 636, 637, 638, 644, 645, 646, 649, 651, 654, 655, 656, 660, 661, 664, 666, 668, 669, 670, 674, 675, 684, 685, 686, 689, 690, 691, 694, 695, 697, 700, 701, 702, 706, 707, 718, 719, 728, 730, 731, 732, 733, 737, 752, 754, 755, 756, 757, 760, 762, 763, 772, 773, 774, 775, 776, 778, 780, 781, 782, 783, 785, 790, 791, 793, 796, 797, 798, 809, 811, 815, 822, 823, 824, 825, 826, 828, 829, 830, 834, 835, 849, 850, 851, 856, 858, 859, 860, 861, 864, 865, 872, 873, 874, 880, 881, 884, 885, 888, 890, 892, 893, 898, 899, 903, 911, 913, 914, 915, 918, 919, 921, 924, 925, 926, 929, 932, 933, 934, 935, 939, 940, 941, 942, 956, 957, 958, 967, 968, 970, 972, 973, 974, 977, 982, 983, 992, 1000 943 975 879 615, 923 735 999 799 255, 383, 510, 575, 766, 863, 907 495, 743, 990 991 927 831 667, 751, 889 447, 511, 671, 681, 767, 795, 807, 894, 895 639, 959 871 703, 937

### What numbers go above N?

The table above shows altitudes up to 250504 for numbers up to 1000. But there are infinite numbers that go higher.

For any given number N (very large N), then the odd number closest to N will have an even greater elevation.

### When was the conjecture proposed?

Formulated in 1937 by Lothar Collatz (german mathematician), it remains unsolved: nobody has been able to prove this conjecture always ends with 1.

## Source code

dCode retains ownership of the "Collatz Conjecture" source code. Except explicit open source licence (indicated Creative Commons / free), the "Collatz Conjecture" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Collatz Conjecture" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Collatz Conjecture" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

## Cite dCode

The copy-paste of the page "Collatz Conjecture" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Collatz Conjecture on dCode.fr [online website], retrieved on 2024-09-10, https://www.dcode.fr/collatz-conjecture

## Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!