The 3x+1 Problem [video]
youtube.com
youtube.com
To run a FRACTRAN program, you lookup its catalogue number, and repeatedly evaluate a certain simple function on it (which has the same spirit as the 3x + 1 one in the video).
As in 3x+1, all operations are integer operations.
FRACTRAN is Turing-complete, of course, so you can rewrite any program in FRACTRAN, and the paper provides quite a few examples!
Written as a sales pitch, this is both the most hilarious paper I've read in a long time - and one of the most mind-blowing ones.
It's pretty accessible (as far as math/CS papers go), too!
[1]http://www.cs.cmu.edu/~15455/resources/Conway87.pdf
PS: The real mind-blowing part is thinking about whether 3x+1 is, too, a programming language. We simply don't know, and possibly never will.
What does this mean? Isn't having a catalog essentially precomputing a function for every possible input?
A 3x + 1 program is a positive integer N. "Running" this program would be iterating 3x + 1 until it gets stuck in a loop (this would be the "halting condition"). The "output" would be a fixed function of the numbers in the loop (e.g. the loop itself; like 4, 2, 1).
As far as we know, all "programs" in 3x + 1 output 4, 2, 1. This makes for a very boring language (essentially, one you can only make "Hello World!" in). But we don't have a proof that that's all there is to it.
>Isn't having a catalog essentially precomputing a function for every possible input?
Specifically, that means that given a Turing machine T and input X, we can compute a number N = N(T, X) such that the "output" of running our "language" on N is the same as the output of T on X.
Which is what they do in FRACTRAN: they show how to encode an arbitrary program and its input as a number N, and how to read the output from the iteration.
What I don't understand is the encoding part. Is the encoding not essentially the same as execution? In other words the encoding function needs to be turning complete?
T(X) = N(E(T, X))
You don't know what the output is unless you execute it on the FRACTRAN machine; the thing that gets you the output is execution.
Note that execution is not a function that gives a finite output, as some programs never halt, or never return an output at all.
So while you can always encode, you don't always get an output from that encoding (like in cases where the Turing machine never halts).
TL;DR: encoding is a function (finite #of bits -> finite #of bits). Execution is a function (finite #of bits -> ???), where ??? can be a finite or infinite sequence, or an empty set, and there is no way to tell which it is other than executing, which may take infinite time (see: Halting problem).
As others pointed out, though, if it always gets stuck in a 4-2-1 loop, that would mean that every "program" terminates, which would imply that the language isn't Turing-complete.
I suspect 3x+1 is not Turing complete.
Though honestly, I really wouldn't bet on ever getting anything other than the 4 - 2 - 1 loop out of it in the end.
Whole night I was thinking and dreaming about this darned thing, even though I knew it was pretty pointless to do so, considering I'm not even a mathematician and have always found maths hard.
Still a brilliant video and now I get why people could spend 20+ years of their precious lives trying to solve these things.
For instance: arrange all integers with negatives between positives, as such: 1, -1, 2, -2, 3, -3, 4, -4, etc. Now choose any integer, positive or negative, and follow it to the next integer. For example, if you choose 3, go forward 3 spaces on the list, landing on -4. This is negative, so we go back 4 spaces, landing on -2, which leads to -1. Conjecture: All integers eventually lead back to the 1, -1 loop at the beginning. This can be shown to be a variation of the Collatz; that is, if Collatz is true, this must be true and vice versa.
I also attempted to prove Collatz by focusing on the odds only, that's where the real action is... Failed of course as it's not quite rigorous enough to disprove potential looping (it does at least prove that it cannot diverge to infinity), but may be of interest to someone else obsessed with the problem: https://youtu.be/P0F4zbNdbTU
What makes you think this? You just had area experts tell you otherwise. Do you think that mathematicians are lying to you?
*for flat planes. there was this thing about parallel lines he got wrong
So soheil's question doesn't seem ignorant of meaningless to me. One could probably reframe it to become something similar to philosophy of Gödel's theorems, in lines of "there may (or may not) exist an infinite number of problems in number theories that are very simply formulated but are impossible/hard to prove or disprove". Consequence of that being that our abilities to have a definitive proof of statements are negligible and we're thus fundamentally trapped in an infinitely small space of outer mathematical universe.
I'm sorry if I'm saying something stupid here (or on the contrary, some well-known fact), like I said, I know nothing about mathematics so the two are equally possible to me.
[1] https://en.wikipedia.org/wiki/Eugene_Wigner [2] https://en.wikipedia.org/wiki/The_Unreasonable_Effectiveness...
I didn’t think that a bit of coding was going to outpace hundreds of years of genius mathematicians - but a few minutes coding was a cheap price to pay to satisfy that ceaseless curiosity
Overall, there might be a connection to complex systems and ontogenesis. Maybe our struggling with this is all down to some original sin in our perception. Some false axiom we all carry. Pathogenic, hereditary logic, which prevents us from seeing beyond the chaos. 3x+1 seems to capture the pleasing ordered imperfection of real living things, not artificial "organic" structures made by humans.
$count = 1
do {
$count++
$i = $count
[string]$array = "$i"
$range = $i - 1
do {
if ($i % 2 -eq 0) {$i = $i / 2} else {$i = (3 \* $i) + 1}
$array = "$array" + ",$i"
if ($i - $count -gt $range) {$range = $i - $count}
if ($i -eq 2) {$i = "Break"}
} while ($i -ne "Break")
$array = "$array" + ",1"
$hits = (($array -split ",") | Measure-Object).count
Set-Content -Path "${count}_${hits}Hits_${range}MaxRange.txt" -Value "$array" -NoNewline -Force
} while ($count -lt 1000)
Does anyone know how to make this work with big numbers? At a certain point the value gets returned with something like 2.05891132094649E+44 at which point I can no longer simply add 1 to it.Edit: Found it... $count = [bigint][math]::pow(10,44) Awesome! I love code!
So my attempt to find a counterexample is to start at (2^68)+1, and perform the 3x+1 or halving until I get to a number that's lower than the one I'm testing - then I know it's not a counterexample.
Since even numbers start by halving (ie, getting lower), I only test odd numbers.
295147905503560000001 and counting. No counter-examples found yet.
using System.Numerics;
using System;
var myBigStartingNumber = BigInteger.Parse("12893123812148934789012378957891325789012357891238912319824589123589012358915891589158989125");
Collatz(myBigStartingNumber);
Console.WriteLine("Collatz returned 1");
static int Collatz(BigInteger x)
{
Console.WriteLine(x);
return x == 1 ? 1 : x % 2 == 0 ? Collatz(x / 2) : Collatz(3 * x + 1);
}
(stack overflows virtually guaranteed!)But something which is worth doing while playing with such programs, (besides writing it nonrecursively), is looking into alternative BigNum representations. Tree based number representations can make huge numbers expressible through few operations much smaller, at the cost of making "typical" numbers (those that can't be expressed by arithmetic expressions much shorter than themselves) only slightly larger.
Knuth made one such representation, called TCALC, which lets you do arithmetic on numbers far too large to fit into computer memory in regular byte string bignum representation. A US academic, Paul Tarau, has made similar huge-num libraries (slightly more elegant since representations are unique) for modern programming languages.
A/(B+C) + B/(A+C) + C/(A+B) = 4
It seems simple, like you could try a few examples and figure it out. And there is a solution. But for the smallest solution, A, B, and C each have 80 digits. Way too big to brute force.
Did this in Haskell, and since all the lower numbers are known, started searching at 2^361
To end the recursion I just have it print -1 when it reaches 1
f :: Integer -> Integer
f n
| n == 1 = -1
| even n = f (n `div` 2)
| odd n = f (3*n + 1)
main = print $ map f [2^361..]Why does this need to be solved?
Would that even change anything?
(great answer though, thanks, I'll use it later)
Now the important question is why human beings want to solve this, and what exactly do human beings want.
Obviously it "doesn't". Equally obviously this is mathematics, and it's worth doing if it's interesting.
But a somewhat more serious answer is this: the fact that we don't know the answer to this relatively simple question implies strongly that we don't know how numbers work. And if there are obvious gaps in our understanding of number theory that show themselves in trivial ways like this, there are probably more serious questions that we could answer if we had a better framework.
And that's sort of how hard problems in mathematics work. They aren't solved by amazing insight within their own realm, they turn out to be evidence that a new branch of theory needs to be developed first.
What hope do we have to make sense of our own universe if we can't solve this simple case.
In the video, Derek shows that you can see the problem as a turing machine. But if you view it as operation on strings in basis 6, you observe that the carry doesn't propagate which means that you can compute using a 1d cellular automaton (with local rules).
https://demonstrations.wolfram.com/CollatzProblemAsACellular...
This way of viewing the Collatz conjecture as a cellular automaton mean that the Collatz conjecture is like a simpler version of Conway's game of life. You can then use some memoization tricks like hashlife to compute it more efficiently.
In the game of life, some interesting patterns emerge, whereas in Collatz it is conjectured that they all end in the same pattern of desolation.
Are the Collatz cells doomed ? Is the Collatz automaton turing-complete ? Can life emerge in the Collatz universe ? Would this change anything for these small little cells ?
Would it change anything? Who knows—we have yet to solve it using our current mathematical knowledge, so who knows what new mathematical knowledge will be developed in order to solve it?
I wonder if that thinking has changed in the age of Computer Science since solving this kind of recursive/iterative problem might open up new ways to analyze algorithms or tackle the Halting Problem for some classes of programs.
In terms of sheer brain-breaking... this is my favourite: https://www.youtube.com/watch?v=ovJcsL7vyrk
But this is the one I think people on HN need to watch most https://www.youtube.com/watch?v=3LopI4YeC4I
And the YouTube algorithm was actually really useful and made discover this series of video on special relativity: https://youtube.com/playlist?list=PLoaVOjvkzQtyjhV55wZcdicAz...
It's only a model (a very accurate one though) so nothing is "really" a force. They are not material objects. But for gravity, something even more accurate was found to model it.
The 3x+1 Conjecture is false Text in English : https://arxiv.org/abs/2104.10681
This statement is not proven, and is not supported by the previous theorems. Thus the following statement "We therefore conclude that the 3x+ 1 conjecture is false" remains an unproven assertion.
Essentially the paper argues that the density F(k) of trajectories at least as long as 'k' gets ever smaller as k increases, without ever reaching zero, and thus there exists at least one value that has an infinity long trajectory.
But that's as false assertion. Just because F(k) is non-zero for every finite value of k does NOT imply that the lim as k tends to infinity of F(k) is non-zero, and consequently does not prove the existence of an infinity long trajectory.
TL;DR: paper applies intuition on finite sequences to infinite sequences and gets it wrong.
I wonder how many attempted proofs attempt to solve through this bottom up approach rather than top-down.
I started with powers of 2 that obviously reduce to the cycle and tried to apply these transitions inferring larger and larger sets of numbers whose binary representation satisfies specific regular expressions on 0 and 1s, but got lost pretty quickly.
My intuition is that, given that several generalizations of Collatz Conjecture are undecidable (equivalent to a halting problem), this process is in the territory of being not yet Turing-complete but already undecidable. But I am pretty sure many people way smarter than me tried this approach as well.
Derek has has actually made a video before about the YouTube algorithm and has polled the community several times about clickbait-ey titles. He doesn’t like them, but they’re unfortunately necessary.
It says there are things in math that are true but unprovable, and we can’t know if it’s unprovable.
Terence Tao has actually gotten a little traction on this in the last few years.
Solve
initial_value * (3/4)^x = 1 for x
to get the number of steps.
That'll give a logarithm. So yes it's O(logn) on average