Brilli the ant states that "Given any set of 30 distinct integers from 1 to 50 (inclusive), there must exist 2 integers whose absolute difference is exactly N ."
What is the sum of all possible values of N in which the statement is always true?
Details and assumptions
You may use the fact that 2 3 0 × 2 9 = 4 3 5 .
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.
It is somewhat surprising that the set N is so disjoint. You can find a difference of 8 , 9, 11, 12, but not of 10.
I don't know of an easy way to generalize this to numbers other than 30, 50. All of the calculations will need to be done again, though there's a pattern to the madness.
Crap the odd formula should be 2 ⌊ N 5 0 ⌋ − 1 N + N
Could you explain how you got those formulas? Nice solution though.
Log in to reply
The odd formula was messed up (I fixed it in the comments). Define a "cycle" to be 2 N integers in length, in which you "keep" N of them (like in the counting method I suggested). For example, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 --> 1 , 2 , 3 , 4 for N = 4 .
If ⌊ N 5 0 ⌋ is odd, that means there 0 or more full cycles along with at least half of a cycle. The number of full cycles is calculated by 2 ⌊ N 5 0 ⌋ − 1 and each cycle has N elements, so you multiply that by N . In the next at least half cycle, since it is at least half then you have another N integers in that cycle despite it not being a full cycle. For example, take 1 6 . For 1 − 3 2 (A full cycle) you have 1 , 2 , 3 , . . . 1 6 = 16 elements and for 33-50 (Less than a full cycle, but more than half) you have 3 3 , 3 4 , 3 5 . . . 4 8 = 16 elements.
On the other hand, if ⌊ N 5 0 ⌋ is even, then that means there are some number of full cycles along with a partial cycle that is less than half of the elements. For each full cycle you get N elements as usual, and then for the remainder of the integers, since it's less than half, all of the remainder can be put into the set without having a difference of N with any other element. Thus, ( ⌊ N 5 0 ⌋ ) ( 2 N ) + 5 0 − ⌊ N 5 0 ⌋ N → 5 0 − ⌊ N 5 0 ⌋ 2 N is the number of elements (I realize this is different from the formula that I gave, but it gets the exactly same answer. I just realized overnight that this formula is a bit more correspondent to how I derived it)
Let
S = { 1 , 2 , 3 , … , 5 0 } .
If we can make t pairs ( a , b ) with t ≥ 2 1 from the integers from 1 to 5 0 such that ∣ a − b ∣ = N , then by the pigeonhole principle, given any set
T ⊂ S with ∣ T ∣ = 3 0 ,
there are two integers p , q ∈ T such that ( p , q ) is one of those pairs. This is because there are 5 0 − 2 t integers not in a pair and thus there are at most
3 0 − ( 5 0 − 2 t ) = 2 t − 2 0
integers in t pairs, and
t ≥ 2 1 ⟹ t − 2 0 ≥ 1 ⟹ 2 t − 2 0 ≥ t + 1 > t .
Therefore, we wish to find the sum of all possible values of N such that we can pair up at least 4 2 of the numbers in S such that each two elements of a pair have an absolute difference of T .
Let's denote a succesful set of pairings of at least 2 1 pairs for a certain N by S N . For example,
S 1 = { ( 1 , 2 ) , ( 3 , 4 ) , ( 5 , 6 ) , ( 7 , 8 ) , … , ( 4 1 , 4 2 ) } .
Let V N , k be the set of pairs
( m + k ⋅ 2 N , m + N + k ⋅ 2 N ) with 1 ≤ m ≤ N .
For example,
V 3 , 0 = { ( 1 , 4 ) , ( 2 , 5 ) , ( 3 , 6 ) }
and
V 3 , 1 = { ( 7 , 1 0 ) , ( 8 , 1 1 ) , ( 9 , 1 2 ) } .
Note that V 3 , 0 contains 3 pairs with the integers from 1 to 6 such that each pair consists of two integers with an absolute difference of 3 . Similarly, V 3 , 1 contains 3 pairs with the integers from 7 to 1 2 in that way.
In general, V N , k contains N pairs with the integers from 1 + k ⋅ 2 N to ( k + 1 ) ⋅ 2 N such that each pair consists of two integers with an absolute difference of N .
Let
W N = V N , 0 ∪ V N , 1 ∪ V N , 2 ∪ ⋯ ∪ V N , x with x = ⌈ N 2 1 ⌉ − 1 .
We know that ∣ V N , k ∣ = N for all k , and that V N , a and V N , b are disjoint for all distinct integers a , b , so
∣ W N ∣ = ⌈ N 2 1 ⌉ ⋅ N ≥ N 2 1 ⋅ N = 2 1 .
Note that the largest integer in any pair of W N is no more than ∣ W N ∣ ⋅ 2 . This implies that if ∣ W N ∣ ≤ 2 5 0 = 2 5 , then S N = W N , because then the largest integer in W N does not exceed 2 5 ⋅ 2 = 5 0 , and as shown above, W N ≥ 2 1 .
If 2 6 ≤ ∣ W N ∣ ≤ 2 9 , then we obtain S N by taking W N and removing the 2 ⋅ ∣ W N ∣ − 5 0 pairs that contain the 2 ⋅ ∣ W N ∣ − 5 0 integers in W N exceeding 5 0 , after which we're left with a set containing
∣ W N ∣ − ( 2 ⋅ ∣ W N ∣ − 5 0 ) = 5 0 − ∣ W N ∣ ≥ 5 0 − 2 9 = 2 1
pairs, satisfying S N ≥ 2 1 .
So,there exists a set S N for some N as long as
∣ W N ∣ ≤ 2 9 ⟹ ⌈ N 2 1 ⌉ ⋅ N ≤ 2 9 ⟹ ⌈ N 2 1 ⌉ ≤ N 2 9 .
If N > 2 9 , then
N 2 9 < 1 = ⌈ N 2 1 ⌉ ,
so N ≤ 2 9 . By simply checking each value, we obtain that
N ∈ { 1 , 2 , 3 , … , 2 9 } ∖ { 1 0 , 1 5 , 1 6 , 1 7 , 1 8 , 1 9 , 2 0 } .
To check that N = 1 0 , consider the set
{ 1 , 2 , 3 , … , 1 0 , 2 1 , 2 2 , 2 3 , … , 3 0 , 4 1 , 4 2 , 4 3 , … , 5 0 } ,
which contains 3 0 integers of which there are no two with an absolute difference of 1 0 .
To check that 1 5 ≤ N ≤ 2 0 is also impossible, consider the set
{ 1 , 2 , 3 , … , 1 5 , 3 6 , 3 7 , 3 8 , … , 5 0 } ,
which contains 3 0 integers of which the absolute difference of two of its elements is either less than 1 5 or larger than 2 0 .
So, the sum of all possible values of N such that there exists a set S N and thus the conditions are satisfied is
= = = ( 1 + 2 + 3 + ⋯ + 2 9 ) − ( 1 0 + 1 5 + 1 6 + 1 7 + 1 8 + 1 9 + 2 0 ) 2 2 9 ⋅ 3 0 − 1 1 5 4 3 5 − 1 1 5 3 2 0 .
Let f ( X ) be the size of the largest possible set that has no two integers with difference N
We can divide the 50 integers up into N buckets. Here's an example for N = 9 : 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 1 0 , 1 9 , 2 8 , 3 7 , 4 6 1 1 , 2 0 , 2 9 , 3 8 , 4 7 1 2 , 2 1 , 3 0 , 3 9 , 4 8 1 3 , 2 2 , 3 1 , 4 0 , 4 9 1 4 , 2 3 , 3 2 , 4 1 , 5 0 1 5 , 2 4 , 3 3 , 4 2 1 6 , 2 5 , 3 4 , 4 3 1 7 , 2 6 , 3 5 , 4 4 1 8 , 2 7 , 3 6 , 4 5 If any bucket has at least 4 members in the set, then two of them must be adjacent and therefore have difference 9 . So, by the pigeonhole principle, f ( 9 ) = 9 ∗ 3 .
Generalizing from this example, for each N we can divide it as 5 0 = q N + r , where q is the number of complete columns, and r is the number of rows in the last column.
Then if q is odd, f ( N ) = N 2 q + 1 . And if q is even, f ( N ) = N 2 q + r .
Now, we want to find all N so that f ( N ) ≥ 3 0 . We can categorize these by considering values for q in turn, remembering that q = ⌊ N 5 0 ⌋ and r < N :
q = 1 , f ( N ) = N , N ∈ { 2 6 , 2 7 , . . . , 5 0 } : 21 solutions N > 3 0
q = 3 , f ( N ) = 2 N , N ∈ { 1 3 , 1 4 , 1 5 , 1 6 } : 2 solutions N = 1 5 , N = 1 6
q = 5 , f ( N ) = 3 N , N ∈ { 9 , 1 0 } : 1 solution N = 1 0
q = 7 , f ( N ) = 4 N , N = 7 : no solutions
q = 9 , f ( N ) = 5 N : no solutions
q = 2 5 , f ( N ) = 1 3 N , N = 2 : no solutions
q = 2 , f ( N ) = N + r , N ∈ { 1 7 , 1 8 , . . . , 2 5 } : 4 solutions N = 1 7 , N = 1 8 , N = 1 9 , N = 2 0
q = 4 , f ( N ) = 2 N + r , N ∈ { 1 1 , 1 2 } : no solutions
q = 6 , f ( N ) = 3 N + r , N = 8 , r = 2 : no solutions
q = 8 , f ( N ) = 4 N + r , N = 6 , r = 2 : no solutions
q = 1 0 , f ( N ) = 5 N + r , N = 5 , r = 0 : no solutions
q = 1 2 , f ( N ) = 6 N + r , N = 4 , r = 2 : no solutions
q = 1 6 , f ( N ) = 8 N + r , N = 3 , r = 2 : no solutions
The question is asking for all the values of N which are not solutions, i.e. 1 − 9 , 1 1 − 1 4 , 2 1 − 2 9 which add up to 3 2 0 .
This is fairly ugly although I think it is generalizable. A trick is to consider the columns instead of the rows - for example with N=9, we have 9 numbers "on", then 9 numbers "off", then 9 "on" and so on. so we will need 5 lots of 9 in order to get 3x9 numbers "on", and then 9 more "off", and then 3 more "on" to make 30, so we would need 6x9+3 = 57 numbers to consider in order for N=9 to be a solution. We can work this out for each N and then consider the ones that work out to 50 or less.
Following @Michael Tong solution, it's possible to find a general condition. Given the set of integers from 1 to M and a subset of size S , there must exist 2 integers whose absolute difference is exactly N , if
F ( N ) < S
where
F ( N ) = ⎩ ⎪ ⎪ ⎨ ⎪ ⎪ ⎧ N ⌈ 2 1 ⌊ N M ⌋ ⌉ + ( M m o d N ) , N ⌈ 2 1 ⌊ N M ⌋ ⌉ , if ⌊ N M ⌋ ≡ 0 m o d 2 otherwise
Problem Loading...
Note Loading...
Set Loading...
Clearly, 1 ≤ N ≤ 4 9 and N is an integer. Additionally, N < 3 0 since there exists a counter example for all N ≥ 3 0 , e.g. ( 1 , 2 , 3 , . . . 3 0 ) .
The N that satisfy the equation can be found by finding the values of N which have a counterexample. We will find this in the following way: Starting with 1 , list N integers in a row, then skip the next N integers, then list the next N integers, etc. until we reach 5 0 . For example, for N = 1 7 , we have 1 , 2 , 3 , . . . 1 7 , 3 5 , 3 6 , 3 7 , . . . 4 9 , 5 0 . If the number of integers in this listing is at least 30, then we have a counter example for that value of N , that is, any 30 element subset of those integers would be a counter example. If it is below 30, then more integers must be added who necessarily have an absolute difference of N with an already listed integer. The number of integers in this sequence can be calculated by the following formulae:
If ⌊ N 5 0 ⌋ is odd, then 2 ⌊ N 5 0 ⌋ − 1 N + N ≥ 3 0
If ⌊ N 5 0 ⌋ is even, then 5 0 − ⌊ 2 N 5 0 ⌋ N ≥ 3 0
Calculation can be facilitated by looking at numbers in groups. For example, when 1 7 ≤ N ≤ 2 5 , that is, ⌊ N 5 0 ⌋ = 2 , plugging it into the equation we get 5 0 − N ≥ 3 0 → N ≤ 2 0 , meaning that there exists a counter example for 1 7 ≤ N ≤ 2 0 .
After a bit of calculation we find that N = 1 0 , 1 5 ≤ N ≤ 2 0 , N ≥ 3 0 have counter examples and, thus, the rest of them do not. Adding the sum of the valid values we get S N = 3 2 0 .