Sujet : Re: exercise in double number arithmetic
De : mhx (at) *nospam* iae.nl (mhx)
Groupes : comp.lang.forthDate : 07. Jul 2024, 16:41:54
Autres entêtes
Organisation : novaBBS
Message-ID : <8da4b31b5cb3f13d9c296278d6821e6f@www.novabbs.com>
References : 1 2
User-Agent : Rocksolid Light
On Sun, 7 Jul 2024 11:24:35 (UTC),
albert@spenarnc.xs4all.nl wrote:
How many different ways can you choose 42 distinct objects, 21 at a
time? This is "n choose k" or the binomial coefficent.
>
Please show your code.
[..]
2 \ For N M return "N OVER M " (N/M)
3 : CHS >R R@ - 1 R> 1+ 1 ?DO OVER I + I */ LOOP NIP ;
[..]
Really great!
FORTH> 42 21 CHS . 538257874440 ok
FORTH> 66 33 CHS . 7219428434016265740 ok
FORTH> 68 34 CHS . ( ... )
-marcel