Path: ...!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: mhx@iae.nl (mhx) Newsgroups: comp.lang.forth Subject: Re: exercise in double number arithmetic Date: Sun, 7 Jul 2024 15:41:54 +0000 Organization: novaBBS Message-ID: <8da4b31b5cb3f13d9c296278d6821e6f@www.novabbs.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: i2pn2.org; logging-data="2476935"; mail-complaints-to="usenet@i2pn2.org"; posting-account="t0bSWFIQDvYvkkhDiPIIv6byulC6WbSEwXWMJpxc4k0"; User-Agent: Rocksolid Light X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24 X-Rslight-Site: $2y$10$P/zdV.e79JJFRKCt8BkidufV0Ok0wdevhE7cMtG8t3fRkt5u5PSce X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 1414 Lines: 17 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