Does this function hit every odd number for some integers $n$ and $m$?

I have recently been looking into a problem and created a function that looked interesting and I wondered if it would hit all odd numbers on a graph.

For integer $$n$$, define $$g_n(x) = \frac13\cdot \begin{cases} (3n-1) \cdot 2^{2x-1} - 1, & n \text{ even} \\[4pt] (3n-2) \cdot 2^{2x\phantom{-1}} - 1, & n \text{ odd} \end{cases} \tag{\star}$$

Is it true that, for any positive odd integer $$k$$, there are integers $$n$$ and $$m$$ such that $$g_n(m)=k$$?

PS: I think is easier to see as a graph: desmos graph

Note: The form of $$(\star)$$ is dramatically different than what appeared in the original version of this question. See answer by @Blue for the derivation, which matches coincident work by @automaticallyGenerated.

• Your table is missing $3$ and $15$ – Naji Jul 23 '19 at 21:15
• Also, for $\mathbb{Z}$ just use \mathbb{Z} – Naji Jul 23 '19 at 21:15
• @Naji no, f(x) misses all multiples of 3, but I'm not talking about my table. and thank you for the symbol – spydragon Jul 23 '19 at 21:16
• @spydragon: I'll write $n$ for your $x_i$, and call your function $g_n(x)$. As a continuous exponential function, the graph of each $g_n(x)$ will hit every number (even, odd, transcendental, whatever) above its horizontal asymptote somewhere. Are you asking whether the $g_n(x)$ graphs will hit odd numbers at integer $x$ values? If so, then your question might be better stated thusly: For each odd integer $k$, are there integers $n$ and $m$ such that $g_n(m) = k$? – Blue Jul 23 '19 at 21:43
• @RoddyMacPhee Usually if unspecified, it's radians; they are standard in higher math. – Sambo Jul 23 '19 at 22:36

It can be seen that $$f_n = 3n+\frac{cos(\pi n)-3}{2}$$. $$\frac{cos(\pi n)-3}{2}$$ will be equal to $$-2$$ if $$n$$ is odd and $$-1$$ if $$n$$ is even. Thus, $$f_n = 3n-( n\pmod 2)-1$$.

From that, we get $$g_n(x) = \frac{(3n-( n\pmod 2)-1)*2^{2x+1-(((3n-( n\pmod 2)-1) \space \text{mod} \space 3))}-1}{3}$$

Simplifying this finds $$g_n(x) = \frac{(3n-( n\pmod 2)-1)*2^{2x+1-(((-( n\pmod 2)-1) \space \text{mod} \space 3))}-1}{3}$$

Simplifying this further finds $$g_n(x) = \frac{(3n-( n\pmod 2)-1)*2^{2x+n\pmod 2 -1}-1}{3}$$

Let's say that $$n = 2k$$, with $$k$$ an integer. Then, $$g_n(x) = \frac{(6k-1)*2^{2x-1}-1}{3}$$

If we fix $$x = 1$$, we get all values $$y$$, such that $$y = 3 \pmod 4$$

Similarly, if we fix $$x = 2$$, we get all values $$y$$, such that $$y = 13 \pmod {16}$$.

If we fix $$x = 3$$, all values such that $$y = 53 \pmod {64}$$. In general, if we fix $$x$$ as a positive integer, we get all values such that $$y = \frac{5*4^{x}-2}{6} \pmod {4^x}$$

So far, we have proved that the odd integers of the form $$y =$$: $$3 \pmod {4}$$ $$13 \pmod {16}$$ $$53 \pmod{64}$$ etc exist.

Covering the other case, where $$n = 2k+1$$, we get $$g_n(x) = \frac{(6k+1)*2^{2x}-1}{3}$$ If we similarly fix $$x$$ as a positive integer, we get values $$y$$ such that $$y = \frac{4^x-1}{3} \pmod {2^{2x+1}}$$

This yields $$y$$ such that $$y =$$: $$1 \pmod {8}$$ $$5 \pmod {32}$$ $$21 \pmod {128}$$

etc exist.

Both of these sets cover all positive odd integers. The reason for this is that $$3 \pmod 4$$ covers all odd values except for $$y = 1 \pmod 4$$. $$1 \pmod 8$$ then covers all values that are not already covered except for $$y = 5 \pmod 8$$. Then $$13 \pmod {16}$$ covers everything except for $$5 \pmod {16}$$. This process can be extended ad infinitum until all odd positive integers are "covered".

Therefore, this function does cover all positive odd integers when $$n, m$$ are integers.

• this looks right, and if it is you might have solved the Collatz conjecture – spydragon Jul 24 '19 at 0:11
• I don't know about that, but how is this connected to the Collatz conjecture? – automaticallyGenerated Jul 24 '19 at 0:52
• connecting one to all other numbers is the main strategy, but since every even number is guaranteed to become odd, you can ignore them all that's left is connecting all the odd numbers in a certain way which I encoded into my equations and you connected them all together – spydragon Jul 24 '19 at 0:57
• $6n-3=3(2n-1)$ think rhis how m moves during a $3m+\over 2$step of Collatz I might be wrong. – Roddy MacPhee Jul 24 '19 at 13:38
• there is an error, in your last equation $y = \frac{4^x-1}{3} \pmod {2^{x+1}}$ shouldn't it be $y = \frac{4^x-1}{3} \pmod {2^{2x+1}}$? – spydragon Jul 26 '19 at 6:06

Too long for a comment.

We can re-write a bit:

\begin{align} f_n &= \tfrac12 (6n-3+\cos(\pi n)) \\ &= \tfrac12 (6n-3+(-1)^n) & \text{(since n is an integer)}\\ &= \tfrac12 (6n -4 + 1 +(-1)^n) \\ &= 3n-2+\color{red}{\tfrac12\left(1+(-1)^n\right)} \\ &= 3n-2+ \color{red}{\left( 1 - (n \bmod 2) \right)} & \text{(getting clever)} \\ &= 3n-3+ 2 - (n \bmod 2) \\ &= 3(n-1)+ 2 - (n \bmod 2) \\ \end{align} The last steps are to prepare for this: $$f_n \bmod 3 = 2 - (n\bmod 2)$$ Now, the $$g_n$$ function becomes:

$$g_n(x) = \tfrac13 \left(f_n \cdot 2^{2x-1+ (n\bmod 2)} - 1 \right)$$

At this point, having to refer back to $$f_n$$ is a bother, but inserting the expression for $$f_n$$ is cumbersome. Since there's only even/odd-ness to consider, the best option might be just to write-out the cases explicitly:

$$g_n(x) = \frac13\cdot \begin{cases} (3n-1) \cdot 2^{2x-1} - 1, & n \text{ even} \\[4pt] (3n-2) \cdot 2^{2x\phantom{-1}} - 1, & n \text{ odd} \end{cases}$$

This makes the $$g_n$$ function completely self-contained and easier to analyze.

• you should put it in your rephrasing of my post, then delete this because its not a real answer, good job on simplifying it. – spydragon Jul 23 '19 at 23:33
• @spydragon: I want to let this sit a while, and then come back to it fresh and double/triple check that I didn't mess up a sign or something. (You could/should verify yourself that it's equivalent to your version.) If/when we're reasonably convinced it's okay, I'll paste my final $g_n(x)$ into your post. In any case, I'll leave this answer available for additional public scrutiny. ("Too long for a comment"-type (non-)answers are acceptable, by the way.) – Blue Jul 23 '19 at 23:58
• oh ok, I'll check it looks right though – spydragon Jul 24 '19 at 0:00
• @spydragon: I like to think so. :) That said, since it would be replacing your formulation, it's extra-important to ensure that I haven't changed the nature of your problem. – Blue Jul 24 '19 at 0:01
• well you encoded the if odd then the exponent must be odd rule (same with even) the only thing I think I actually have to check is the first part $(3n-1)$ or $(3n-2)$ though, as I said. it looks right – spydragon Jul 24 '19 at 0:07