13

Let $S$ be the smallest set of positive integers satisfying the following conditions:

  • $1 \in S$,
  • If $n \in S$ then $2n \in S$,
  • If $n \in S$ then the digit reversal of $n$ is also in $S$.

    We assume that any leading zeros are dropped after digit reversal. For example, the digit reversal of $12300$ is $321.$

    Is it true that $S$ contains all positive integers, except those divisible by $3$ or $11$?

    EDIT: I have verified the conjecture up to $n = 10\,000$.

    • Would help yo know the source of this puzzle, since it gives an idea of what techniques might be needed. – Thomas Andrews Dec 22 '15 at 23:03
    • It's an original conjecture, based on a question posed by Matt Enlow. https://twitter.com/CmonMattTHINK/status/615193724574797824 – Dave Radcliffe Dec 22 '15 at 23:39
    • There are similar questions around digit rearrangement, disallowing leading zeroes but allowing for arbitrary shuffling rather than just reversal; the big difference is that rearrangement can never reduce the number of digits in a number, so the question is a bit more unidirectional. – Steven Stadnicki Dec 22 '15 at 23:57
    • As an original question, it might help if you first demonstrated that you can get to all one-digit odd numbers, as a demonstration of the flexibility of this approach. In other words, give us some hint that this conjecture has any basis other than a WAG. – Thomas Andrews Dec 23 '15 at 00:05
    • Is $10001$ in $S$? If my program is right, any path from $1$ to $10001$ must contain some integers greater than $4 \times 10^8$, and $10001$ is the least positive integer not divisible by $3$ or $11$ that has this property. – Robert Israel Dec 24 '15 at 20:20
    • On the other hand, $11111$, which was mentioned in a deleted answer, is reached by the path 1, 2, 4, 8, 16, 61, 122, 244, 488, 976, 1952, 3904, 7808, 15616, 31232, 23213, 46426, 92852, 25829, 51658, 85615, 171230, 342460, 684920, 29486, 58972, 117944, 235888, 471776, 943552, 255349, 510698, 896015, 1792030, 3584060, 7168120, 14336240, 28672480, 57344960, 6944375, 13888750, 27777500, 55555000, 55555, 111110, 11111 – Robert Israel Dec 24 '15 at 21:07
    • @Robert: I found that any path from 1 to 10001 must contain some integer greater than $10^9$. Perhaps $10001$ is not in $S$. – Dave Radcliffe Dec 25 '15 at 01:47
    • There is a path from $1$ to $10001$ whose largest entry is $1203220310$. The path that I found is about $19100$ entries long; there may be a shorter one. – mjqxxxx Dec 26 '15 at 02:30
    • 2
      Correction: the path is only a few hundred entries long; I visited about $19100$ numbers in the search. I've verified the conjecture up to $n=10^6$. – mjqxxxx Dec 26 '15 at 02:50
    • It's amazing that this generates all primes below 1000000 except 3 and 11. @StevenStadnicki I feel that though digit rearrangement is a generalization, both seem equally tough.. As noted in the answers getting rid of 3 and 11 is easy, but proving others are in is difficult – tpb261 Dec 26 '15 at 15:35
    • All of the answers were excellent, but I think that mjqxxxx has made the most progress towards a solution. Thanks to everyone! – Dave Radcliffe Dec 26 '15 at 19:45

    3 Answers3

    5

    This is to show one can arrive at $5$ by several steps. I did this "backward" by continually starting with a goal number and allowing the moves: multiply by $5$, reversal, divide an even number by $2$ To explain the multiply by $5$ step, suppose the goal number was $17.$ Then $17 \cdot 5=85,$ and if we got to $85$ somehow, then $2 \cdot 85=170,$ reversed is $71,$ and reversed again is our goal number $17.$ So this is a kind of attempt at backtracking from some goal number.

    For the goal of $5$ I multiplied by $5$ to get $25,$ reversed to get $52,$ then divided by $2$ twice to get $13.$ Thus if $13$ can be obtained, so can $5.$

    From here on I'll just present the links, each step being doubling or reversal, without showing the backtracking method above outlined.

    From 13 to 5: $13,26,52,25,50,5.$

    From 7 to 13: $7,14,28,56,65,130,31,13.$

    From 19 to 7: $19,91,182,281,562,265,530,35,70,7$

    From 64 to 19: $$64,46,92,184,368,736,1472,2741,5482,2845,5690,965,\\ 1930,391,193,386,772,277,554,455,910,19.$$

    Then since powers of $2$ such as $64$ are obtained from $1$ by doubling, we can put the above together and get a (long) derivation of the goal number $5.$

    There is a lot of choice to be made while "backtracking" but a subgoal is to backtrack to a reasonably small number, and hope that from there more backtracking will eventually lead to something known to be attainable already (such as a power of 2). As in the above example for obtaining 5, the numbers arrived at in between may become large, and still later small again. Not a sure-fire method, for example a failure to backtrack in one (or several) way(s)doesn't rule a number out.

    coffeemath
    • 29,884
    • 2
    • 31
    • 52
    3

    Let $A$ be the set of natural numbers not divisible by $3$ or $11$. Working backwards, we want to be able to derive $1$ from any $n\in A$, using a combination of the following two steps:

    • $n\rightarrow R(n)\cdot 10^k$, if $n$ is not a multiple of $10$, where $R(n)$ is the reversal of $n$, and $k$ is any non-negative integer;
    • $n\rightarrow n/2$, if $n$ is even.

    The second step is the inverse of the rule "if $n\in S$ then $2n\in S$" in the original problem, which only produces even numbers. The first step is the inverse of the rule "if $n\in S$ then the digit-reversal of $n$ is in $S$", with its condition that trailing zeroes in $n$ are dropped after the reversal... this rule only produces non-multiples of $10$, and when it is inverted, we can recover any number of trailing zeroes. Note that these steps preserve membership in $A$.

    By induction, we can get from any number $n\in A$ to $1$ iff we can get from any number $n \in A \setminus \{1\}$ to some smaller number $m<n$. When $n$ is even, the second step immediately yields a smaller number, so we don't need to check even starting values. That being the case, we'll never start with a multiple of $10$; so any time we encounter a multiple of $10$ in a derivation, it must be directly preceded by a first-rule application, followed by some number of second-rule applications; and we could have produced any number of additional trailing zeroes by increasing $k$ in that first-rule application. So $n\rightarrow 10n$ produces no new reachability relations if $n$ is a multiple of $10$. Since $n\rightarrow 10n$ can also be achieved when $n$ is not a multiple of $10$ (by applying the first rule twice), we can simplify the rules for derivations that start with an even number. In fact,

    The original conjecture is equivalent to the claim that any number $n\ge 5$ not divisible by $2$, $3$, or $11$, can be made smaller by some combination of these three steps:

    • $n\rightarrow R(n)$, if $n$ is not a multiple of $10$, where $R(n)$ is the reversal of $n$;
    • $n\rightarrow 10n$;
    • $n\rightarrow n/2$, if $n$ is even.

    A simple search algorithm is the following:

    1. Start with $\mathsf{curr=\{\}}$ and $\mathsf{nxt=\{n\}}$.
    2. Choose the smallest element of $\mathsf{nxt}$ (with probability $\alpha$), or the smallest element of $\mathsf{nxt}$ with the smallest number of zero digits (with probability $1-\alpha$). Remove that element from $\mathsf{nxt}$ and add it to $\mathsf{curr}$.
    3. Apply the three possible steps to this element. When a new value (not already in $\mathsf{curr}$ or $\mathsf{nxt}$) is generated, add it to $\mathsf{nxt}$. If the new value is less than $n$, we're done.
    4. Return to step 2.

    Using this heuristic, I've been able to verify the conjecture for all $n \le 10^8$. Generally choosing the smallest element of $\mathsf{nxt}$ is desirable (so $\alpha=0.9$ works well); but for specific values of $n$ such as $n=10^4+1$ and $n=10^6+1$, the alternate strategy is faster (so $\alpha=0.1$ works for these).

    mjqxxxx
    • 41,358
    • How do you justify your first two rules? And how is your $R(n)$ defined? What is your derivation for $5 \in S$? – mvw Dec 27 '15 at 22:47
    • E.g. to justify the second rule $n \to 10n$, you would need to give a derivation of $10n \to n$ in terms of the original rules which works for any $n$, e.g. $n= 100$ and $1000 \to 100$. – mvw Dec 27 '15 at 23:21
    • @mvw: You're right; I was too cavalier about handling the leading/trailing zeroes. See if the edit seems right. The derivation for $5\in S$ that I get is $1,2,4, 8, 16, 32, 23, 46, 92, 29, 58, 85, 170, 17, 34, 43, 86, 172, 271, 542, 245, 490, 49, 94, 188, 376, 752, 257, 514, 415, 830, 83, 38, 76, 152, 251, 502, 205, 410, 41, 14, 28, 56, 65, 130, 13, 26, 52, 25, 50, 5$. Note that this handles the trailing zeroes in a different but equivalent way (just dividing by $10$), as described in the answer. – mjqxxxx Dec 28 '15 at 13:05
    2

    Some thoughts:

    Divisibility by $3$:

    E.g. $n$ is divisible by $3$ if and only if its digit sum is divisible by 3, e.g. see here. $$ 3 \mid n \iff 3 \mid ds(n) $$

    Now $S$ contains numbers $2^k (k \in \mathbb{N}_0)$ which are not divisible by $3$ (see unique prime factorization). Thus their digit sum is not divisible by $3$. A number generated from reversal of its digit string (and removal of trailing zero digits) still has the same digit sum and thus is not divisible by $3$ either. $$ 3 \not\mid 2^k =: x \iff 3 \not\mid ds(x) = ds(y) \iff 3 \not\mid y \\ y = \text{rev}(x) = \text{integer}(\text{normalize}((x)_{10}^R)) \quad (*) $$ Multiplication by some non-trivial power of $2$ will just increase the exponent of $2$ in the unique prime factorization $n = 2^{e_2} 3^{e_3} 5^{e_5} \cdots$ and not increase the exponent of $3$, so it will not affect divisibility by $3$.

    So numbers divisible by $3$ are not members of $S$.

    Divisibility by $11$:

    Divisibility by $11$ of an integer $n$ seems to relate to the divisibility by $11$ of the alternating digit sum, which is also invariant to the generation via reversal etc, up to a sign, which does not matter for divisibility. A similar argument like for $3$ should apply.

    So the claim of no numbers divisible by $3$ and $11$ in $S$ seems valid and, as Robert Israel notes in the comments, the hard part left is to argue why every other positive integer might show up in $S$, or not.

    About the conjecture:

    My personal guess is that this conjecture is not true. The numbers in the gaps between the $2^k$, e.g. $5$ can only get introduced by that reversal process $(*)$. So it must originate from some digit string $s_5 = 5\,0^m$, possibly for a very large $m$. I somehow doubt that such a string shows up in the digit strings for $2^k$ and friends. (see coffeemath's example)

    Generating $S$:

    We can use a binary word $$ w \in \{ 0, 1 \}^n \quad (n \in \mathbb{N}) \\ w = d_1 \cdots d_n $$ to encode a generation of an element $s \in S$ by applying the rules $n$ times, each binary digit $d_i$ of $w$ encoding a function $f_i^{(w)}:\mathbb{N}\to\mathbb{N}$: $$ f_i^{(w)}(k) = \begin{cases} 2 k & \text{for } d_i = 0 \\ \text{rev}(k) & \text{for } d_i = 1 \end{cases} \\ $$ those functions are applied one after another, composing a resulting function $f^{(w)}$: $$ f^{(w)} = f_n^{(w)} \circ f_{n-1}^{(w)} \circ \cdots \circ f_2^{(w)} \circ f_1^{(w)} \\ 1 = \sigma(\epsilon) \\ s = \sigma(w) = f^{(w)}(1)uu $$

    Examples:

    $$ 58 = \sigma(0000001010) \\ 1 \overset{0}{\to} 2 \overset{0}{\to} 4 \overset{0}{\to} 8 \overset{0}{\to} 16 \overset{0}{\to} 32 \overset{0}{\to} 64 \overset{1}{\to} 46 \overset{0}{\to} 92 \overset{1}{\to} 29 \overset{0}{\to} 58 \\ 2 = \sigma(0) \\ 4 = \sigma(00) $$

    The binary words of length $n$ can be generated by counting from $0$ to $2^n-1$ and computing the base $2$ representation digit strings of length $n$ (with leading zero digits). Then $$ S = \bigcup_{n=0}^\infty S_n \\ S_0 = \{ \sigma(\epsilon) \} = \{ 1 \} \\ S_n = \{ \sigma(w) \mid w = (i)_2, i \in \{ 0, \ldots, 2^n-1\} \} \quad (n \ge 1) $$ Practical Considerations:

    The number of binary words of length $n$ is $2^n$, it grows exponentially with $n$, so sooner or later a computation will need too much time. On the machine I tried a Ruby script, it gets ugly around $n=24$.

    Optimization 1:

    One optimization is to note that of the various words $w$ which evaluate to a certain value $s$, $$ s = \sigma(w) $$ the one with minimal length and in the order of the word's value interpreted as integer value, that word just features $1$ or $11$ as sub sequence of $1$ digits, but no longer sequence. This is because $$ \text{rev}^2 \ne \text{id} $$ e.g. $\text{rev}^2(1200) = \text{rev}(21) = 12$ and $$ \text{rev}^{1+2k} = \text{rev} \quad (k\in \mathbb{N}) $$ so we can substitute $$ 1(11)^+ \to 1 $$ to shorten the binary words to ones with the same $s$ value, or ignore them, because we must have seen them before, if we go from shorter to longer words.

    Optimization 2:

    The $\text{rev}^2$ operation acts like a trunction of trailing zero digits (see above example for $1200$): $$ \text{rev}^2(u0^k) = \text{rev}(u^R) = u $$

    A Second Encoding:

    The above means we can compose the generation of a member $s\in S$ via three basic operations: $$ 0: 0 \leftrightarrow f(k) = 2 k \\ 1: 1 \leftrightarrow f(k) = \text{rev}(k) \\ 2: 11 \leftrightarrow f(x) = \text{rev}^2(k) $$ and use ternary numbers for encoding. This way we skip some generations which add no new member.

    mvw
    • 34,562
    • You also need to note that if $x$ is not divisible by $3$ then $2x$ is not divisible by $3$. And similarly for $11$, But the real challenge is the converse, that every positive integer not divisible by $3$ or $11$ is in $S$. – Robert Israel Dec 22 '15 at 23:24
    • I would argue the first bit with the unique prime factorization.For the the rest I have no good idea yet. In fact I fear it would need some probabilistic argument. – mvw Dec 22 '15 at 23:25
    • Oops, that was rearrangement, not reversal – Element118 Dec 23 '15 at 00:16