help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: puzzle with string permutations [photo]


From: Emanuel Berg
Subject: Re: puzzle with string permutations [photo]
Date: Tue, 07 Jun 2022 16:18:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> to do it without counting I think the formula is
>
>   n!/(n - r)!
>
> where n is the size of the set - here 26, as
>
>   (length (alphabet t)) ; 26
>
> and r is the number of items to be picked and arranged, or
> here the length of the word.

It doesn't work exactly like that with strings, since for
example the scrambled word "ogod" is actually, here, treated
as

  o_1 g o_2 d

Yet the words

  g o_1 o_2 d 
  g o_2 o_1 d

are duplicates.

So the n, the set or alphabet is A = { d g o }

Yet it's stipulated that o, and only o, must be used twice!

Maybe there is a formula for that as well! Divide by 2 for all
chars that appear twice? But then how to generalize so it
scales for chars that appear thrice and so on?

The truth is out there ...

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]