Not a fan of 3

How many positive integers n 1000 n \leq 1000 are there which satisfy the following condition:

We can rearrange the positive integers from 1 to n n in a row, where the sum of the first k k terms is not a multiple of 3, for every 1 k < n 1 \leq k < n .

Note: To avoid ambiguity, the integer 1 satisfies the above condition.


The answer is 1000.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Ariel Gershon
Jan 22, 2015

Let m = n 3 m = \left\lfloor \dfrac{n}{3} \right\rfloor .

Then we can arrange the numbers as follows, into the sequence ( a r ) (a_r) : a r = { 1 : r = 1 3 r + 1 2 : 2 r n m 1 3 ( r n + m + 1 ) : n m r n 1 2 : r = n a_r = \left\{ \begin{array}{lr} 1 & : r = 1\\ \left\lceil\dfrac{3r+1}{2} \right\rceil & : 2 \le r \le n - m-1\\ 3(r-n+m+1) & : n-m \le r \le n - 1\\ 2 & : r = n \end{array}\right.

It is easily verifiable that this sequence contains each number from 1 1 to n n exactly once;

Define S r = i = 1 r a i S_r = \sum_{i = 1}^{r} a_i . Notice that the sequence starts with 1 1 , so S 1 = 1 S_1 = 1 . Then this is followed by a sequence which alternates between 1 ( m o d 3 ) 1 \pmod{3} and 2 ( m o d 3 ) 2 \pmod{3} . Hence, in this section S r S_r alternates between 2 ( m o d 3 ) 2 \pmod{3} and 1 ( m o d 3 ) 1 \pmod{3} .

The third section contains only multiples of 3 3 , so in this section S r 1 ( m o d 3 ) S_r \equiv 1 \pmod{3} . Hence S r ≢ 0 ( m o d 3 ) S_r \not\equiv 0 \pmod{3} for 1 r < n 1 \le r < n .

Therefore, it is always possible to create such a sequence for all positive integers n n .

Nice explanation. (I'm going to use that as an excuse for not writing up my own explanation. :) )

One comment: I think that it would still work if you made a k = k + 1 a_k = k+1 for 1 < k < n 1<k<n (still keeping a 1 = 1 a_1 = 1 and a n = 2 a_n = 2 ). That seems to be the simplest pattern that works, i.e. 1 , 3 , 4 , 5 , . . . , n , 2. 1, 3, 4, 5, ..., n, 2.

Peter Byers - 6 years, 4 months ago

Log in to reply

P.S. So the sum of the first k k terms, for k < n k<n , is

( k + 1 ) ( k + 2 ) / 2 2 (k+1)(k+2)/2-2

which is equivalent in m o d 3 \mod 3 to either 2 -2 or 1 2 = 1 1-2=-1 as desired.

Peter Byers - 6 years, 4 months ago

Log in to reply

Oh you're right, that is simpler :)

Ariel Gershon - 6 years, 4 months ago
Vinay Sipani
Jan 23, 2015

The sequence is

1

1 2

1 3 2

1 3 4 2

1 3 4 2 5

1 3 4 2 6 5

1 3 4 2 6 7 5

1 3 4 2 6 7 5 8

1 3 4 2 6 7 5 9 8

1 3 4 2 6 7 5 9 10 8

1 3 4 2 6 7 5 9 10 8 11

1 3 4 2 6 7 5 9 10 8 12 11

1 3 4 2 6 7 5 9 10 8 12 13 11

1 3 4 2 6 7 5 9 10 8 12 13 11 14

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...