It is a formula to generate the sequence of all integers which are not divisible by 3? Additionally, it is a formula to generate the sequence of all integers that are not divisible by 3 nor by 2?
|
|
The non-multiples of $3$ are given by the formula $$a_n = \frac{3}{4} + \frac{3n}{2} + \frac{(-1)^n}{4},$$ where $n \in \mathbb{Z}.$ Similarly, the non-multiples of both $3$ and $2$ can be given by $$b_n = \frac{-3}{2} + 3n + \frac{(-1)^n}{2} = 2a_n - 3.$$ |
|||||||||
|
|
$f(n) = \lfloor \frac {3}{2} n - \frac {1}{2} \rfloor$ will generate all the non-multiples of 3 in order. |
|||
|
All positive integers not divisible by 3 are generated by 3k +1 and 3k +2 for k = 0,1,2,3,4,... All positive integers not divisible by 2 nor by 3 are generated by 6k +1 and 6k +5 for k = 0,1,2,3,4,... |
|||
|
|
The formula $a(n)$ := the $n$-th number not divisible by $3$ (with $a(0) = 1$) would often be useful. The two formulas $b(n) = 3n+1$ and $c(n) = 3n+2$ together enumerate them as two doubly-infinite sequences. The idea is to pick an equivalence class and iterate over it. The single formula $d(n) = \frac{3}{2}n + (-1)^n \frac{1}{2}$. The idea hre is that every two steps you need to increase by $3$, thus $\frac{3}{2}n$, then $(-1)^n$ to alternate between adding and subtracting something. (Depending on what we were enumerating, we might need to add in a constant as well) This formula enumerates all of them as a singly infinite sequence: $$ e(n) = d\left( \frac{1}{2} n - \left(1 - (-1)^n \right) \left( \frac{n}{2} + \frac{1}{4} \right) \right)$$ The first few terms are $e(0) = d(0)$, $e(1) = d(-1)$, $e(2) = d(1)$, $e(3) = d(-2)$, $e(4) = d(2)$, .... A recursive formula works: $f(0) = 1$, $f(1) = 2$, $f(n) = 3 + f(n-2)$. By cases, $$ g(n) = \begin{cases} 3\frac{n}{2}+1 & n \text{ even} \\ 3 \frac{n-1}{2} + 2 & n \text{ odd} \end{cases} $$ Similar tricks apply to the case of not being divisible by 2 or by 3. This might be more simply described as being $1$ or $-1$ modulo $6$. |
|||
|
|
