In this question it was asked whether there exist integer solutions to the equation
$$|2^m-3^n|=35,$$
and I responded by saying that, modulo $85$, there do not exist any integer solutions to
$$2^m - 3^n \equiv \pm 35,$$
so there are no solutions to the equation itself. I'd originally seen a problem on a contest asking contestants to find the smallest prime that is not a value of $$|2^m-3^n|,$$
and it was solved by finding values for the primes $2,3,5,7,11,13,17,19,23,29,31,$ and $37$, and proving (via mod-bashing) that there does not exist a solution at $41$.
My question is: For every integer $k$, does there either exist integers $m,n$ such that
$$|2^m-3^n|=k,$$
or an integer $M$ such that
$$2^m-3^n \equiv \pm k \bmod M,$$
and if so, is there a simple way to find $M$ (assuming there don't exist $m,n$)?
I've attached a table that shows, for each $k\leq 100$, whether there exists a solution, and if not, what the smallest modulus that can be used is, in case it's useful to anyone. The sequence doesn't seem to exist on OEIS.
1 is a value of |2^m-3^n| . 2 is a value of |2^m-3^n| . 3 is a value of |2^m-3^n| . 4 is solved by the modulus 8. 5 is a value of |2^m-3^n| .
6 is solved by the modulus 12. 7 is a value of |2^m-3^n| . 8 is a value of |2^m-3^n| . 9 is solved by the modulus 15. 10 is solved by the modulus 20.
11 is a value of |2^m-3^n| . 12 is solved by the modulus 8. 13 is a value of |2^m-3^n| . 14 is solved by the modulus 18. 15 is a value of |2^m-3^n| .
16 is solved by the modulus 20. 17 is a value of |2^m-3^n| . 18 is solved by the modulus 12. 19 is a value of |2^m-3^n| . 20 is solved by the modulus 8.
21 is solved by the modulus 15. 22 is solved by the modulus 18. 23 is a value of |2^m-3^n| . 24 is solved by the modulus 15. 25 is a value of |2^m-3^n| .
26 is a value of |2^m-3^n| . 27 is solved by the modulus 33. 28 is solved by the modulus 8. 29 is a value of |2^m-3^n| . 30 is solved by the modulus 12.
31 is a value of |2^m-3^n| . 32 is solved by the modulus 18. 33 is solved by the modulus 21. 34 is solved by the modulus 22. 35 is solved by the modulus 85.
36 is solved by the modulus 8. 37 is a value of |2^m-3^n| . 38 is solved by the modulus 22. 39 is solved by the modulus 15. 40 is solved by the modulus 18.
41 is solved by the modulus 91. 42 is solved by the modulus 12. 43 is solved by the modulus 195. 44 is solved by the modulus 8. 45 is solved by the modulus 33.
46 is solved by the modulus 26. 47 is a value of |2^m-3^n| . 48 is solved by the modulus 18. 49 is a value of |2^m-3^n| . 50 is solved by the modulus 18.
51 is solved by the modulus 15. 52 is solved by the modulus 8. 53 is solved by the modulus 80. 54 is solved by the modulus 12. 55 is a value of |2^m-3^n| .
56 is solved by the modulus 20. 57 is solved by the modulus 48. 58 is solved by the modulus 18. 59 is solved by the modulus 240. 60 is solved by the modulus 8.
61 is a value of |2^m-3^n| . 62 is solved by the modulus 24. 63 is a value of |2^m-3^n| . 64 is solved by the modulus 20. 65 is a value of |2^m-3^n| .
66 is solved by the modulus 12. 67 is solved by the modulus 120. 68 is solved by the modulus 8. 69 is solved by the modulus 15. 70 is solved by the modulus 20.
71 is solved by the modulus 80. 72 is solved by the modulus 21. 73 is a value of |2^m-3^n| . 74 is solved by the modulus 26. 75 is solved by the modulus 21.
76 is solved by the modulus 8. 77 is a value of |2^m-3^n| . 78 is solved by the modulus 12. 79 is a value of |2^m-3^n| . 80 is a value of |2^m-3^n| .
81 is solved by the modulus 15. 82 is solved by the modulus 22. 83 is solved by the modulus 117. 84 is solved by the modulus 8. 85 is solved by the modulus 91.
86 is solved by the modulus 18. 87 is solved by the modulus 33. 88 is solved by the modulus 26. 89 is solved by the modulus 80. 90 is solved by the modulus 12.
91 is solved by the modulus 195. 92 is solved by the modulus 8. 93 is solved by the modulus 21. 94 is solved by the modulus 18. 95 is solved by the modulus 85.
96 is solved by the modulus 15. 97 is solved by the modulus 91. 98 is solved by the modulus 22. 99 is solved by the modulus 15. 100 is solved by the modulus 8.
This is now a partial answer - see last update at end
Third: did you observe in your table the arithmetic progressions for the cases $k$ which can be solved by a modulus $M$? for instance $k=4+8j$ are all deniably looking by modulus $M=8$ , $k=6+12j$ by modulus $M=12$, $k=9+j*15$ by modulus $M=15$ and as well seemingly $k=21+j*30$ by $M=15$. In the progressions of the $k$ on the same $M$ we find holes in your table. They might be explainable because they occur with smaller $M$ - it would be nice to see, whether that progressions $k=a_m+M$ with some first element $a_M$ are all deniable by that modulus $M$ - then your table needs only display the relations between $a_M$ and $M$ where we sometimes have multiple $a_{M,t}$ for the same $M$ I sorted your table this way:
Would your procedure, when updated, fill the obvious holes? Can we then have a compacted table?
4): A list of $k$'s which are disprovable by $M$'s (partly trivial, for instance for differences $k$ divisible by $2$ or $3$):
We see, especially at $M=91$ a lot of trivial entries. Here is a list which omits the trivial entries (except the $0$ for reminding of not-explained cases $k$)
A combined list of all nontrivial $k$ which could be denied by $M \equiv \pm1 \pmod 6)$ below $999$:
Here is a list for $k$ and the $M<500$ which detect that $k$ cannot be obtained by $|2^m-3^n|=k$ by missing residuals $\pmod M$. Note that $k\not \equiv \pm1 \pmod6$ are trivially no possible differences!
A longer list shows, that $M=511$ is a somehow optimal modulus to disproof small nontrivial differences. Up to k=109 : if any $M$ disproofs that difference, then $M=511$ disproofs this difference as well. The next powerful detector seems to be $M=341$.