Path: ...!3.eu.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: vallor Newsgroups: comp.os.linux.advocacy Subject: Re: C Non-Programming Non-Challenge Date: 17 Jun 2024 00:04:56 GMT Lines: 42 Message-ID: References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com> <17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com> <666f2f33$0$3102233$882e4bbb@reader.netnews.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net ay8uYj5Hlvb1e2Bru61g+Q7IjRA6aC+jd+Wwb3FJGK+INb+8/j Cancel-Lock: sha1:W4hGs4MJYsmVGczdXCEuoI+24Dk= sha256:coYEyTvzSk7qGL82HLaoZ5Om3Dk/0F/z5AQX7Cr/GBY= X-Face: +McU)#<-H?9lTb(Th!zR`EpVrp<0)1p5CmPu.kOscy8LRp_\u`:tW;dxPo./(fCl CaKku`)]}.V/"6rISCIDP` User-Agent: Pan/0.159 (Vovchansk; 764d7cd; Linux-6.9.4) Bytes: 2252 > On 6/16/2024 4:19 AM, vallor wrote: >>> On Jun 15, 2024 at 3:20:19 PM EDT, "Farley Flud" >>> wrote: >>> >>>> On Sat, 15 Jun 2024 14:29:04 +0000, Farley Flud wrote: >>>> >>>> >>>>> Write a C program to compute the subfactorial of an integer N. >>>>> >>>>> >>>> Nobody got it (as predicted). >>> >>> Because no one bothered. >> >> I actually took the opportunity to install the GMP documentation on my >> system, look up what a "subfactorial" is, and do an implementation that >> works for !N where N is 0 through 50. > > Where's your code? https://github.com/vallor/subfactorial/ $ ./try_mpz 0:1 1:0 2:1 3:2 4:9 5:44 6:265 7:1,854 [...] 48:4,566,824,330,931,624,695,767,452,273,778,667,071,025,042,534,230,906,772,538,913 49:223,774,392,215,649,610,092,605,161,415,154,686,480,227,084,177,314,431,854,406,736 50:11,188,719,610,782,480,504,630,258,070,757,734,324,011,354,208,865,721,592,720,336,801 (I wrote a function to format the numbers.) -- -v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti OS: Linux 6.9.4 Release: Mint 21.3 Mem: 258G "I don't eat snails... I prefer FAST food!"