I have two quick questions.
Is there a way to quickly verify that a number is $3n+2$, i was thinking using modulus (if thats possible?), but based on the binary expansion I dont see to find a definite pattern at the moment.
The number should be part of the following sequence $\{2,5,8,11,14,17,20,...\}$. Ive sometimes seen that an even number is defined as $n=2k$ for $k\in\mathbb{Z^+}$.
Can i define a number that is $3n+2$ as $n=3k+2$ for $k\in\mathbb{Z^+}$?
And the other question was how to perform an operation based on that number (by verifying it first), for example if the number is $3k+2$ then add $1$, else subtract $1$, or something like this.
If that was not clear then, I want to do like Collatz function: if a number is odd then $3n+1$, else if a number is even $n/2$.
Example:
$$C(n) = \begin{cases} 3n + 1 &\quad \text{ if $n$ is odd} \\ n/2 &\quad \text{ if $n$ is even} \end{cases}$$
I would have to:
$$C(n) = \begin{cases} n + 1 &\quad \text{ if $n = 3n+2$} \\ n - 1 &\quad \text{ if $n \neq 3n+2$} \end{cases}$$
But I feel its not quite proper.