 # Behind The Times joe shmo Posers and Puzzles 06 Apr '21 14:14
1. 06 Apr '21 14:141 edit
If we randomly mix up the letters of

HAPPYEASTER

What is the probability that the scramble results in the A next to the A, the E next to E and the P next to the P?
2. 06 Apr '21 14:491 edit
The probability that I could solve this is Zero (0).

The probability that I would work to solve this if I could do so is Zero (0).

The probability that there is some meaningful purpose to solving this is, by me, unknown; however, the probability of my caring about the answer to this is Zero (0).

Now, I'm guessing that one only needs to count the groupings of all the AA, EE, and PP combinations, of which I think there are three and then calculate the permutations of randomizing all the other letters as though they were just distinct items (n), and then finally . . . oops . . . forget it. It gets complicated here, right?
3. 06 Apr '21 15:014 edits
@coquette said
The probability that I could solve this is Zero (0).

The probability that I would work to solve this if I could do so is Zero (0).

The probability that there is some meaningful purpose to solving this is, by me, unknown; however, the probability of my caring about the answer to this is Zero (0).

Now, I'm guessing that one only needs to count the groupings of all the ...[text shortened]... distinct items (n), and then finally . . . oops . . . forget it. It gets complicated here, right?
The probability that I will waste my time telling you "you are wrong"...Probably...I think...I cant be sure because you really didn't actually try to answer?

apparently its 1
4. 06 Apr '21 19:55
@joe-shmo said
If we randomly mix up the letters of

HAPPYEASTER

What is the probability that the scramble results in the A next to the A, the E next to E and the P next to the P?
If a is selected the chances of the other a next is 1/11
The chances of the other a not being next is 1/9
The same for the e and p so the calculation is (1/11*1/9)*3 =.03.
5. 06 Apr '21 20:10
@venda said
If a is selected the chances of the other a next is 1/11
The chances of the other a not being next is 1/9
The same for the e and p so the calculation is (1/11*1/9)*3 =.03.
Sorry Venda...Try again
6. 07 Apr '21 12:43
@joe-shmo
Ok, Is it that I've just miscounted or is the principal wrong?
(1/10)*(1/8)*3 =.0375
7. 07 Apr '21 13:284 edits
@venda said
@joe-shmo
Ok, Is it that I've just miscounted or is the principal wrong?
(1/10)*(1/8)*3 =.0375
I think the principal is wrong.

Hint:
You are going to need to figure out the number of ways the A, E and P can be put into the string when grouped as AA,EE,PP. AASPPHYTEER is one such way. The next [easier step in my opinion] is to count ALL possible strings. I am asking for the ratio of these two counts
8. 08 Apr '21 03:501 edit
My program gives 322560/39916800 = 0.008 08 ...
[Execution time = 11.3s, for the curious.]

I am having trouble producing the same via math. 🙂
9. 08 Apr '21 04:321 edit
OK, I think I have the math now.

Either that, or I got the same wrong answer both ways, LOL.

=================================================================

The string "HAPPYEASTER" is 11 characters long.

Consider ONLY the ways that the pairs can appear in the order: 'AA', 'EE', 'PP'.

If we put the first two pairs at the very beginning, we have:
AAEE XXXX XXX
There are 6 ways to add 'PP'.
If the 'EE' was one position to the right, there would only be 5 ways to add 'PP', and so on.
For all "AAXX XXXX XXX", there are 6+5+4+3+2+1 = 21 ways to add the other letters.

If we started instead with:
XAAX XXXX XXX
By the same logic, there would by 5+4+3+2+1 = 15 ways to add the other letters.

Continuing to push AA to the right, there are 56 total ways to arrange the three pairs, in the prescribed order.

Multiply that by 8, to account for duplicate combinations of each pair. (Treating each letter as unique, P1 P2 gives the same word as P2 P1, etc.)

Multiply that by a further 6, because there are six different orderings of the three pairs.

This gives 2688 ways to arrange the pairs.

But wait! Don't forget the five other letters.

So we're up to 2688 * 5! ways.

I'm not going to multiply that because it's too ugly. Instead, I will simply note that the total number of letter arrangements is:

11!

So the odds of getting an arrangements with the three pairs together is:

2688 * 5! / 11! = 2688 / (11*10*9*8*7*6) = 2688 / 332640 = 0.00808080
10. 08 Apr '21 08:141 edit
@bigdoggproblem said
My program gives 322560/39916800 = 0.008 08 ...
[Execution time = 11.3s, for the curious.]

I am having trouble producing the same via math. 🙂
My only curiosity is where do you get your programme from?
If you have made it yourself well done.
I would like a copy!
I also got some enormous numbers when I tried the combinations method.
As to the answer,I expect you're correct as usual.
I tried it a different way but got bogged down (as usual!!)
There are 4 distinct groups AA EE PP and YTRSH
It doesn't matter how they are arranged within the groups or where the groups appear in the complete sequence.
So 3/4 = .75
Then we come to if the pairs AA EE PP are split.
Not having a programme!,I tried it "longhand" first for the A's split and the EE and PP together.
I concluded that the A's could occupy 25 positions in the sequence (positions 1,3 1,4 etc through to 5,9)EE PP A YTRSHA for 3 ,9 for example.
I then got to wondering if this could be applied similarly to the E's and P's so the answer could be (3/4 )/(9/25)*3 or something.
This will be wrong, but it all helps to keep ones mind active!!
11. 08 Apr '21 17:041 edit
@bigdoggproblem said
OK, I think I have the math now.

Either that, or I got the same wrong answer both ways, LOL.

=================================================================

The string "HAPPYEASTER" is 11 characters long.

Consider ONLY the ways that the pairs can appear in the order: 'AA', 'EE', 'PP'.

If we put the first two pairs at the very beginning, we have:
AAEE ...[text shortened]... he three pairs together is:

2688 * 5! / 11! = 2688 / (11*10*9*8*7*6) = 2688 / 332640 = 0.00808080
Good work!

We can treat the doubled letters as single units:

AA, PP, EE, H, R, S, T, Y

There are 8! ways to arrange these units.

The number of distinct arrangements of the 11 letters taken when not necessarily grouped:

C(11,2)*C(9,2)*C(7,2)*5! = 55*36*21*5!

P = 8*7*6 / ( 55*36*21 ) = 4/495

P.S. I do have reservations about saying the ways of rearranging the letters is 11! as you have. That's only the case if they are ALL distinct, which they are not. All joking aside, you have actually seemed to make the same error in the numerator as the denominator, it works out here because we are looking at the ratio.
12. 08 Apr '21 17:071 edit
Lets try another:

How many distinct strings can be made such that only two sets of the doubled letters are next to each other?

Example of desired outcome:

HPAASTREEPY
13. 08 Apr '21 18:52
@joe-shmo said
Lets try another:

How many distinct strings can be made such that only two sets of the doubled letters are next to each other?

Example of desired outcome:

HPAASTREEPY
O.k Joe,I am really fascinated by how these things are done but (only)if you have the time and patience could you one day explain in simple terms where some of the numbers come from. A pm will do if you don't want to clutter up the thread.
I get the 11!
I get the 8!
I get the 5!
Where I get lost is the (9,2) (7,2) and the 8! 7! 6!
14. 08 Apr '21 19:26
@venda said
My only curiosity is where do you get your programme from?
If you have made it yourself well done.
I would like a copy!
I also got some enormous numbers when I tried the combinations method.
As to the answer,I expect you're correct as usual.
I tried it a different way but got bogged down (as usual!!)
There are 4 distinct groups AA EE PP and YTRSH
It doesn't matter how t ...[text shortened]... ld be (3/4 )/(9/25)*3 or something.
This will be wrong, but it all helps to keep ones mind active!!
Yes, I wrote a program to solve this problem.

I am not sure how I want to share it. It's written in Python. I would post the code here, but RHP removes the spacing.
15. 08 Apr '21 19:29
@joe-shmo said
Good work!

We can treat the doubled letters as single units:

AA, PP, EE, H, R, S, T, Y

There are 8! ways to arrange these units.

The number of distinct arrangements of the 11 letters taken when not necessarily grouped:

C(11,2)*C(9,2)*C(7,2)*5! = 55*36*21*5!

P = 8*7*6 / ( 55*36*21 ) = 4/495

P.S. I do have reservations about saying the ways of rearrangi ...[text shortened]... me error in the numerator as the denominator, it works out here because we are looking at the ratio.
But is it really an error, if I noticed it was happening and adjusted for it?

Your way is more elegant. I just didn't want to break that 11! apart, for some reason.