3

All numbers divisible by 3 but not 2 can be found using

$6*n+3$

All numbers Divisible by 5 but not 3 or 2 can be found using

$10*n+5$

Is there a formula for divisible by 7 but not 5,3,or 2?

Joe
  • 534
  • 4
    Your second statement isn't true. For example, 15 = 10 \cdot 1 + 5 is divisible by 3. – Zubin Mukerjee Sep 10 '15 at 23:48
  • Ha, you are right. My bad. well in that case is there also a formula for divisible by 5 but not 2 or 3? – Joe Sep 10 '15 at 23:55
  • 4
    There is a collection of numbers from $0$ to $209$ that satisfy your conditions. Then, all such numbers are found by adding any $210 n$ to those numbers. – Will Jagy Sep 10 '15 at 23:56
  • $6*n+5$ would give some of the numbers but not all as an idea. – JB King Sep 10 '15 at 23:58
  • Why was this marked as a duplicate? Granted, it is very similar, but the previous question dealt with counting such numbers, whereas this question deals with generating them. Also I had an answer that I wanted to post earlier but I had to leave. I came back to post it and I am disappointed to find that the question has been closed. – 727 Sep 11 '15 at 06:54
  • is it much different than the answers below, I will reopen the answers. – Joe Sep 11 '15 at 11:20

2 Answers2

4

Let's look at your first case in more detail. All numbers which are not divisible by 2 are of the form $2k+1$. Multiply by 3 gives you all multiples of 3 which are not multiples of 2.

Next look at all numbers which are not multiples of 2 and 3. It's going to be periodic with period 6. So $6k+i$, where $i$ is an element of $(1,5)$. Multiply these two by 5 gives you $30k+5$ and $30k+25$.

The last case is similar, but $30k+i$, choosing $i$ so that it is not divisible by 2, 3 or 5. Then multiply these by 7.

Dr Xorile
  • 1,407
  • 1
    Specifically, every number that is of the type that the OP is looking for is of the form $210k+7i$, where $k \in \mathbb{Z}$ and $i \in {1,7,11,13,17,19,23,29}$. – 727 Sep 12 '15 at 02:44
1

The number must be of the form $N=7M$. Since $5,3,2$ are primes we need $(M,5)=(M,3)=(M,2)=1$, Let $M=10^na_n+a_{n-1}(10)^{n-1}+.....10a_1+a_0$; hence

$M$ not divisible by $5\iff a_0=1,2,3,4,6,7,8,9$

$M$ not divisible by $3\iff a_n +a_{n-1}+ .....+a_1+a_0\not\equiv3 (mod\space 3)$

$M$ not divisible by $2\iff M$ is odd.

Piquito
  • 29,594