Tell me more ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question
1  
$a_n=3n+1$ ${}{}{}{}$ – Amr Jan 19 at 12:03
He probably means all integers not divisible by 3. – Git Gud Jan 19 at 12:05
2  
@Git Gud I think this is easy to do as well. I just want to know a precise definition of a formula – Amr Jan 19 at 12:07

4 Answers

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.$$

share|improve this answer
it works, and recurence formula is is a(n) = 3n - a(n-1) – user58874 Jan 19 at 12:39
Second part of my question is still open – user58874 Jan 19 at 12:40
a(n) = 3n - a(n-1) , a(0)=1 – user58874 Jan 19 at 12:52
@user58874 I don't see why - is there a problem with the sequence $(b_n)_n$? – Cocopuffs Jan 19 at 13:51

$f(n) = \lfloor \frac {3}{2} n - \frac {1}{2} \rfloor$ will generate all the non-multiples of 3 in order.

share|improve this answer
sorry but is not correct – user58874 Jan 19 at 12:43
@user58874: Looks right to me. You know $\lfloor x \rfloor$ is the floor function, right? – Hurkyl Jan 19 at 12:45

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,...

share|improve this answer
I mean a formula to generate the sequence of all integers in ascending order like 2k +1 is generating all odd numbers in strict ascending order. – user58874 Jan 19 at 12:24

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$.

share|improve this answer
A recursive formula works: a(n) = 3n - a(n-1) – user58874 Jan 19 at 12:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.