AFHKNW

Using an ordered alphabet of 26 letters, how many ways are there to choose a set of six different letters such that no two letters in the set are adjacent in the alphabet?

For instance, { I S O K A Y } \{ISOKAY\} is a valid set of six letters, but { V E T O I F } \{V\color{#D61F06}E\color{#333333}TOI\color{#D61F06}F\color{#333333}\} is not because E E and F F are both in the set.


Note : As always, a "set" is considered unordered. Hence, { I S O K A Y } \{ISOKAY\} and { Y A K O S I } \{YAKOSI\} and { A I K O S Y } \{AIKOSY\} are considered the same set.


The answer is 54264.

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.

8 solutions

Arjen Vreugdenhil
Dec 14, 2017

Relevant wiki: Permutations - Problem Solving

Think of a string of 27 boxes, one empty, followed by the letters of the alphabet: A B C Z \begin{array}{|c|c|c|c|c|c|}\hline \\ \ \ \ & \mathbf A & \mathbf B & \mathbf C & \cdots & \mathbf Z \\ \hline \end{array}

Underneath we must place 6 pairs of boxes like this: \begin{array}{|c|c|}\hline \\ \ \ \ & \star \\ \hline \end{array} and 15 empty boxes.

The stars represent the six letters we pick. The empty boxes to the left of the stars provide the "padding" needed to ensure that no two adjacent letters are chosen.

Thus the answer is: in how many ways can we arrange the 6 identical pairs and the 15 identical empty boxes? The answer is ( 21 6 ) = 21 20 19 18 17 16 6 5 4 3 2 1 = 21 19 17 8 = 54 264 . \binom{21}{6} = \frac{21\cdot 20\cdot 19 \cdot 18\cdot 17\cdot 16}{6\cdot 5\cdot 4\cdot 3\cdot 2\cdot 1} = 21\cdot 19 \cdot 17\cdot 8 = \boxed{54\,264}.


Inspiration

I thought of this problem after buying in a second-hand book store six volumes of Sue Grafton's alphabet mysteries. The store happened to have these six: "A" is for Alibi , "F" is for Fugitive , "H" is for Homicide , "K" is for Killer , "N" is for Noose , and "W" is for Wasted . I realized that none of the books were adjacent in the series. "What are the chances of that?" I thought immediately.

I calculated the 54 264 54\,264 arrangements in my head on the way home, but calculating the odds is better done with a calculator around. The probability that six randomly chosen letters from the alphabet contain no adjacent letters is ( 21 6 ) ( 26 6 ) = 21 19 17 8 13 5 23 22 7 = 54264 230230 ; \frac{\binom{21}{6}}{\binom{26}{6}} = \frac{21\cdot 19\cdot 17\cdot 8}{13\cdot 5\cdot 23\cdot 22\cdot 7} = \frac{54264}{230230}; or reduced further, = 3 19 17 4 13 5 23 11 = 3876 16445 23.6 % . = \frac{3\cdot 19\cdot 17\cdot 4}{13\cdot 5\cdot 23\cdot 11} = \frac{3876}{16445} \approx 23.6\%.

Incidentally, at this time, Grafton has not yet written "Z" is for ... , and "Y" is for Yesterday appeared so recently that one cannot reasonable expect it in a second-hand book store. This makes the odds slightly lower, about 20.2%.

Sir, I maybe misunderstanding the question.

The question says Ordered alphabet \textbf{Ordered alphabet} I thought it was 54264 × 6 ! 54264 \times 6! .

Kelvin Hong - 3 years, 5 months ago

Log in to reply

The word "ordered" must have been added by the Brilliant staff-- not my original formulation!

But it means that the alphabet is ordered: that is, given any two letters x y x \not= y , we have either x < y x < y or x > y x > y , with the usual asymmetry and transitive properties.

It does not mean that the sets chosen from them are ordered. This is illustrated in the given examples.

Arjen Vreugdenhil - 3 years, 5 months ago

Log in to reply

Okay... Thanks for explanation.

Kelvin Hong - 3 years, 5 months ago

from what i can tell, Brilliant got it wrong and so too do you in trying to reconcile the the manner in which Brilliant edited his problem OR in your original presentation. the use of { } indicates an UNORDERED set while the use of ( ) indicates an ORDERED set. further, UNORDERED expressly means the order DOES NOT matter. that is, no matter what order the objects are written, the set is the same. ORDERED, meanwhile, means order DOES matter. hence, (A, B) is different than (B,A).

so the use of the { } is incongruous with the term ORDERED and the problem becomes ambiguous.

Mark Brown - 3 years, 4 months ago

Log in to reply

@Mark Brown The alphabet is said to be ordered; more correctly, it is a fully ordered set. This means that it is a set A A such that for any x y A x \not = y \in A , we have either x < y x < y or x > y x > y . Thus the alphabet is not merely the undordered set { A , B , C , , X , Y , Z } \{\mathrm{A,B,C,\dots,X,Y,Z}\} but the structured set { A < B < C < < X < Y < Z } \{\mathrm{ A < B < C < \cdots < X < Y < Z }\} or, if you will, the ordered tuple ( A , B , C , , X , Y , Z ) (A, B, C, \cdots, X,Y,Z) .

This allows us to speak about adjacent letters: two letters x < y x < y are adjacent in the alphabet iff there is not z A z \in A such that x < z < y x < z < y . Without stating or assuming that the alphabet is ordered, the problem makes no sense.

But the chosen sets of six letters are not said to be ordered; and since the word "set" is used and the curly-bracket notation { } \{\ \} , they must be considered unordered sets. Thus, we count { A , I , K , O , S , Y } \{A,I,K,O,S,Y\} and { I , S , O , K , A , Y } \{I,S,O,K,A,Y\} as the same set. This in no way contradicts the fact that the alphabet has an ordering!

Your criticism, I believe, arises from confusing the ordering of the alphabet and the ordering of the sets . The problem is not stated incorrectly. However, to prevent further misconception, I will edit the problem to specity that the chosen sets are "unordered".

Arjen Vreugdenhil - 3 years, 4 months ago

from what i can tell, Brilliant got it wrong and so too does the originator of the problem in his trying to reconcile the the manner in which Brilliant edited his problem OR in his original presentation. the use of { } indicates an UNORDERED set while the use of ( ) indicates an ORDERED set. further, UNORDERED expressly means the order DOES NOT matter. that is, no matter what order the objects are written, the set is the same. ORDERED, meanwhile, means order DOES matter. hence, (A, B) is different than (B,A).

so the use of the { } is incongruous with the term ORDERED and the problem becomes ambiguous.

Mark Brown - 3 years, 4 months ago

It is not specified that we cannot choose the same letter multiple times. In this case we have other valid sets, like { A A A A A A } \{AAAAAA\} .

Romain Bouchard - 3 years, 5 months ago

Log in to reply

This is implied by the word "set". A set either contains an item x S x \in S or does not contain it x ∉ S x \not\in S .

The variant of a set in which repetition is allowed is called a bag .

Arjen Vreugdenhil - 3 years, 5 months ago

Log in to reply

However, for sake of clarity I will insert the word "distinct" in the problem.

Arjen Vreugdenhil - 3 years, 5 months ago

It isn't implied by the word "set", { A , A , A , A , A , A } = { A } \{A,A,A,A,A,A\}=\{A\} can still be viewed as a set.

Abraham Zhang - 2 years, 6 months ago

The set { A , A , A , A , A , A } \{A,A,A,A,A,A\} consists only one element.

Arjen Vreugdenhil - 2 years, 6 months ago

It says a set of 6 different letters, so of course you can't choose the same letter multiple times.

Kevin Tong - 3 years, 5 months ago

Log in to reply

Actually, he added " different " thanks to my comment (cf. his replies below) :)

Romain Bouchard - 3 years, 5 months ago

Log in to reply

@Romain Bouchard Oh, that makes sense.

Kevin Tong - 3 years, 5 months ago

The question would be unambiguous if it was " { I , S , O , K , A , Y } \{I,S,O,K,A,Y\} " is a valid set of six letters.

Sandor Szabo - 3 years, 5 months ago

Sadly, Grafton will not be completing the Z volume, as she recently passed away.

Jacob Coughlan - 3 years, 5 months ago

Log in to reply

I did not know that. That is sad...

Arjen Vreugdenhil - 3 years, 5 months ago

Meanwhile, I'm here foolishly trying to solve this by complementary counting and principles of inclusion and exclusion. I realized this method like an hour later. But very clean method. And must've been a long way home if you were able to calculate such a large number in your head.

Kevin Tong - 3 years, 5 months ago

Log in to reply

About three miles :) To evaluate 21 19 17 8 21\cdot 19\cdot 17\cdot 8 , I took these steps:

  • 21 19 = ( 20 + 1 ) ( 20 1 ) = 2 0 2 1 = 400 1 21\cdot 19 = (20 + 1)(20 -1) = 20^2 - 1 = 400 - 1

  • 17 8 = 136 17\cdot 8 = 136

  • 21 19 17 8 = ( 400 1 ) 136 = 54 400 136 = 54 264 21\cdot 19\cdot 17\cdot 8 = (400 - 1)\cdot 136 = 54\,400 - 136 = 54\,264 .

Arjen Vreugdenhil - 3 years, 5 months ago

Log in to reply

Oh, that's clever. Well done.

Kevin Tong - 3 years, 5 months ago

Hello, does it count if I solved it writing a small python script?

Meneghin Mauro - 3 years, 5 months ago

Log in to reply

If you get the right number, Brilliant will give you points. So it counts.

The problem was intended as practice with combinatorics, but if it helps you practice your coding skills, kudos to you! Feel free to post your script as a solution.

Arjen Vreugdenhil - 3 years, 5 months ago

your problem doesnt specify if order matters...from the wording i would say it does not matter as you state "how many different ways can you choose a set of 6" so each permutation of any one combination of letters would each be a different way to choose...hence the answer would be 54264*720.....whatever that may be

Mark Brown - 3 years, 4 months ago

Log in to reply

It says to "choose" a set of 6, not "make" a set of 6, thus order is not even relevant in this case. Think of it as the binomial coefficient or n choose r, this is an unordered choosing. Choosing a set of 6 is not the same as making a set of 6.

Kevin Tong - 3 years, 4 months ago

Log in to reply

At least that's how I interpret it.

Kevin Tong - 3 years, 4 months ago
Lying Daniel
Jan 1, 2018

Relevant wiki: Permutations - Problem Solving

Imagine putting 20 identical objects in a straight line, and then adding 6 objects of another type between them. Now you have a line of 26 objects, 6 of them different from the rest. Apply the alphabet to this line of objects, and imagine that the 6 “distinct” objects highlight 6 letters in the matching position. This is your “answer set”. Notice how the way you place these 6 objects into the rest determines the letters in the answer set, each unique way representing an unique solution. So now the problem becomes “how to place 6 objects between 20 other objects?” The solution is apparent: There are 21 spaces for 6 objects, so the answer is

( 21 6 ) 21 \choose 6 = 54264 =\boxed{54264}

Intuitive!

Bharadwaj Vemparala - 3 years, 5 months ago

quite intuitive but if you had 20 objects with 6 other objects placed "between" them you would have only 19 spaces for 6 objects. the terminology should be a bit different to describe what you are saying...such as 21 spaces to place 6 objects adjacent to the 20 objects

Mark Brown - 3 years, 4 months ago
  • Let me mean the letters A A , B B , C , , Z C, \ldots \ldots \ldots, Z by the integers 1 , 2.3 , , 26 1,2.3, \ldots \ldots \ldots, 26 , respectively.

-So, now the problem is equivalent to finding the number of ways to choose 6 6 integers from the first 26 26 integers so that no two chosen integers are consecutive integers.

  • Let a , b , c , x , y , z a, b, c, x, y, z be six integers (in increasing order).

  • Note that, even when any two of a , b , c , x , y , z a, b, c, x, y, z are consecutive, no two of a , b + 1 , c + 2 , x + 3 , y + 4 , z + 5 a, b+1, c+2, x+3, y+4, z+5 are consecutive.

  • That means, we can choose any six integers a , b , c , x , y , z a, b, c, x, y, z from the set of { 1 , 2 , 3 , , 21 } \{1, 2, 3, \ldots \ldots \ldots, {\color{#3D99F6} \boxed{21}}\} , then choose the letters represented by a , b + 1 , c + 2 , x + 3 , y + 4 , z + 5 a, b+1, c+2, x+3, y+4, z+5 .

Hence the number of ways is: ( 21 6 ) = 54264 \binom{21}{6}= \boxed{54264} .

You have shown one way to construct such a set, But are all sets really represented by such choice of integers?

Agnishom Chattopadhyay - 3 years, 5 months ago

Log in to reply

Good question.

I believe, you are asking if, for every ( a , b + 1 , c + 2 , x + 3 , y + 4 , z + 5 ) \color{#3D99F6} (a,b+1, c+2, x+3, y+4, z+5) with 1 a < b + 1 < c + 2 < x + 3 < y + 4 < z + 5 26 \color{#3D99F6} 1\leq a < b+1< c+2< x+3<y+4<z+5\leq 26 , there exists ( a , b , c , x , y , z ) \color{#20A900}(a,b,c,x,y,z) with 1 a < b < c < x < y < z 21 \color{#20A900} 1\leq a<b<c<x<y<z\leq 21 ? Of course.

As no two of ( a , b + 1 , c + 2 , x + 3 , y + 4 , z + 5 ) \color{#3D99F6} (a,b+1, c+2, x+3, y+4, z+5) are consecutive, we have a < b < c < x < y < z \color{#20A900} a<b<c<x<y<z . As 1 a \color{#3D99F6} 1\leq a , we also have 1 a \color{#20A900} 1 \leq a . And z + 5 26 \color{#3D99F6} z+5\leq 26 ensures us that z 21 \color{#20A900} z \leq 21 , establishing us at completeness.

Muhammad Rasel Parvej - 3 years, 5 months ago

I think your logic is incomplete..

If u make the row in ascending order (since it is collection, u can do that for the ease of understanding...)

U get your constraint as 1 <= a <= b+1 <= c+2 <= d+3 <= e+4 <= f+5 <= 26

then your logic will be complete.

With 1<= a <= 16

2<= b <= 17

3 <= c <= 18

4 <= d <= 19

5 <= e <= 20

6 <= f <= 21

Thus chosing any 6 from the set of 21 numbers will make it.

You chose a set of numbers but put in a box with the respective shifts of those numbers... which will never collide.

One thing.. chosing a combination even from an ordered set wont remain ordered.. but you will always get an unique valid combo from each of ur unordered choice.

But i followed an addition process that increases in folds.. just like unfolding a paper.. And used calculator.

Manual calculation required some long sums like techniques required in calculating cumulative frequencies in statistics.. I felt that gave me a detailed and clearer view of the entire thing. Yaa.. i m less smart i think. Can not post my solution any more here.

Ananya Aaniya - 3 years, 5 months ago
Miroslav Mihov
Jan 2, 2018

The following is a more empirical approach that derives a formula for any set of k different non-adjacent items (a k k -set) from an ordered collection that contains n n items (a n n -collection). By experimentally checking the combinations of 2 different non-adjacent letters, you can quickly induce that each new letter n n increases the number of possible combinations by n 2 n-2 . That is, when you have a 4-collection, you have 3 2-sets. When you increase the number of letters to 5, you get 3 + ( 5 2 ) = 6 3+(5-2)=6 2-sets. When you consider 3-sets, each new letter that you add, can be added to a set that contains any letter, except: 1) itself; 2) it's adjacent letter(n-1). That means that it will generate a new set with any ( k 1 ) (k-1) -set of a ( n 2 ) (n-2) -collection. For example, a 5-collection contains 1 3-set. A 6-collection will contain the same set AND any new sets generated by the new letter. In that case that means that it will generate 1 + the number of 2-sets of a 4-collection. So the number of 3-sets in a 6-collection is 1 + 3 = 4 1 + 3 = 4 .

Now we can generalize a formula:

N ( k N(k -sets / n /n -collection ) = N ( ( k 1 ) ) = N((k-1) -sets / ( n 2 ) /(n-2) -collection ) + N ( ( k ) + N((k -sets ) / ( n 1 ) )/(n-1) -collection)

Where N ( x ) N(x) means number of x x , and k k -sets / n /n -collection means k-sets from an n-collection.

Number of Letters 2s 3s 4s 5s 6s
3 1 0 0 0 0
4 3 0 0 0 0
5 6 1 0 0 0
6 10 4 0 0 0
7 15 10 1 0 0
8 21 20 5 0 0
9 28 35 15 1 0
10 36 56 35 6 0
11 45 84 70 21 1
12 55 120 126 56 7
13 66 165 210 126 28
14 78 220 330 252 84
15 91 286 495 462 210
16 105 364 715 792 462
17 120 455 1001 1287 924
18 136 560 1365 2002 1716
19 153 680 1820 3003 3003
20 171 816 2380 4368 5005
21 190 969 3060 6188 8008
22 210 1140 3876 8568 12376
23 231 1330 4845 11628 18564
24 253 1540 5985 15504 27132
25 276 1771 7315 20349 38760
26 300 2024 8855 26334 54264

Your table replicates Pascal's triangle. In row r r column c c you place the value N r , c = ( r c c ) , N_{r,c} = \binom {r - c}{c}, and the well-known property ( n k ) = ( n 1 k 1 ) + ( n 1 k ) \binom n k = \binom {n-1}{k-1} + \binom {n-1} k translates to N r , c = N r 1 , c + N r 2 , c 1 . N_{r,c} = N_{r-1,c} + N_{r-2,c-1}.

Arjen Vreugdenhil - 3 years, 5 months ago

Log in to reply

That is a very cool observation!

Agnishom Chattopadhyay - 3 years, 5 months ago
Angel Krastev
Jan 4, 2018

The answer is 54264.
I wrote a little program for Liberty Basik to find the answer.
Initially the program was generating the combinations and was able to print them if I wanted to. Then I minimized it only to count the number of combinations.
First: Let's use numbers from 1 to 26 instead of letters from A to Z.
Second: Let's use the variable "Distance" so that Distance = 1 means no restrictions for adjacent numbers.
This would be the case for the full number of combinations, which is (26.25.24.23.22.21) / (1.2.3.4.5.6) = 230230.
Our task is to make Distance = 2 (to skip one position and avoid adjacent numbers).
This universal approach prompted me to do a small research and find all the answers
for Distances from 1 to 5 (5 by the way is the maximal distance possible).
Here are the results:
Distance=1 - 230230 combinations with adjacent numbers like 123456, 123457, 123458, ... , 21,22,23,24,25,26;
Distance=2 - 54264 combinations with no adjacent numbers like 1,3,5,7,9,11, ... , 16,18,20,22,24,26;
And now even stronger restrictions Distance=3 - 8008 combinations like 1,4,7,10,13,15, ... , 11,14,17,20,23,26;
Distance=4 - 462 combinations like 1,5,9,13,17,21, ... 6,10,14,18,22,26;
Distance=5 - 1 combination which should be 1,6,11,16,21,26.






And here is the minimized program:

 for Distance = 1 to 5  
  print Distance;" - ";  
 Counter = 0  
   for a = 1 to 26  
    for b = a + Distance to 26  
     for c = b + Distance to 26  
      for d = c + Distance to 26  
       for e = d + Distance to 26  
        for f = e + Distance to 26  
 Counter = Counter + 1  
        next f  
       next e  
      next d  
     next c  
    next b  
   next a  
  print Counter  
 next Distance

Nice generalization!

Mathematically, if the minimum distance is d d , the length of the alphabet n n , and the number of items to be chosen is k k , then the number of possible choices is N ( n , k , d ) = ( n ( d 1 ) ( k 1 ) k ) . N(n,k,d) = \binom{n - (d-1)(k-1)} k. Thus, the values you found may be reproduced as N ( 26 , 6 , 0 ) = ( 31 6 ) = 736 281 ; N ( 26 , 6 , 1 ) = ( 26 6 ) = 230 230 ; N ( 26 , 6 , 2 ) = ( 21 6 ) = 54 264 ; N ( 26 , 6 , 3 ) = ( 16 6 ) = 8008 ; N ( 26 , 6 , 4 ) = ( 11 6 ) = 462 ; N ( 26 , 6 , 5 ) = ( 6 6 ) = 1. N(26,6,0) = \binom{31}6 = 736\,281; \\ N(26,6,1) = \binom{26}6 = 230\,230; \\ N(26,6,2) = \binom{21}6 = 54\,264; \\ N(26,6,3) = \binom{16}6 = 8008; \\ N(26,6,4) = \binom{11}6 = 462; \\ N(26,6,5) = \binom 6 6 = 1.

Arjen Vreugdenhil - 3 years, 5 months ago
Sam Adriaensen
Jan 3, 2018

We will construct a solution by stepwise selecting the (alphabetically) next letter. The first letter cannot come after P, because the alphabetically last solution is { P , R , T , V , X , Z } \{P,R,T,V,X,Z \} . So there are 16 choices for the first letter. When the i i th letter l i l_i has been selected, then the next letter comes at least two places after l i l_i and comes before the ( 14 + 2 i ) (14+2i) th position. This yields the following expression: l 1 = 1 16 l 2 = l 1 + 2 18 l 3 = l 2 + 2 20 l 4 = l 3 + 2 22 l 5 = l 4 + 2 24 l 6 = l 5 + 2 26 1. \sum_{l_1=1}^{16} \sum_{l_2=l_1+2}^{18} \sum_{l_3=l_2+2}^{20} \sum_{l_4=l_3+2}^{22} \sum_{l_5=l_4+2}^{24} \sum_{l_6=l_5+2}^{26} 1. This sums up to 54264 \boxed{54264} .

The big question is how to evaluate this sum...

Arjen Vreugdenhil - 3 years, 5 months ago

Log in to reply

l 6 = l 5 + 2 26 1 = 25 l 5 \sum_{l_6=l_5+2}^{26} 1 = 25-l_5 , so l 5 = l 4 + 2 24 l 6 = l 5 + 2 26 1 = l 5 = l 4 + 2 24 ( 25 l 5 ) \sum_{l_5=l_4+2}^{24} \sum_{l_6=l_5+2}^{26} 1 = \sum_{l_5=l_4+2}^{24} (25-l_5) . Repeating this process always yields a linear expression in l i l_i with i i always diminishing. Or you know, just put it in a computer.

Sam Adriaensen - 3 years, 5 months ago

Log in to reply

One of the challenges in mathematics is to simplify processes that are repetitive or convoluted, by discovering patterns or tying them in with known relations. In this case, the theory of binomial coefficients provides an elegant method to deal with the situation.

Arjen Vreugdenhil - 3 years, 5 months ago

Log in to reply

@Arjen Vreugdenhil By rewriting the sum as l 1 = 1 16 l 2 = l 1 + 1 17 l 3 = l 2 + 1 18 l 4 = l 3 + 1 19 l 5 = l 4 + 1 20 l 6 = l 5 + 1 21 1 \sum_{l_1=1}^{16} \sum_{l_2=l_1+1}^{17} \sum_{l_3=l_2+1}^{18} \sum_{l_4=l_3+1}^{19} \sum_{l_5=l_4+1}^{20} \sum_{l_6=l_5+1}^{21} 1 one could use the same reasoning as above to see that this expression describes the number of ways to chose six numbers l 1 < l 2 < < l 6 l_1 < l_2 < \dots < l_6 from a set of 21 numbers. We know this number is ( 21 6 ) \binom{21}{6} .

Sam Adriaensen - 3 years, 5 months ago

Log in to reply

@Sam Adriaensen Right!

Your rewriting of the sums is identical to my use of pairs of boxes instead of individual boxes.

Arjen Vreugdenhil - 3 years, 5 months ago

Separate the alphabet into two groups of 13 non-adjacent letters ACEGIKMOQSUWY and BDFHJLNPRTVXZ Form all permutations of 6 letter words for each group of 13 letters: 2x13P6=2x13x12x11x10x9x8 = 2471040 In addition, form 6 letter words from ACEGIK and NPRTVXZ by replacing each letter one at a time from ACEGIK with a letter from NPRTVXZ. Also, do the same for BDFHJL and MOQSUWZ.
2x7x6x5x4x3x2x1=10800 Total 6 letter words with non-adjacent letters: 2546640

edwin hoffman - 3 years, 4 months ago

Log in to reply

First of all, we are looking at sets of letters, not words. Thus, A C E G I K ACEGIK and K I C A E G KICAEG count as the same solution. Instead of permutations, you would need combinations: there are 2 13 C 6 = 3432 2\cdot 13\mathrm{C}6 = 3432 solutions that consist entirely of "odd" or entirely of "even" letters-- your number 2 471 040 2\,471\,040 divided by 6 ! 6! .

Next, you are overlooking possibilities such as A D F I K M ADFIKM .

Arjen Vreugdenhil - 3 years, 4 months ago
Meneghin Mauro
Jan 6, 2018

A rude brute force way to find it out in Python :-)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
max = 26

def getRange(i, start):
  return range(start, max - 2*(5-i) + 1)

count = 0
for i1 in getRange(0, 1):
  for i2 in getRange(1, i1+2):
    for i3 in getRange(2, i2+2):
      for i4 in getRange(3, i3+2):
        for i5 in getRange(4, i4+2):
          for i6 in getRange(5, i5+2):
            count += 1
print(count)

### result: 54264

Samuel Li
Jan 5, 2018

Let there be a row of 21 identical objects. Select 6 of them, then insert 5 more between adjacent pairs to ensure that none of the six are adjacent. Overlay the alphabet onto the row of 26 objects.

There are 21C6 ways of doing this, each of which corresponds to one set of valid letters.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...