From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: puzzle with string permutations [photo]
Date: Wed, 08 Jun 2022 00:04:16 +0200 [thread overview]
Message-ID: <87h74wm8pr.fsf@dataswamp.org> (raw)
In-Reply-To: CAP_d_8VLm23PzuHE6L+D_4ZQotQzKM_RKmxY53v57wctChZ7_w@mail.gmail.com
Yuri Khan wrote:
> This extension of the concept of sets is called a multiset
> or a bag. For each element, we also have a multiplicity.
> Let’s write it as {o:2, g:1, d:1}.
OK, cool!
> n_perm = (n_1 + ... + n_k)! / (n_1)! ... (n_k)!
Right, that's tedious to do programming of tho (but possible
of course) because of the expanding summation and
product ...
> This problem was part of my exam in maths when I was
> applying at Novosibirsk State University, Mechanics & Maths
> Department, in 1997.
:)
> You might also notice the formula is similar to that of
> a binomial coefficient: C_{n,k} = n! / k! (n-k)!. That's
> no coincidence.
That OTOH is easy to implement, but what is n and k exactly? Can you
use that here?
(defun binom (n k)
(/ (cl-faculty n)
(* (cl-faculty k)
(cl-faculty (- n k)) )))
--
underground experts united
https://dataswamp.org/~incal
next prev parent reply other threads:[~2022-06-07 22:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 6:39 puzzle with string permutations [photo] Emanuel Berg
2022-06-07 7:12 ` Marcin Borkowski
2022-06-07 7:54 ` Emanuel Berg
2022-06-07 7:58 ` Emanuel Berg
2022-06-07 8:08 ` Emanuel Berg
2022-06-07 13:53 ` Emanuel Berg
2022-06-07 14:18 ` Emanuel Berg
2022-06-07 16:09 ` Yuri Khan
2022-06-07 22:04 ` Emanuel Berg [this message]
2022-06-08 0:17 ` Emanuel Berg
2022-06-08 2:52 ` missing Lisp world (was: Re: puzzle with string permutations [photo]) Emanuel Berg
2022-06-07 8:37 ` puzzle with string permutations [photo] Emanuel Berg
2022-06-07 13:28 ` Emanuel Berg
2022-08-01 6:39 ` Marcin Borkowski
2022-08-01 7:39 ` Emanuel Berg
2022-08-02 12:21 ` Jean Louis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h74wm8pr.fsf@dataswamp.org \
--to=incal@dataswamp.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).