From time to time this site sees questions such as this 274849 or 165906, involving multiplication by 3 and adding one, dividing by 2, that seem to be (somewhat coyly perhaps) about the Collatz problem.
Enough! Let us make no bones about it! I like using unsolved, possibly even unsolvable, problems as recreation, sometimes unproductively like a dog chasing its own tail, and sometimes productively as a way of exploring new programming capabilities, in this case MMA (11.0.1.0, Windows 10). (NB I consider my likelihood of solving this problem to be infinitesimal; this is what makes the work recreational rather than frustrational.)
Like my previous question, today's is also about Reduce and understanding its conclusions - when applied to a closed form for Collatz cycles.
Now, one can apply Trace to Reduce, but as it says in the documentation under Tracing Evaluation with incomparable understatement:
Trace[expr] gives a list that includes all the intermediate expressions involved in the evaluation of expr. Except in rather simple cases, however, the number of intermediate expressions generated in this way is typically very large, and the list returned by Trace is difficult to understand. [emphasis added]
The result of Reduce I am working with runs to hundreds of terms and has a Depth of 12. I would like to know more about strategies for dealing with such large output in order to find out what it means - and how MMA arrived at its conclusions.
Here's the problem: using the Syracuse formulation of the Collatz problem (in which up and down steps alternate, and instead of dividing by 2 we divide by the largest power of two that divides), the iteration after $P \ge 2$ steps is given by
ClearAll[collatz, Q, q];
Q[n_] := 2^Sum[Subscript[q, j], {j, 1, n}] ;
collatz[P_, n_] := (n (3^P ) + 3^(P - 1) + Sum[Q[i] 3^(P - i), {i, 2, (P - 1)}] + Q[P - 1])/Q[P]
where the $q_i$ are the individual divisors, and Q just accumulates them.
Evaluation of collatz[P,n]
gives
$2^{-\sum _{j=1}^P q_j} \left(\sum _{i=2}^{P-1} 3^{P-i} 2^{\sum _{j=1}^i q_j}+2^{\sum _{j=1}^{P-1} q_j}+n 3^P+3^{P-1}\right)$
(with some tidying and symbol reordering we can get a nicer form, but I won't dwell on the details and won't use it
$\frac{3^P n+3^{P-1}+\frac{2^Q}{q_P}+\sum _{i=2}^{P-1} 3^{P-i} 2^{\sum _{j=1}^i q_j}}{2^Q}$
it's just easier to read)
Let's now try to extract some information from the equation that defines a cycle or loop of the Collatz function, i.e. collatz[P,n] == n
Now, we know of the {1, 4, 2} cycle, but there are also cycles in the negative integers, such as these (in Syracuse form, with their P, Q values)
- {-1,-2, 1}, P = 1, Q = 1
- {-5, -14, -7, -20, -5},P = 2, Q = 2
- {-17, -50, -25, -74, -37, -110, -55, -164, -41, -122, -61, -182, -91, -272, -17), P = 7, Q = 11
Now, apply Reduce to collatz[P,n] == n
cReductions = Reduce[collatz[P, n] == n, n, Integers, GeneratedParameters -> Subscript[Const, #] &) ];
This produces moderately large output of the form (A && B && (C1 || ... || C162)) (Side issue relating to Q274998: why did MMA not use Alternatives & Elements here, as $(a | b) \in \mathbb{Z}$?)
Those first two terms, A, B are cReductions[[1 ;; 2]]
$3^{P-1}\in \mathbb{Z}\land 2^{-\sum _{j=1}^P q_j}\in \mathbb{Z}$
Hence the following questions, at last.
Question 1
The condition $2^{-\sum _{j=1}^P q_j}\in \mathbb{Z}$ is obviously wrong because we know of $Q = 2$ and $Q=11$ are possible for negative n (unless the sum of $q_i$ is negative, implying at least one must also be -ve, which doesn't make sense in context).
How can I work out why MMA arrives at this erroneous conclusion? Is there some way to fix it? I realise that my $q_i$ are not specified to be +ve anywhere, but it's not obvious to me how I could rectify that (or that the sum is positive).
Question 2
In 274998 I asked why MMA didn't eliminate things like this:
$2^{\sum _{j=1}^{P-1} q_j}=3 \text{Const}_1\land 2^{\sum _{j=1}^P q_j}=3 \text{Const}_2$
from the collection of OR'd terms (C) above. Now, I know that subscripted symbols are generally not recommended, but I hoped it wouldn't matter here. Was I wrong? How could I repose the equations or Reduce to facilitate this?
Question 3
Has anyone created any tools for overcoming the unreadability of Trace output?
Reduce[2^x*(k+2^y)==1,k,Integers]
where the output says that2^x
and2^y
are integers (in V12.3), yet this equation has the solution{k,x,y}=={1,-1,0}
where2^x
is not an integer. Before concluding that this is a bug, note that the documentation forReduce
says that the domain specificationIntegers
applies to all variables, parameters, constants and function values. Perhaps someone more knowledgeable will tell us how to interpret this. $\endgroup$