Consider all the possible arrangements of the letters in the term "ALLSTARS." How many do not have two same letters next to each other?
The total arrangements is 8!, but the total arrangements where there are 2 same letters next to one another is 7! * 3, since it is 7! for each letter, A, L, and S. Then, there are 6! * 3 scenarios where two of the same letters are next to one another, either A and L, A and S, or L and S. Then, there are 5! arrangements where all letters are next to the other same letter. We then subtract everything, giving us 8! - (7!*3) - (6!*3) - 5!, or 22920.
There are in total
\(\frac{8!}{2!2!}\) total arrangements of letters
considering arrangements of letter where the two 'L's are right next to each other, we have
\(\frac{7!}{2!}\) total arrangements
and we have the same amounts of arrangements for the two 'S's being rigth next to each other
So therefore, we have
\(\frac{8!}{2!2!} - 2 * \frac{7!}{2!} + 6!\) because we overcount a bit
so the answer is \(\fbox{4760}\)
cycle:c=if((a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[l] and a[l]!=a[m] and a[m]!=a[n] and a[n]!=a[r] and a[r]!=a[s]), goto end, goto next);end:print(a[i],a[j],a[k],a[l],a[m],a[n],a[r],a[s]),", ",;p=p+1;next:i=i+8;j=i+1;k=j+1;l=k+1;m=l+1;n=m+1;r=n+1;s=r+1;if(s< count a, goto cycle, 0);
;print">Total =", p
This computer code gives a total of: 2,220 permutations, where no 2 of the same letters are next to each other.
By the way, there are: 8! / 2!2!2! =5,040 permutations in total.
Edit: Guest who posted
cycle:c=if((a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[l] and a[l]!=a[m] and a[m]!=a[n] and a[n]!=a[r] and a[r]!=a[s]), goto end, goto next);end:print(a[i],a[j],a[k],a[l],a[m],a[n],a[r],a[s]),", ",;p=p+1;next:i=i+8;j=i+1;k=j+1;l=k+1;m=l+1;n=m+1;r=n+1;s=r+1;if(s< count a, goto cycle, 0);
;print">Total =", p
was correct!