# Is there a method or a function to generate integers that are only divisible by 3?

Is there a method or a function to generate integers that are only divisible by 3?

-
If you mean by $3$ and no other prime, then $3^n$. – Alex Becker Jan 6 '13 at 4:48
@RahulNarain $3*4=12$, $12 mod2 = 0$ – Babiker Jan 6 '13 at 4:51
What do you mean? If $n$ is an integer divisible by $3$, then we have another integer $n/3$ which also divides $n$. So I guess the only solution to your problem is the constant function $3$. – Hui Yu Jan 6 '13 at 4:55
@AlexBecker Thanks, I'll be glad to accept your answer. – Babiker Jan 6 '13 at 4:55
Wow...I just remembered the Fundamental Theorem of Arithmetic and realized how big of a brain fart that was. – Babiker Jan 6 '13 at 4:57

Every integer is also divisible by $1$, so the collection is empty.

If you're OK with having $1$ as a divisor, every integer is also divisible by itself, so it's just $3$.

If you mean the set of integers for which $3$ is the only prime divisor then you may use the following algorithm:

 1. Let x = 3 and S be empty.
2. Add x and -x to S.
3. Multiply x by 3 and set x equal to that.
4. Go to 2.

-

There is no integer that is only divisible by $3$. Every integer is always divisible by $1$.

-