MakarovSuites
English
EnglishDeutschРусскийУкраїнськаFrançaisEspañolItalianoPolski
Contact & licences

Math

Collatz conjecture

Halve if even, triple and add one if odd: does every positive integer reach one? Explore a number's flight, stopping times up to 4096, and the different behaviour of 3n − 1 and 5n + 1. The general 3n + 1 claim remains a conjecture.

Collatz conjecture — Actual application image
Actual application image

What happens

One rule: halve the number if it is even, triple it and add one if it is odd, and repeat. Every start anyone has tried falls to one - 27 climbs to 9232 by step 77 and lands at step 111 - and nobody has proved that every start does. The flight scene draws one number's path step by step on a log scale, a glowing head climbing on the odd steps (orange) and falling on the halvings (gold), with its two neighbours as ghosts: 26 lands in ten steps, 28 in eighteen, 27 in a hundred and eleven. The landscape scene lays out the total stopping time of every number up to 4096 as a terrain of glowing bars: the record holders - each needing more steps than every smaller start - are lit red, the last of them 3711 with 237 steps; click a bar to read it. The mean is 75, the most common stopping time 43, and the fit against ln n runs at 11 with a negative intercept, above the asymptotic heuristic 2/ln(4/3) = 6.95: on average an odd step multiplies by 3/2 and is followed by a halving, so each pair costs a factor 3/4 - the drift is downward, which is the whole reason the conjecture is believed and none of the proof. The rules scene changes the constant: sixty flights each, coloured by their fate. 3n + 1 sends all thousand first starts home. 3n − 1 has two extra cycles, through 5 and through 17, and 651 of the first thousand end in one of them. 5n + 1 has drift 5/4 upward: 833 of the first thousand blow past 2^60, off the top of the chart, and 7 alone takes 719 steps to get there.

Equations used in the module
Equations
rule:  n → n/2 (n even),  n → 3n + 1 (n odd);  total stopping time = steps to reach 1;  27: 111 steps, peak 9232 at step 77, 41 odd steps and 70 halvings;  26: 10 steps, 28: 18, 97: 118 (peak 9232 again), 871: 178 (peak 190996)
drift:  an odd step gives 3n + 1 ≈ 3n/2 after the halving that must follow, so an odd-then-even pair costs a factor 3/4 on average, and a flight with k odd steps needs more than k·log₂3 = 1.585 k halvings to come down;  3^41 / 2^70 = 0.031 < 1/27, as it must to land on 1
landscape to 4096:  record holders (each needs more steps than every smaller start): 1, 2, 3, 6, 7, 9, 18, 25, 27, 54, 73, 97, 129, 171, 231, 313, 327, 649, 703, 871, 1161, 2223, 2463, 2919, 3711 (237 steps);  mean 75.13;  most common stopping time 43 (87 starts);  least squares: stopping time ≈ 11.12 ln n − 6.22 over 2 … 4096;  heuristic (asymptotic) slope 2/ln(4/3) = 6.95
3n − 1:  first thousand starts: 349 land on 1, 651 in a cycle - through 5 (5 → 14 → 7 → 20 → 10 → 5, 306 starts) or through 17 (18 members, 345 starts);  highest peak of a landing 132860
5n + 1:  drift 5/4 > 1;  first thousand starts: 81 land on 1, 86 in a cycle - through 13 (63) or 17 (23) - and 833 pass 2^60;  7 alone takes 719 steps to pass 2^60;  highest peak of a landing 1170496

Related experiments

Back to catalogue
Prime spirals — Actual application image

Math

Prime spirals

The numbers laid on a square spiral, the primes lit: diagonals appear that should not be there, four times the density of the square, and with 41 at the centre Euler's n² + n + 41 runs down one of them; the Sacks spiral, and π(N) against N/ln N as the spiral grows.

Sunflower — Actual application image

Math

Sunflower

Vogel's sunflower grown seed by seed, r = √n and θ = n·α: sweep the angle by dragging across the disc and the spirals unwind, collapse onto rays, and lock in at the golden angle 137.508°, where the closest pair is 1.602 at any size and the families are Fibonacci numbers - the packing measured live, a task on the angle, and the chart of packing against angle.