Longest known sequence of identical consecutive Collatz sequence lengths?
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.
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
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.
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.