Special permutations

We call a positive integer n n a beautiful number if there exists a permutation a 1 , . . . , a n a_1, ..., a_n of 1 , . . . , n 1,..., n such that { a 1 1 , a 2 2 , a 3 3 , . . . , a n n } \{a_1-1, a_2-2, a_3-3, ..., a_n-n\} and { a 1 + 1 , . . . , a n + n } \{a_1+1, ..., a_n+n\} are both equivalent to { 1 , 2 , . . . , n } \{ 1, 2, ..., n \} modulo n n . How many beautiful numbers are there between 1 and 1000 (inclusive)?


The answer is 333.

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

David Austen
Jan 4, 2014

My Solution:

The answer is 333. The beautiful numbers are only the ones coprime with 6, and from this we easily get the answer. Now we must prove the beautiful numbers are the ones coprime with 6.

First, assume n n is coprime with 6. Then call p 1 = 1 p_1=1 , p 3 = 2 p_3=2 , p 5 = 3 p_5=3 , ..., p n = ( n + 1 ) / 2 p_n = (n+1)/2 , and then call p 2 = ( ( n + 1 ) / 2 ) + 1 p_2=((n+1)/2)+1 , p 4 = p 2 + 1 p_4=p_2+1 , ..., p n 1 = n p_{n-1} = n . We can easily verify that { p 1 1 , . . . , p n 1 } \{ p_1-1, ..., p_n -1 \} is equivalent to { 0 , ( n 1 ) / 2 , 1 , ( n 3 ) / 2 , 2 , . . . , 1 , ( n 1 ) / 2 } { 1 , 2 , . . . , n } \{ 0, (n-1)/2, -1, (n-3)/2, -2, ..., 1, -(n-1)/2 \} \equiv \{ 1, 2, ..., n \} and so it works. Also, we can verify that { p 1 + 1 , . . . , p n + 1 } \{ p_1+1, ..., p_n+1 \} is an arithmetic progression (not in order) that starts with 2 and has common difference 3, and so it also works.

Now we must prove numbers divisible by 2 or 3 don't work.

If n n works, then p 1 + . . . + p n p 1 1 + p 2 2 + . . . + p n n p_1+...+p_n \equiv p_1 -1 + p_2 -2 + ... + p_n-n mod n n , therefore n 1 + . . . + n = n ( n + 1 ) / 2 n | 1+...+n = n(n+1)/2 and so clearly n n is odd.

Also, note that 2 n ( n + 1 ) ( 2 n + 1 ) / 3 = 4 ( 1 2 + . . . + n 2 ) 2 ( ( p 1 2 + 1 2 ) + . . . + ( p n 2 + n 2 ) ) = 2n(n+1)(2n+1)/3 = 4(1^2+...+n^2) \equiv 2((p_1^2 + 1^2) + ... + (p_n ^2 + n^2)) = ( ( p 1 1 ) 2 + ( p 1 + 1 ) 2 ) + . . . + ( ( p n n ) 2 + ( p n + n ) 2 ) 2 ( 1 2 + . . . + n 2 ) ((p_1-1)^2 + (p_1+1)^2) + ... + ((p_n-n)^2 + (p_n+n)^2) \equiv 2(1^2+...+n^2) = n ( n + 1 ) ( 2 n + 1 ) / 3 = n(n+1)(2n+1)/3 mod n n . From this, n n ( n + 1 ) ( 2 n + 1 ) / 3 n | n(n+1)(2n+1)/3 and so ( n + 1 ) ( 2 n + 1 ) / 3 (n+1)(2n+1)/3 is an integer, and therefore clearly n n cannot me a multiple of 3.

So beautiful numbers are the ones coprime with 6 and the answer is 333.

For an integer n n , suppose k k is an integer coprime to n n . Then we claim that the sequence { k ( 1 ) , k ( 2 ) , k ( 3 ) , , k ( n ) } = { k i } i = 1 n { i } i = 1 n = { 1 , 2 , 3 , , n } ( m o d n ) \{k(1),k(2),k(3), \cdots ,k(n)\} = \{ki\}_{i=1}^n \equiv \{i\}_{i=1}^n = \{1,2,3, \cdots ,n\} \pmod{n} . This claim is true because for any i { 1 , 2 , , n 1 } i \in \{1,2, \cdots ,n-1\} , we have k ( i + 1 ) k ( i ) = k k(i+1)-k(i) = k which is coprime to n n , and hence whatever the value of k ( 1 ) ( m o d n ) k(1) \pmod{n} is, the sequence { k i } i = 1 n = { k ( 1 ) + k ( i ) } i = 0 n 1 \{ki\}_{i=1}^n = \{k(1) + k(i)\}_{i=0}^{n-1} traces out all values modulo n n .

The question states { a 1 , a 2 , a 3 , , a n } { a 1 1 , a 2 2 , a 3 3 , , a n n } { a 1 + 1 , a 2 + 2 , a 3 + 3 , , a n + n } \{a_1,a_2,a_3, \cdots ,a_n\} \equiv \{a_1-1,a_2-2,a_3-3, \cdots ,a_n-n\} \equiv \{a_1+1,a_2+2,a_3+3, \cdots ,a_n+n\} . By the above lemma, this implies there must exist 3 3 consecutive integers, that are coprime to n n which implies gcd ( n , 6 ) = 1 \gcd(n,6) = 1 . Precisely, there are 333 \boxed{333} such integers less than 1000 1000 .

How do you know that there are 3 consecutive integers that are coprime to n n ? Note that there are n ! n! ways of ordering the set, and you have only listed ϕ ( n ) \phi(n) ways.

Calvin Lin Staff - 6 years, 5 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...