# Maths question re. factorials

**URL:** <https://boards.straightdope.com/t/maths-question-re-factorials/625129>\
**Category:** Factual Questions\
**Created:** [June 14, 2012, 1:19pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129 "2012-06-14T13:19:00Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wallenstein](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@Wallenstein](https://boards.straightdope.com/u/Wallenstein)\
**Post date:** [June 14, 2012, 1:19pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/1 "2012-06-14T13:19:00Z")

</div>

If I have a database field with three characters - XXX - what’s the total possible permutations if I use an alphanumeric naming convention?

e.g. 001, 002, AB3, AB4

Is it as straight-forward as 36 x 36 x 36 = 46,656? 😕

(Assume only uppercase letters).

---

<div class="post-metadata">

**Author:** ![erislover](https://avatars.discourse-cdn.com/v4/letter/e/71e660/32.png) [@erislover](https://boards.straightdope.com/u/erislover)\
**Post date:** [June 14, 2012, 1:28pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/2 "2012-06-14T13:28:48Z")

</div>

36[sup]3[/sup]

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [June 14, 2012, 1:39pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/3 "2012-06-14T13:39:25Z")

</div>

> [@Wallenstein](#):
>
> If I have a database field with three characters - XXX - what’s the total possible permutations if I use an alphanumeric naming convention?
> 
> e.g. 001, 002, AB3, AB4
> 
> Is it as straight-forward as 36 x 36 x 36 = 46,656? 😕
> 
> (Assume only uppercase letters).

Yep. It’s not a factorial, though, it’s a permutation.

---

<div class="post-metadata">

**Author:** ![Chessic\_Sense](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Chessic\_Sense](https://boards.straightdope.com/u/Chessic_Sense)\
**Post date:** [June 14, 2012, 1:39pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/4 "2012-06-14T13:39:56Z")

</div>

> [@Wallenstein](#):
>
> Is it as straight-forward as 36 x 36 x 36 = 46,656?

Yes.

---

<div class="post-metadata">

**Author:** ![erislover](https://avatars.discourse-cdn.com/v4/letter/e/71e660/32.png) [@erislover](https://boards.straightdope.com/u/erislover)\
**Post date:** [June 14, 2012, 1:41pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/5 "2012-06-14T13:41:09Z")

</div>

> [@Wallenstein](#):
>
> If I have a database field with three characters - XXX - what’s the total possible permutations if I use an alphanumeric naming convention?
> 
> e.g. 001, 002, AB3, AB4

To elaborate a bit, you’re just writing numbers in base 36. **If you exclude 000** as you did in your example then there are 36[sup]3[/sup]-1.

---

<div class="post-metadata">

**Author:** ![Wallenstein](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@Wallenstein](https://boards.straightdope.com/u/Wallenstein)\
**Post date:** [June 14, 2012, 1:42pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/6 "2012-06-14T13:42:45Z")

</div>

Thanks all 🙂

---

<div class="post-metadata">

**Author:** ![UncleRojelio](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/unclerojelio/32/3160_2.png) [@UncleRojelio](https://boards.straightdope.com/u/UncleRojelio)\
**Post date:** [June 14, 2012, 1:47pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/7 "2012-06-14T13:47:35Z")

</div>

If you wanted to use each character only once then there would be some factorials in the equation

36!/35!

---

<div class="post-metadata">

**Author:** ![yearofglad](https://avatars.discourse-cdn.com/v4/letter/y/b782af/32.png) [@yearofglad](https://boards.straightdope.com/u/yearofglad)\
**Post date:** [June 14, 2012, 1:59pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/8 "2012-06-14T13:59:29Z")

</div>

> [@UncleRojelio](#):
>
> If you wanted to use each character only once then there would be some factorials in the equation
> 
> 36!/35!

36!/35! = 36, which isn’t correct. Without repeating characters, the total number of permutations would be:

36 × 35 × 34

OR

36!/(36 - 3)!

---

<div class="post-metadata">

**Author:** ![MikeS](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@MikeS](https://boards.straightdope.com/u/MikeS)\
**Post date:** [June 14, 2012, 2:10pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/9 "2012-06-14T14:10:00Z")

</div>

> [@UncleRojelio](#):
>
> If you wanted to use each character only once then there would be some factorials in the equation
> 
> 36!/35!

If I’m not mistaken, that should be 36!/33!.

ETA: See, that’s what happens when you open a thread in a tab and then read something else for 15 minutes.

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [June 14, 2012, 2:31pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/10 "2012-06-14T14:31:01Z")

</div>

The examples given in the OP suggest the addition unstated constraint that the three characters be in alphanumeric order.

---

<div class="post-metadata">

**Author:** ![Great\_Antibob](https://avatars.discourse-cdn.com/v4/letter/g/e47c2d/32.png) [@Great\_Antibob](https://boards.straightdope.com/u/Great_Antibob)\
**Post date:** [June 14, 2012, 2:42pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/11 "2012-06-14T14:42:27Z")

</div>

> [@friedo](#):
>
> Yep. It’s not a factorial, though, it’s a permutation.

It’s not a permutation, either, at least as defined by mathematicians.

I’m not sure if there’s a commonly accepted term for it, but it’s the result of a Cartesian product {0-9,A-Z} X {0-9,A-Z} X {0-9,A-Z}. And it’s related to the counting principle.

If each character was only used once, then, yes, it would be a mathematical permutation of 36 alphanumeric characters taken 3 at a time.

The formula for that would be:

P(n,r) = n! / (n-r)!

In this case, the 36! / (36 - 3)! = 36!/33! that was mentioned earlier.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [June 14, 2012, 2:48pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/12 "2012-06-14T14:48:27Z")

</div>

> [@Great\_Antibob](#):
>
> It’s not a permutation, either, at least as defined by mathematicians.
> 
> I’m not sure if there’s a commonly accepted term for it, but it’s the result of a Cartesian product {0-9,A-Z} X {0-9,A-Z} X {0-9,A-Z}. And it’s related to the counting principle.

It’s a permutation with repetitions.

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [June 14, 2012, 3:22pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/13 "2012-06-14T15:22:56Z")

</div>

> [@Ximenean](#):
>
> The examples given in the OP suggest the addition unstated constraint that the three characters be in alphanumeric order.

In which case I think it is the sum of triangular numbers, which is n(n+1)(n+2)/6 . In this case, 8,436.

---

<div class="post-metadata">

**Author:** ![Wallenstein](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@Wallenstein](https://boards.straightdope.com/u/Wallenstein)\
**Post date:** [June 14, 2012, 4:40pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/14 "2012-06-14T16:40:53Z")

</div>

Slightly over my head at this point chaps, but it’s interesting stuff!

But to clarify… there’s no constraint in my particular case that the items be in alphanumeric order. So TA1 is valid, as is 93B etc.

---

<div class="post-metadata">

**Author:** ![UncleRojelio](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/unclerojelio/32/3160_2.png) [@UncleRojelio](https://boards.straightdope.com/u/UncleRojelio)\
**Post date:** [June 14, 2012, 4:47pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/15 "2012-06-14T16:47:55Z")

</div>

> [@yearofglad](#):
>
> 36!/35! = 36, which isn’t correct. Without repeating characters, the total number of permutations would be:
> 
> 36 × 35 × 34
> 
> OR
> 
> 36!/(36 - 3)!

Jeez, that’s what I get for posting before coffee.

---

<div class="post-metadata">

**Author:** ![Senegoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/senegoid/32/6606_2.png) [@Senegoid](https://boards.straightdope.com/u/Senegoid)\
**Post date:** [June 14, 2012, 10:03pm UTC](https://boards.straightdope.com/t/maths-question-re-factorials/625129/16 "2012-06-14T22:03:26Z")

</div>

> [@ultrafilter](#):
>
> It’s a permutation with repetitions.

I think it’s a “combinations” rather than a “permutations” problem. But yes, it’s with repetitions (more commonly called “replacement”): Combinations with replacement.

The logic of using the word “replacement” comes from the scenario where you are drawing various colored marbles from an urn (in elementary stat and probability, it’s always an “urn”), replacing each marble before the next draw, so that the same marble could be chosen again.

ETA: I partially take that back. It’s a permutations problem.  
“With replacement” means the same letter or digit can appear more than once, e.g., ATA.  
“Permutations” means the same letters in a different order count as a different result: ATZ is distinctly different from TZA or ZAT, and these would all count as separate possibilities.  
“Combinations” means that the same letters in differing orders would all be counted as the same result: ATZ, TZA, ZAT would all count as just one result.
