21
$\begingroup$

I've just written a simple java program to print out the length of a Collatz sequence, and found something I find remarkable: Consecutive sequences of identical Collatz sequence lengths. Here is some sample output:

Number: 98 has sequence length 25
Number: 99 has sequence length 25
Number: 100 has sequence length 25
Number: 101 has sequence length 25
Number: 102 has sequence length 25

How is it that these $5$ numbers have the same sequence length? Are the numbers $98-102$ special (note there are several more such sequences, e.g. $290-294!$)? Is $5$ the longest known? If not what is it?


As an aside, here are the sequences for the above numbers (along with helpful stats) as well as the step after it (very long):

Number: 102 has sequence length 25
Number: 51 has sequence length 24
Number: 154 has sequence length 23
Number: 77 has sequence length 22
Number: 232 has sequence length 21
Number: 116 has sequence length 20
Number: 58 has sequence length 19
Number: 29 has sequence length 18
Number: 88 has sequence length 17
Number: 44 has sequence length 16
Number: 22 has sequence length 15
Number: 11 has sequence length 14
Number: 34 has sequence length 13
Number: 17 has sequence length 12
Number: 52 has sequence length 11
Number: 26 has sequence length 10
Number: 13 has sequence length 9
Number: 40 has sequence length 8
Number: 20 has sequence length 7
Number: 10 has sequence length 6
Number: 5 has sequence length 5
Number: 16 has sequence length 4
Number: 8 has sequence length 3
Number: 4 has sequence length 2
Number: 2 has sequence length 1
Number: 1 has sequence length 0
Sequence length: 25. 
Steps calculated: 25. 
Efficiency of: 0.0%
Number: 101 has sequence length 25
Number: 304 has sequence length 24
Number: 152 has sequence length 23
Number: 76 has sequence length 22
Number: 38 has sequence length 21
Number: 19 has sequence length 20
Number: 58 has sequence length 19
Sequence length: 25. 
Steps calculated: 6. 
Efficiency of: 76.0%
Number: 100 has sequence length 25
Number: 50 has sequence length 24
Number: 25 has sequence length 23
Number: 76 has sequence length 22
Sequence length: 25. 
Steps calculated: 3. 
Efficiency of: 88.0%
Number: 99 has sequence length 25
Number: 298 has sequence length 24
Number: 149 has sequence length 23
Number: 448 has sequence length 22
Number: 224 has sequence length 21
Number: 112 has sequence length 20
Number: 56 has sequence length 19
Number: 28 has sequence length 18
Number: 14 has sequence length 17
Number: 7 has sequence length 16
Number: 22 has sequence length 15
Sequence length: 25. 
Steps calculated: 10. 
Efficiency of: 60.0%
Number: 98 has sequence length 25
Number: 49 has sequence length 24
Number: 148 has sequence length 23
Number: 74 has sequence length 22
Number: 37 has sequence length 21
Number: 112 has sequence length 20
Sequence length: 25. 
Steps calculated: 5. 
Efficiency of: 80.0%
Number: 97 has sequence length 118
Number: 292 has sequence length 117
Number: 146 has sequence length 116
Number: 73 has sequence length 115
Number: 220 has sequence length 114
Number: 110 has sequence length 113
Number: 55 has sequence length 112
Number: 166 has sequence length 111
Number: 83 has sequence length 110
Number: 250 has sequence length 109
Number: 125 has sequence length 108
Number: 376 has sequence length 107
Number: 188 has sequence length 106
Number: 94 has sequence length 105
Number: 47 has sequence length 104
Number: 142 has sequence length 103
Number: 71 has sequence length 102
Number: 214 has sequence length 101
Number: 107 has sequence length 100
Number: 322 has sequence length 99
Number: 161 has sequence length 98
Number: 484 has sequence length 97
Number: 242 has sequence length 96
Number: 121 has sequence length 95
Number: 364 has sequence length 94
Number: 182 has sequence length 93
Number: 91 has sequence length 92
Number: 274 has sequence length 91
Number: 137 has sequence length 90
Number: 412 has sequence length 89
Number: 206 has sequence length 88
Number: 103 has sequence length 87
Number: 310 has sequence length 86
Number: 155 has sequence length 85
Number: 466 has sequence length 84
Number: 233 has sequence length 83
Number: 700 has sequence length 82
Number: 350 has sequence length 81
Number: 175 has sequence length 80
Number: 526 has sequence length 79
Number: 263 has sequence length 78
Number: 790 has sequence length 77
Number: 395 has sequence length 76
Number: 1186 has sequence length 75
Number: 593 has sequence length 74
Number: 1780 has sequence length 73
Number: 890 has sequence length 72
Number: 445 has sequence length 71
Number: 1336 has sequence length 70
Number: 668 has sequence length 69
Number: 334 has sequence length 68
Number: 167 has sequence length 67
Number: 502 has sequence length 66
Number: 251 has sequence length 65
Number: 754 has sequence length 64
Number: 377 has sequence length 63
Number: 1132 has sequence length 62
Number: 566 has sequence length 61
Number: 283 has sequence length 60
Number: 850 has sequence length 59
Number: 425 has sequence length 58
Number: 1276 has sequence length 57
Number: 638 has sequence length 56
Number: 319 has sequence length 55
Number: 958 has sequence length 54
Number: 479 has sequence length 53
Number: 1438 has sequence length 52
Number: 719 has sequence length 51
Number: 2158 has sequence length 50
Number: 1079 has sequence length 49
Number: 3238 has sequence length 48
Number: 1619 has sequence length 47
Number: 4858 has sequence length 46
Number: 2429 has sequence length 45
Number: 7288 has sequence length 44
Number: 3644 has sequence length 43
Number: 1822 has sequence length 42
Number: 911 has sequence length 41
Number: 2734 has sequence length 40
Number: 1367 has sequence length 39
Number: 4102 has sequence length 38
Number: 2051 has sequence length 37
Number: 6154 has sequence length 36
Number: 3077 has sequence length 35
Number: 9232 has sequence length 34
Number: 4616 has sequence length 33
Number: 2308 has sequence length 32
Number: 1154 has sequence length 31
Number: 577 has sequence length 30
Number: 1732 has sequence length 29
Number: 866 has sequence length 28
Number: 433 has sequence length 27
Number: 1300 has sequence length 26
Number: 650 has sequence length 25
Number: 325 has sequence length 24
Number: 976 has sequence length 23
Number: 488 has sequence length 22
Number: 244 has sequence length 21
Number: 122 has sequence length 20
Number: 61 has sequence length 19
Number: 184 has sequence length 18
Number: 92 has sequence length 17
Number: 46 has sequence length 16
Number: 23 has sequence length 15
Number: 70 has sequence length 14
Number: 35 has sequence length 13
Number: 106 has sequence length 12
Number: 53 has sequence length 11
Number: 160 has sequence length 10
Number: 80 has sequence length 9
Number: 40 has sequence length 8
Sequence length: 118. 
Steps calculated: 110. 
Efficiency of: 6.779661016949152%

It looks like some numbers act as attractors for the sequence paths, and some numbers 'start' near them in I guess 'collatz space'.

$\endgroup$
5
  • $\begingroup$ Have you computed a huge table of these lengths? $\endgroup$ Aug 18, 2013 at 23:31
  • 1
    $\begingroup$ No. It's getting late here, and I have work tomorrow. I actually think I found a sequence of 6, when I ran through up to 1000. Maybe tomorrow. $\endgroup$ Aug 18, 2013 at 23:36
  • $\begingroup$ I'd note that this depends on how you define "Collatz sequence" - does an odd n get mapped to 3n+1, or to (3n+1)/2? (You've chosen the first one.) $\endgroup$ Aug 18, 2013 at 23:41
  • 1
    $\begingroup$ @Michael : The usual definition is the first one. Look it up ; it's related to the $3n+1$ conjecture (or the Collatz conjecture), and the name is not irrelevant. $\endgroup$ Aug 19, 2013 at 0:13
  • 1
    $\begingroup$ See oeis.org/A008908. There's a sequence of length 17 starting at 7083. After 36 steps, the sequence of iterates of 7083 through 7099 all coalesce at 76; they all reach 1 at step 58. $\endgroup$ Aug 19, 2013 at 0:21

7 Answers 7

17
+500
$\begingroup$

I have found a sequence of 67,108,863 consecutive numbers that all have the same Collatz length (height). These numbers are in the range $[2^{1812}+1, 2^{1812}+2^{26}-1]$ and I believe it is the longest such sequence known to date. Also I believe that we can obtain arbitrarily long such sequences if we start from numbers of the form $2^n+1$. I would be very interested to see a proof of this though. I have created an OEIS sequence for this: https://oeis.org/A277109

$\endgroup$
2
  • 6
    $\begingroup$ By an amazing coincidence, the run of consecutive numbers described in my answer had already been discovered more than fifteen years ago by Guo-Gang Gao, the author of a paper referenced on your OEIS sequence page! $\endgroup$ Jun 26, 2020 at 20:54
  • $\begingroup$ That's right. It was the only paper I found about this particular topic. $\endgroup$ Jun 27, 2020 at 0:18
15
$\begingroup$

I found a longer sequence ;)

596310 has sequence length 97
596311 has sequence length 97
596312 has sequence length 97
...
596349 has sequence length 97

That's 40 in a row!

There's nothing special about these numbers, as far as I can see. In fact, there are probably arbitrary long sequences of consecutive numbers with identical Collatz lengths. Here's a heuristic argument:

A number $n$ usually takes on the order of ~$\text{log}(n)$ Collatz steps to reach $1$.

Suppose all of the numbers between $1$ and $n$ have random Collatz lengths between $1$ and ~$\text{log}(n)$. Then, if we choose a starting point at random, the probability that the next $X$ consecutive numbers all have the same Collatz length is ~$\text{log}(n)^X$. There are ~$n$ possible starting points, so we want $X$ so that the probability is $\text{log}(n)^X \cong \frac{1}{n}$. Then I'd expect the longest sequence to have around $X$ consecutive numbers.

As it turns out, $X=\frac{\text{log}(n)}{\text{log}\text{log}(n)}$ does the trick.

TL;DR: between $1$ and $n$, the longest sequence of consecutive numbers with identical Collatz lengths is on the order of $\frac{\text{log}(n)}{\text{log}\text{log}(n)}$ numbers long.

$\endgroup$
7
  • $\begingroup$ Fact of the day: $\text{ }\large{log(n)^{\frac{log(n)}{log(log(n))}}=n}$. In retrospect, it works out, but I never expected the answer to be this nice. $\endgroup$
    – Lopsy
    Aug 19, 2013 at 0:30
  • $\begingroup$ Awesome! My only issue here is that: log(596349)/log(log(596349)) ~ 7, not 40 ! Still, well argued. $\endgroup$ Aug 19, 2013 at 7:43
  • 4
    $\begingroup$ That's because the "Collatz path" of nearby numbers often coalesces. To take a simple example, there are sequences starting 36-18-9-28 and 37-112-56-28. Both have one upward step and two downward steps, but in different orders. Lopsy's heuristic doesn't know about this. $\endgroup$ Aug 19, 2013 at 18:25
  • $\begingroup$ Oh, yeah, I didn't notice that. In that case, maybe we can explicitly find long sequences. $\endgroup$
    – Lopsy
    Aug 19, 2013 at 23:09
  • $\begingroup$ @MichaelLugo what makes these numbers special? Anything? Nothing? $\endgroup$ Aug 20, 2013 at 21:14
11
+50
$\begingroup$

I wrote a java program which finds long consecutive sequences, here's the longest I've found so far. It has 126 consecutive sequence lengths. Oddly enough, the sequence length for the number before and the number after are both 173. I'll paste my code down below.

Starting number: 271114753
Ending number: 271114879
271114753 has a sequence length 279
271114754 has a sequence length 279
271114755 has a sequence length 279
...
271114879 has a sequence length 279

Edit: I have found something even more mind blowing, a consecutive sequence length of 206! From 1352349136 through to 1352349342.

Double edit: Here I'll have the updated values. Consecutive sequence length: 348. From 9749626154 through to 9749626502 (9.7 billion). It's the 4th time a figure over 300 appeared, and the first was at 6.6b.

Here's the code I used to find consecutive sequences (I used separate code to make what I pasted above). I had to use long instead of int because you reach the 32bit limit pretty quickly. Also I'm very new to java, so I'm not that great at using good names.

import java.util.Scanner;

public class CollatzConseq {
    public static void main(String args[]) {

        Scanner input = new Scanner(System.in);
        long start, startSaved, steps = 0;
        long conseq = 0, conseqStart = 1, conseqEnd = 1, stepsSaved = 0;


        System.out.print("Starting number: ");
        start = input.nextInt();
        startSaved = start;

        System.out.print("Print consecutive sequences greater than: ");
        int greaterThan = input.nextInt();

        while(conseq < 1000){

            start = startSaved; 
            steps = 0;

                while(start != 1) {

                        if ((start & 1) == 0)
                            start = start / 2;
                        else {
                            start = ( 3 * start ) + 1;
                        }

                        steps ++;


            } 
                if(steps == stepsSaved) {
                    conseq ++;
                    if(conseq == 1) {
                        conseqStart = startSaved - 1;
                    }

                } else {
                    conseqEnd = startSaved - 1;
                    if(conseq > greaterThan) {
                        System.out.println("Consecutive numbers with same steps: " + conseq);
                        System.out.println("From " + conseqStart + " through to " + conseqEnd);
                    }
                    conseq = 0;
                    conseqStart = 0;
                    conseqEnd = 0;
                }


            startSaved = startSaved + 1;

            stepsSaved = steps;

        }
        System.out.println("Consecutive numbers with same steps: " + conseq);
        System.out.println("From " + conseqStart + " through to " + conseqEnd);
    }
}

And this is the output of the code, showing sequences 100 and over up to 1.5 billion.

Starting number: 1
Print consecutive sequences greater than: 99

Consecutive numbers with same steps: 119
From 136696632 through to 136696751
Consecutive numbers with same steps: 105
From 137408360 through to 137408465
Consecutive numbers with same steps: 105
From 203336058 through to 203336163
Consecutive numbers with same steps: 104
From 206112544 through to 206112648
Consecutive numbers with same steps: 101
From 271114544 through to 271114645
Consecutive numbers with same steps: 126
From 271114753 through to 271114879
Consecutive numbers with same steps: 124
From 273393308 through to 273393432
Consecutive numbers with same steps: 102
From 311585664 through to 311585766
Consecutive numbers with same steps: 102
From 315612928 through to 315613030
Consecutive numbers with same steps: 103
From 321320961 through to 321321064
Consecutive numbers with same steps: 106
From 353975184 through to 353975290
Consecutive numbers with same steps: 129
From 361486064 through to 361486193
Consecutive numbers with same steps: 107
From 386021120 through to 386021227
Consecutive numbers with same steps: 135
From 406672385 through to 406672520
Consecutive numbers with same steps: 102
From 417372690 through to 417372792
Consecutive numbers with same steps: 103
From 418286960 through to 418287063
Consecutive numbers with same steps: 100
From 440310588 through to 440310688
Consecutive numbers with same steps: 104
From 469544278 through to 469544382
Consecutive numbers with same steps: 104
From 475961904 through to 475962008
Consecutive numbers with same steps: 115
From 481378160 through to 481378275
Consecutive numbers with same steps: 151
From 481981441 through to 481981592
Consecutive numbers with same steps: 101
From 533708240 through to 533708341
Consecutive numbers with same steps: 132
From 533708386 through to 533708518
Consecutive numbers with same steps: 131
From 535457128 through to 535457259
Consecutive numbers with same steps: 105
From 541550458 through to 541550563
Consecutive numbers with same steps: 125
From 546785808 through to 546785933
Consecutive numbers with same steps: 110
From 557715969 through to 557716079
Consecutive numbers with same steps: 100
From 570522283 through to 570522383
Consecutive numbers with same steps: 102
From 570765159 through to 570765261
Consecutive numbers with same steps: 112
From 570765424 through to 570765536
Consecutive numbers with same steps: 113
From 571237262 through to 571237375
Consecutive numbers with same steps: 133
From 587080784 through to 587080917
Consecutive numbers with same steps: 110
From 600421770 through to 600421880
Consecutive numbers with same steps: 100
From 601044060 through to 601044160
Consecutive numbers with same steps: 129
From 604790612 through to 604790741
Consecutive numbers with same steps: 100
From 626091804 through to 626091904
Consecutive numbers with same steps: 102
From 627430484 through to 627430586
Consecutive numbers with same steps: 119
From 632543098 through to 632543217
Consecutive numbers with same steps: 115
From 641077346 through to 641077461
Consecutive numbers with same steps: 130
From 642641992 through to 642642122
Consecutive numbers with same steps: 111
From 642642830 through to 642642941
Consecutive numbers with same steps: 103
From 648042497 through to 648042600
Consecutive numbers with same steps: 118
From 660465898 through to 660466016
Consecutive numbers with same steps: 111
From 662954968 through to 662955079
Consecutive numbers with same steps: 111
From 676174568 through to 676174679
Consecutive numbers with same steps: 104
From 695798672 through to 695798776
Consecutive numbers with same steps: 112
From 696286648 through to 696286760
Consecutive numbers with same steps: 100
From 701526108 through to 701526208
Consecutive numbers with same steps: 103
From 705859306 through to 705859409
Consecutive numbers with same steps: 111
From 708162446 through to 708162557
Consecutive numbers with same steps: 113
From 711611008 through to 711611121
Consecutive numbers with same steps: 173
From 711611184 through to 711611357
Consecutive numbers with same steps: 115
From 713942896 through to 713943011
Consecutive numbers with same steps: 175
From 722067240 through to 722067415
Consecutive numbers with same steps: 119
From 735787009 through to 735787128
Consecutive numbers with same steps: 110
From 743024144 through to 743024254
Consecutive numbers with same steps: 104
From 743620144 through to 743620248
Consecutive numbers with same steps: 103
From 756226256 through to 756226359
Consecutive numbers with same steps: 109
From 759908808 through to 759908917
Consecutive numbers with same steps: 135
From 760696376 through to 760696511
Consecutive numbers with same steps: 113
From 770215276 through to 770215389
Consecutive numbers with same steps: 110
From 772041856 through to 772041966
Consecutive numbers with same steps: 112
From 782773512 through to 782773624
Consecutive numbers with same steps: 107
From 782774122 through to 782774229
Consecutive numbers with same steps: 111
From 785679248 through to 785679359
Consecutive numbers with same steps: 101
From 785724417 through to 785724518
Consecutive numbers with same steps: 109
From 789216874 through to 789216983
Consecutive numbers with same steps: 106
From 792356400 through to 792356506
Consecutive numbers with same steps: 101
From 817108328 through to 817108429
Consecutive numbers with same steps: 102
From 825759746 through to 825759848
Consecutive numbers with same steps: 116
From 826293814 through to 826293930
Consecutive numbers with same steps: 128
From 836573992 through to 836574120
Consecutive numbers with same steps: 131
From 843390824 through to 843390955
Consecutive numbers with same steps: 113
From 850754544 through to 850754657
Consecutive numbers with same steps: 124
From 856148156 through to 856148280
Consecutive numbers with same steps: 101
From 856205825 through to 856205926
Consecutive numbers with same steps: 169
From 856855894 through to 856856063
Consecutive numbers with same steps: 106
From 856856065 through to 856856171
Consecutive numbers with same steps: 130
From 857673839 through to 857673969
Consecutive numbers with same steps: 102
From 864057864 through to 864057966
Consecutive numbers with same steps: 106
From 880621232 through to 880621338
Consecutive numbers with same steps: 100
From 885136226 through to 885136326
Consecutive numbers with same steps: 101
From 896268154 through to 896268255
Consecutive numbers with same steps: 149
From 901566090 through to 901566239
Consecutive numbers with same steps: 119
From 914324903 through to 914325022
Consecutive numbers with same steps: 117
From 915013056 through to 915013173
Consecutive numbers with same steps: 110
From 919246858 through to 919246968
Consecutive numbers with same steps: 103
From 927702872 through to 927702975
Consecutive numbers with same steps: 133
From 927731568 through to 927731701
Consecutive numbers with same steps: 108
From 941145772 through to 941145880
Consecutive numbers with same steps: 142
From 948814648 through to 948814790
Consecutive numbers with same steps: 134
From 951923816 through to 951923950
Consecutive numbers with same steps: 109
From 962269697 through to 962269806
Consecutive numbers with same steps: 105
From 964883112 through to 964883217
Consecutive numbers with same steps: 126
From 972033194 through to 972033320
Consecutive numbers with same steps: 104
From 973733726 through to 973733830
Consecutive numbers with same steps: 115
From 990667092 through to 990667207
Consecutive numbers with same steps: 106
From 994375344 through to 994375450
Consecutive numbers with same steps: 104
From 997963503 through to 997963607
Consecutive numbers with same steps: 126
From 1002849793 through to 1002849919
Consecutive numbers with same steps: 133
From 1008301674 through to 1008301807
Consecutive numbers with same steps: 108
From 1013510014 through to 1013510122
Consecutive numbers with same steps: 102
From 1014109568 through to 1014109670
Consecutive numbers with same steps: 167
From 1014261852 through to 1014262019
Consecutive numbers with same steps: 123
From 1026953728 through to 1026953851
Consecutive numbers with same steps: 101
From 1027155066 through to 1027155167
Consecutive numbers with same steps: 118
From 1028615536 through to 1028615654
Consecutive numbers with same steps: 114
From 1029389140 through to 1029389254
Consecutive numbers with same steps: 108
From 1032245116 through to 1032245224
Consecutive numbers with same steps: 111
From 1042254872 through to 1042254983
Consecutive numbers with same steps: 101
From 1042309474 through to 1042309575
Consecutive numbers with same steps: 132
From 1043665732 through to 1043665864
Consecutive numbers with same steps: 120
From 1043695847 through to 1043695967
Consecutive numbers with same steps: 149
From 1047572330 through to 1047572479
Consecutive numbers with same steps: 152
From 1047632555 through to 1047632707
Consecutive numbers with same steps: 110
From 1047711079 through to 1047711189
Consecutive numbers with same steps: 111
From 1049050364 through to 1049050475
Consecutive numbers with same steps: 100
From 1058788994 through to 1058789094
Consecutive numbers with same steps: 130
From 1062243692 through to 1062243822
Consecutive numbers with same steps: 104
From 1067416576 through to 1067416680
Consecutive numbers with same steps: 100
From 1068361956 through to 1068362056
Consecutive numbers with same steps: 112
From 1068522838 through to 1068522950
Consecutive numbers with same steps: 106
From 1093986048 through to 1093986154
Consecutive numbers with same steps: 147
From 1099533676 through to 1099533823
Consecutive numbers with same steps: 103
From 1109321217 through to 1109321320
Consecutive numbers with same steps: 109
From 1115416424 through to 1115416533
Consecutive numbers with same steps: 126
From 1115432028 through to 1115432154
Consecutive numbers with same steps: 117
From 1118672252 through to 1118672369
Consecutive numbers with same steps: 111
From 1118736600 through to 1118736711
Consecutive numbers with same steps: 104
From 1121402064 through to 1121402168
Consecutive numbers with same steps: 105
From 1122580481 through to 1122580586
Consecutive numbers with same steps: 117
From 1124521098 through to 1124521215
Consecutive numbers with same steps: 117
From 1141044650 through to 1141044767
Consecutive numbers with same steps: 108
From 1141530396 through to 1141530504
Consecutive numbers with same steps: 120
From 1142414192 through to 1142414312
Consecutive numbers with same steps: 111
From 1143565180 through to 1143565291
Consecutive numbers with same steps: 102
From 1152077570 through to 1152077672
Consecutive numbers with same steps: 128
From 1157192480 through to 1157192608
Consecutive numbers with same steps: 104
From 1171315256 through to 1171315360
Consecutive numbers with same steps: 132
From 1172536731 through to 1172536863
Consecutive numbers with same steps: 112
From 1174123960 through to 1174124072
Consecutive numbers with same steps: 102
From 1174160952 through to 1174161054
Consecutive numbers with same steps: 133
From 1178518906 through to 1178519039
Consecutive numbers with same steps: 105
From 1180184424 through to 1180184529
Consecutive numbers with same steps: 200
From 1202088120 through to 1202088320
Consecutive numbers with same steps: 109
From 1203591698 through to 1203591807
Consecutive numbers with same steps: 127
From 1235265032 through to 1235265159
Consecutive numbers with same steps: 100
From 1235330314 through to 1235330414
Consecutive numbers with same steps: 113
From 1236972886 through to 1236972999
Consecutive numbers with same steps: 177
From 1236975424 through to 1236975601
Consecutive numbers with same steps: 141
From 1254861032 through to 1254861173
Consecutive numbers with same steps: 104
From 1258506824 through to 1258506928
Consecutive numbers with same steps: 110
From 1266821248 through to 1266821358
Consecutive numbers with same steps: 141
From 1284222272 through to 1284222413
Consecutive numbers with same steps: 140
From 1285283841 through to 1285283981
Consecutive numbers with same steps: 111
From 1285285772 through to 1285285883
Consecutive numbers with same steps: 110
From 1297631514 through to 1297631624
Consecutive numbers with same steps: 114
From 1299738356 through to 1299738470
Consecutive numbers with same steps: 115
From 1299800392 through to 1299800507
Consecutive numbers with same steps: 119
From 1306058070 through to 1306058189
Consecutive numbers with same steps: 107
From 1311337176 through to 1311337283
Consecutive numbers with same steps: 100
From 1318737034 through to 1318737134
Consecutive numbers with same steps: 108
From 1319047682 through to 1319047790
Consecutive numbers with same steps: 123
From 1319142944 through to 1319143067
Consecutive numbers with same steps: 125
From 1319172930 through to 1319173055
Consecutive numbers with same steps: 106
From 1320889472 through to 1320889578
Consecutive numbers with same steps: 105
From 1325909935 through to 1325910040
Consecutive numbers with same steps: 112
From 1331803551 through to 1331803663
Consecutive numbers with same steps: 126
From 1339206145 through to 1339206271
Consecutive numbers with same steps: 109
From 1340243562 through to 1340243671
Consecutive numbers with same steps: 126
From 1344402248 through to 1344402374
Consecutive numbers with same steps: 109
From 1351346689 through to 1351346798
Consecutive numbers with same steps: 206
From 1352349136 through to 1352349342
Consecutive numbers with same steps: 103
From 1352924956 through to 1352925059
Consecutive numbers with same steps: 101
From 1354040684 through to 1354040785
Consecutive numbers with same steps: 123
From 1365424811 through to 1365424934
Consecutive numbers with same steps: 111
From 1371041168 through to 1371041279
Consecutive numbers with same steps: 142
From 1378870304 through to 1378870446
Consecutive numbers with same steps: 107
From 1384582154 through to 1384582261
Consecutive numbers with same steps: 126
From 1387887105 through to 1387887231
Consecutive numbers with same steps: 127
From 1388225520 through to 1388225647
Consecutive numbers with same steps: 173
From 1391554312 through to 1391554485
Consecutive numbers with same steps: 101
From 1391594497 through to 1391594598
Consecutive numbers with same steps: 118
From 1393491752 through to 1393491870
Consecutive numbers with same steps: 126
From 1396763137 through to 1396763263
Consecutive numbers with same steps: 105
From 1401395730 through to 1401395835
Consecutive numbers with same steps: 118
From 1403052298 through to 1403052416
Consecutive numbers with same steps: 100
From 1408647738 through to 1408647838
Consecutive numbers with same steps: 107
From 1408675100 through to 1408675207
Consecutive numbers with same steps: 134
From 1411718658 through to 1411718792
Consecutive numbers with same steps: 120
From 1416324976 through to 1416325096
Consecutive numbers with same steps: 116
From 1421421910 through to 1421422026
Consecutive numbers with same steps: 170
From 1423222016 through to 1423222186
Consecutive numbers with same steps: 128
From 1423222568 through to 1423222696
Consecutive numbers with same steps: 148
From 1424697115 through to 1424697263
Consecutive numbers with same steps: 104
From 1428708694 through to 1428708798
Consecutive numbers with same steps: 104
From 1435648512 through to 1435648616
Consecutive numbers with same steps: 120
From 1442527752 through to 1442527872
Consecutive numbers with same steps: 106
From 1444134640 through to 1444134746
Consecutive numbers with same steps: 113
From 1445867972 through to 1445868085
Consecutive numbers with same steps: 100
From 1445944380 through to 1445944480
Consecutive numbers with same steps: 119
From 1462492728 through to 1462492847
Consecutive numbers with same steps: 101
From 1465664144 through to 1465664245
Consecutive numbers with same steps: 119
From 1466044936 through to 1466045055
Consecutive numbers with same steps: 100
From 1467765292 through to 1467765392
Consecutive numbers with same steps: 102
From 1469300224 through to 1469300326
Consecutive numbers with same steps: 124
From 1473057246 through to 1473057370
Consecutive numbers with same steps: 102
From 1486011904 through to 1486012006
Consecutive numbers with same steps: 107
From 1491648688 through to 1491648795
Consecutive numbers with same steps: 101
From 1494078465 through to 1494078566
Consecutive numbers with same steps: 108
From 1495080786 through to 1495080894
$\endgroup$
8
$\begingroup$

I've created some functions in Python that help me study Collatz sequences. Python is ideal for this because it no longer has a hardcoded integer limit; they can be as large as your memory can support. I've regularly studied sequences starting with numbers larger than $2^{60}$, sometimes as large as $2^{10000}$.

I noticed the trend you were speaking of and was fascinated by it. The clumps of identical cycle lengths seem to be smaller around powers of two, but as the magnitude of the initial terms increase, the clumps seem to as well. The largest I've found so far is in the interval [$2^{500}+1$, $2^{500}+100,001$], with $35,654$ identical cycle lengths in a row, the cycle length being $3,280$. Here's the relevant code (it's encapsulated in a class, but with numbers that large I only use these static/class methods):

@staticmethod
def _seqgen(x):
    """Generates the Collatz sequence beginning with 'x'."""
    while x != 1:
        yield x
        if not x % 2:
            x //= 2
        else:
            x = 3*x + 1
    yield 1

@classmethod
def cyclength(cls, x):
    """Returns the cycle length of the Collatz sequence beginning
    with 'x'."""
    cyc_length = 0
    for i in cls._seqgen(x):
        cyc_length += 1
    return cyc_length

@classmethod
def same_cyclengths(cls, start, stop):
    """Finds the largest group of consecutive numbers within
    interval [start, stop) whose Collatz sequences have the same
    lengths.

    Returns a tuple whose first element is the cycle length repeated
    consecutively the most times, and the second is the number of
    times it was repeated.
    """
    start_length = cls.cyclength(start)
    current_streak = 1
    max_streak = 1
    streak_cyclength = 1
    for n in range(start+1, stop):
        if current_streak > max_streak:
            max_streak = current_streak
            streak_cyclength = length
        length = cls.cyclength(n)
        if length == start_length:
            current_streak += 1
        else:
            current_streak = 1
            start_length = length
    return (streak_cyclength, max_streak)
$\endgroup$
5
  • 3
    $\begingroup$ What are the identical cycle lengths in a row, exactly? $\endgroup$ Jun 2, 2017 at 8:13
  • $\begingroup$ I had forgotten to add that part in to my code. I just finished editing it now and added it to my post. The cycle length is $3280$. $\endgroup$ Jun 2, 2017 at 8:32
  • $\begingroup$ Update: Using a Java program I made, I discovered that in the above range of 100,000 sequences, only 14 do not have 3280 terms. $\endgroup$ Oct 12, 2017 at 15:23
  • $\begingroup$ @IsaacSaffold Using this website: nitrxgen.net/collatz I can't find the same values you are claiming. $\endgroup$
    – toto
    Aug 10, 2018 at 13:28
  • $\begingroup$ Which specifically did you try? $\endgroup$ Aug 10, 2018 at 13:35
7
$\begingroup$

I'd like to add a late answer/comment for a more readable table.

The following is a table, where the first occurences of sequences of "consecutive-equal-collatz-lengthes" ("cecl") are documented. The "# cecl" (=number of consecutive-equal-collatz-lengthes") $=2$ occurs at $n=12$ first time, that means, $n=12$ and $n=13$ have the same collatz trajectory length (of actually $9$ steps in the trajectory):

 #     | first| collatz 
"cecl" |   n  | traj.-len
-------+------+----------
   1       1    0      
   2      12    9                  
   3      28   18
   4     314   37
   5      98   25
   6     386  120
   7     943   36
   8    1494   47
   9    1680   42
  10    4722   59
  11    6576  137
  12   11696  143
  13    3982   51
  14    2987   48
  15   17548  141
  16   36208   41
  17    7083   57
  18   59692   73
  19  159116   77
  20   79592   76
  21   57857  166
  22  212160   80
  23  352258  104
  24  221185   93
  25   57346   78
  26  294913   96
  27  252548  181
  28  530052  102
  29  331778   91
  30  524289  102
  31 1088129 209
  32  913319  201
  33 2065786 197
  34 1541308 194
  35 1032875 196
  36 1264924 129
  37 0       0
  38 3705089 115
  39 2754368 200
  40  596310   97
  41 2886352 213
  42 4896680 206
  43 3350448 115
  44 3848468 216
  45 0       0
  46 0       0
  47 3247146 208
  48 0       0
  49 4330040 211
  50 0       0
  51 0       0
  52 3264428 208
  53 6528906 209
  54 4585418 224

           (test done from $n=2$ to $n=8 000 099$)              

For instance, $ \# \operatorname{cecl}=2$ means at $n=12$ and $n=13$ occur the same collatz-trajectory-length:

       n -> -> -> -> -> -> -> -> ->
       12  6  3 10  5 16  8  4  2  1  : 9 steps to arrive at 1
       13 40 20 10  5 16  8  4  2  1  : 9 steps to arrive at 1            
     -----------------------------------------------------------
     2 consecutive trajectories have the same trajectory-length      

Example-Pari/GP-code (can be optimized):

{CollLen(n)=local(S=0,N=0,s,maxiterations=100000);
   for(k=1,maxiterations,
           if(n<2,break());
           if(n % 2 ==1,  n = 3*n + 1; N++ );
           s = valuation(n,2); 
           n = n \ 2^s;
           S = S+s
        );
    return(N+S);}


{cecl_doc(a=1,e=99999)=local(  
    n , n_old , n_doc,   \\ number n on which collatz-iteration is done
    cl, cl_old,          \\ collatz-trajectory-length, current and previous
    cecl,cecl_max,       \\ count of "consecutive-equal-collatz-length"es
    v_cecl               \\ vector to hold first occurences of each "cecl"
   ); 
  v_cecl =vectorv(1000); \\ guess that at most cecl=1000 occurs
  cecl_max=1;
  n_old=a; 
  cl_old = CollLen(n_old); 
  for(n = a+1, e,
         cl = CollLen(n); 
         if(cl == cl_old, next());
                  cl_old = cl;
            n_doc = n_old;
            cecl  = n - n_old ; \\ (number of ) "consecutive equal collatz lengthes"
                        n_old = n;
            if(v_cecl[cecl]<>0,next()); \\ if that cecl was already documented, next
            v_cecl[cecl] = n_doc;  
            cecl_max = max(cecl_max,cecl);
      );
   v_cecl=vectorv(cecl_max,r,[r,n=v_cecl[r],CollLen(n)]);
   return(Mat(v_cecl));}

\\ example computation
cecl_doc(1,999999)

Here is a table, from which one can get an idea, how to determine $analytically$ high run-lengthes ("cecl"). They seem to appear periodically with distances of powers of $2$ but most of them with magic first occurences. Perhaps someone more involved detects the complete system for this.
I simply documented the $n$ where two consecutive equal lenghtes occur, so we find such $n$ where $\operatorname{CollLen}(n)==\operatorname{CollLen}(n+1)$ . In the table we have $ [ n, \text{CollLen} ]$ where $n$ is the number tested, and $\text{CollLen}$ the trajectory length for iterating $n$.
In some cases I inserted the periodlength over the rows of the table as power-of-2 instead : $[ n +2^l \cdot k ] $ which was tested to be true up to $n=200000$ or the like. Of course, connections of two or more consecutive entries represent accordingly higher "cecl"s, so after decoding the periodicity in this table we shall be able to prognose the occurence of such higher "cecl"s.
enter image description here

For the most simple example, the numbers $n \equiv 4 \pmod 8$ we can have the formula with some $n_0$ and the consecutive $m_0=n+1$ which fall down on the same numbers $n_2 = m_2$ after a simple transformation either (use $n_0=12$ and $m_0=13$ first): $$ \begin{eqnarray} & n_1&=n_0/2^2 &\to n_2 &= 3 n_1 + 1 &\qquad \qquad \text { because $n_0$ is even}\\ & m_1&= 3 (n_0+1)+1 &\to m_2&= m_1 / 2^2 &\qquad \qquad \text { because $m_0$ is odd}\\ \text{and} &n_2 &= m_2 &&&\qquad \qquad \text{is wished} \end{eqnarray}$$

The first row set requirements on the structure of $n_0$: if it shall be divisible by $4$ but not by $8$ (so only two division-steps occur) it must have the form $n_0=8a_0+4$
Then we have $$ \begin{eqnarray} 3\left({8a_0+4 \over 2^2 }\right)+1 &= 3(2a_0+1)+1 &= 6a_0+4 \\ {3(8a_0+4+1)+1 \over 2^2 } &= {24a_0+16 \over 2^2 } &= 6a_0+4 \\ \end{eqnarray}$$ which result in the same number.

I think, the other types of numbers n, which lead to $cecl=2$ solutions can be obtained analoguously by analytical formulae for other trajectory-lengthes. $cecl \ge 3$ occur then when two or more $cecl=2$ solutions are consecutive based on the modular requirements which have (yet) to be described.

$\endgroup$
2
  • $\begingroup$ Wow, good code. Did you see my other collatz question? $\endgroup$ Apr 25, 2015 at 12:03
  • 1
    $\begingroup$ @Pure : yes I've seen that. But I've only temporarily time, due to familiar duties... $\endgroup$ Apr 25, 2015 at 20:51
5
$\begingroup$

I would like to build upon @DmitryKamenetsky 's answer. The numbers of the form $2^n+k$ Where $n$ is sufficiently large quickly converges into a much smaller set of numbers. Dmitry's example in particular where $n$ is $1812$ and $k$ is in the range $1$ to $67108863$ converges to $117$ numbers in less than $800$ steps.

Dmitry's numbers are best analyzed in binary. All of them take the form $1000...000k$ where $k$ is in binary form just appended at the end of the $1$ with a large number of zeros. There are three operations in collatz conjecture ($+1$,$*3$,$/2$). The $+1$ and $/2$ only change the right most portion of the number, so only the $*3$ operator changes the left leading $1$ in the number. The left portion (the $1$) and the right portion (the $k$) of the number are separated by so many zeros that there is no carry over from one section to another until much later. So basically the sections act independently for some time. Where the left leading $1$ gets multiplied by three at each odd step and the $k$ follows the normal collatz rules.

The sequence http://oeis.org/A006877 are the record holders for the number that takes the most amount of time to reach $1$. $63728127$ is the largest number in the sequence that is less than $67108863$. It takes $949$ steps to reach $1$. There are no other numbers up to and including $67108863$ that take the same number of steps as $63728127$.

The point at which the two sections fully converge is when the full number (Dmitry's number) takes $n$ even steps. $1812$ is greater than $949$, so at some point all of the numbers will turn into the binary form $3^a000...0001$ where $3^a$ (in binary) is appended to the front of a set of zeros followed by a one and $a$ is the number of odd steps needed to get to that number. When this happens the number follows a three step cycle that removes two zeros from the middle block of zeros and add one to the exponent of the power of three. $3^a000...0001$ is an odd number so an odd step is applied to get $3^{a+1}000...100$ then an even step to get $3^{a+1}000...10$ then a second even step to complete the cycle $3^{a+1}000...1$. This cycle is repeated until one of two outcomes happens. The first outcome is $2*3^{b-1}+1$ and $4*3^{b-1}+1$ (if these expressions were in binary form this would be $3^{b-1}$ appended in front of a $1$ or a $01$.) In both cases they are odd so an odd step is applied to get $2*3^{b}+4$ and $4*3^{b}+4$. Then one even step is applied to the first case and two even steps are applied to the second case to get $3^{b}+2$ and $3^{b}+1$. These two last expressions are when the left and right portions have completely combined.

Just as $k$ represents a set of numbers, $b$ also represents a set of numbers. How long it takes to go from $2^{1812}+k$ to $3^b+1$ or $3^b+2$ is $1812$ plus the number of odd steps ($b$). The number of odd steps is dependent on $k$. Using a computer program I found all $k$ except one falls into the range $894-951$. (the record holder I mentioned earlier) $63728127$ uses $967$ odd steps to get to one of the two final forms.

There are $58$ numbers in the range $894-951$ which each have two forms and the record holder has one. So the total number of unique numbers at this point is $58*2+1=117$. Now an important thing to note is that the two forms using the same $b$ require the same number of steps. If $b$ is odd then $3^b\mod 8\equiv 3$. If $b$ is even then $3^b\mod 8\equiv 1$. With this knowledge in hand The $117$ unique numbers can be reduced even further. If $b$ is odd then the form $3^b+1\mod 8\equiv 4$. This means it is divisable by $4$ but not $8$. So if two even steps then an odd step is applied we get $\frac{3^{b+1}+7}{4}$. This means that $3^{b+1}+7$ is divisible by $4$. If we apply an odd step then two even steps to the second form ($3^b+2$, when $b$ is odd) we also get $\frac{3^{b+1}+7}{4}$. This means that $29$ of the $117$ later converges to one of the other numbers this leaves $88$ remaining.

I think that this information will make it much easier to figure out if Dmitry's strategy can be generalized or not. One last thing to note is that when doing an analysis on the set of numbers with two forms with different values for $b$; how quickly these numbers turn into one of the two forms ($3^b+1$ and $3^b+2$) is dependent on $b$. So the first set of numbers that turns into one of the two forms is when $b=894$. One step after that the set of numbers that turns into one of the two forms is when $b=895$. Then one step after that the set of numbers that turns into one of the two forms is when $b=896$. etc.

$\endgroup$
2
  • $\begingroup$ This is excellent analysis! Thank you. $\endgroup$ Feb 5, 2021 at 4:36
  • 1
    $\begingroup$ @DmitryKamenetsky you're welcome. I hope that this can help to establish whether or not your method can be generalized. I do want to know if there exist a longer sequence of consecutive numbers that have the same number of steps $\endgroup$
    – quantus14
    Feb 7, 2021 at 18:38
0
$\begingroup$

Let $i$ be the number of odd steps and $k=\sum k_i$ the number of even steps (e.g. for $n_0=98$ have $7$ odd steps and $18$ even steps for a total of $25$)

$n_1 = \frac{3^1}{2^{k_1}}\cdot n_0 + \frac{3^0}{2^{k_1}}$

$n_2 = \frac{3^1}{2^{k_2}}\cdot n_1 + \frac{3^0}{2^{k_2}} = \frac{3^2}{2^{k_1+k_2}}\cdot n_0+(\frac{3^1}{2^{k_1+k_2}}+\frac{3^0\cdot 2^{k_1}}{2^{k_1+k_2}})$

$n_i = \frac{3^i}{2^{k_1+k_2+...+k_i}}\cdot n_0+(\frac{3^{i-1}}{2^{k_1+k_2+...+k_i}}+\frac{3^{i-2}\cdot2^{k_1}}{2^{k_1+k_2+...+k_i}}+...+\frac{3^0\cdot 2^{k_1+...+k_{i-1}}}{2^{k_1+k_2+...+k_i}})$

With $n_i=1$, you can write this as $$\frac{3^i}{2^k}\cdot n_0+(\frac{\delta}{2^k})=1$$

Now with $k=\lceil log_2(3^in_0)\rceil$ you can see that $$\frac{2^{k-1}}{3^i}<n_0<\frac{2^k}{3^i}$$

e.g. for $7$ odd steps and $18$ even steps, you have $59.93...<n_0<119.86...$

(Now the range is narrower since $\delta$ has an min and a max value)

In this range you'll find $98,99,100,101,102$

Why are they 1 apart from each other? Well, obviously from the equation above, it comes from the fact that: $\delta_{101}=\delta_{102}+3^7$, $\delta_{100}=\delta_{101}+3^7$,...,$\delta_{98}=\delta_{99}+3^7$

e.g

$\delta_{98}=3^6\cdot2^1+3^5\cdot2^3+...$ (Parity vector: 0100100001010100100010000)

$\delta_{99}=3^6+3^5\cdot2^1+...$ (Parity vector: 1010000001010100100010000)

(which make a difference of $3^7$ on the first few bits)

The number of consecutive $n$'s mostly depend on the bit length (k+i) which allow for more bit combinations which are $3^i$ apart.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .