1
$\begingroup$

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

$\endgroup$
6
  • 11
    $\begingroup$ If you mean by $3$ and no other prime, then $3^n$. $\endgroup$ Jan 6, 2013 at 4:48
  • 2
    $\begingroup$ @RahulNarain $3*4=12$, $12 mod2 = 0$ $\endgroup$
    – Babiker
    Jan 6, 2013 at 4:51
  • 3
    $\begingroup$ 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$. $\endgroup$
    – Hui Yu
    Jan 6, 2013 at 4:55
  • 2
    $\begingroup$ Wow...I just remembered the Fundamental Theorem of Arithmetic and realized how big of a brain fart that was. $\endgroup$
    – Babiker
    Jan 6, 2013 at 4:57
  • 1
    $\begingroup$ I read "generate integers that are only divisible by 3" as "generate only integers that are divisible by 3", sorry. $\endgroup$
    – user856
    Jan 6, 2013 at 5:07

2 Answers 2

4
$\begingroup$

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.
$\endgroup$
2
$\begingroup$

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

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .