7 non-repeating (distinct) letters on a scrabble rack can be arranged in 5,040 ways.
For example, ABCDEFG = 7! arrangements. Each arrangement represents one unique word.

A blank tile can represent any single letter A to Z so that if we have 6 distinct letters + 1 blank tile:
ABCDEF? we get 115,920 unique words.

Using brute-force word generation I got these word counts for the following 7 racks:
?=26 A?=51 AB?=150 ABC?=588 ABCD?=2,880 ABCDE?=16,920 ABCDEF?=115,920

Case 1
I wanted to know the formula that calculates the unique word count w for the 7
racks above in terms of one blank tile b and (n-b) distinct letters. Rephrasing,
how many unique words w can we make if we have a rack with 0 or more distinct letters + 1 blank tile.

Solution:
n varies from 1 to 7, b = 1
One blank tile can be any one of the 26 alphabet letters,
n = number of distinct letters + 1 blank
b = number of blanks
w = number of distinct words

/

(n - b)

\

w =

n!

(26 -

--------

) formula 1

\

(b+1)!

/


Example:

/

(7 - 1)

\

w =

7!

(26 -

--------

) = 115,920 unique words

\

(2)!

/


Formula 1 gives the correct word count for each of the 7 racks above.

rack

w

n=1 b=1

?

26

n=2 b=1:

A?

51

n=3 b=1:

AB?

150

n=4 b=1:

ABC?

588

n=5 b=1:

ABCD?

2,880

n=6 b=1:

ABCDE?

16,920

n=7 b=1:

ABCDEF?

115,920

Case 2
Back to brute force unique word generation I got these results for racks with 2 blank tiles:

rack

w

expected w using formula 1

n=2 b=2:

??

676

52 WRONG

n=3 b=2:

A??

1,951

155 WRONG

n=4 b=2:

AB??

7,502

616 WRONG

n=5 b=2:

ABC??

36,030

3,060 WRONG

n=6 b=2:

ABCD??

207,480

18,240 WRONG

n=7 b=2:

ABCDE??

Out of memory

126,840 WRONG


Obviously formula 1 does not work when we have 2 blank tiles and it looks like I'll
never know w for the last rack sequence. Formula 1 appears to be a special case
for a more general formula where b can be 0, 1 or 2

1st question: What is the general formula to calculate the w unique words
if we have a rack with 0 or more distinct letters + (0, 1 or 2 blank tiles)?

A blank tile can represent any single letter A to Z.
Distinct letters means a non repeating sequence like ABC not AAA, AAB, AAC ...CCC
Minimum rack length is 1 tile max is 7 tiles.

w = F(n,b) for any of these 20 racks:
where n = total number of tiles 1..7
b = total number of blank tiles 0..2
w = total unique words

n=1:

A

?

-

n=2:

AB

A?

??

n=3:

ABC

AB?

A??

n=4:

ABCD

ABC?

AB??

n=5:

ABCDE

ABCD?

ABC??

n=6:

ABCDEF

ABCDE?

ABCD??

n=7:

ABCDEFG

ABCDEF?

ABCDE??

2nd question: What is the complete general formula when the lettered tiles
may repeat and may be combined with 0, 1 or 2 blank tiles. 

If any of the lettered (non-blank) tiles do repeat then we must
divide n! by the product of factorial of the respective repeating letters.
ABBCCCD: w = n!/(1! 2! 3! 1!) = 5040/12 = 420

But that's as far as I can get.

Your assistance would be greatly appreciated.

Thanks


In reply to Scrabble word arrangements with blank tiles by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.