Sujet : Re: C Non-Programming Non-Challenge
De : vallor (at) *nospam* cultnix.org (vallor)
Groupes : comp.os.linux.advocacyDate : 17. Jun 2024, 02:04:56
Autres entêtes
Message-ID : <ld9ct8F8s0rU5@mid.individual.net>
References : 1 2 3 4 5
User-Agent : Pan/0.159 (Vovchansk; 764d7cd; Linux-6.9.4)
On 6/16/2024 4:19 AM, vallor wrote:
On Jun 15, 2024 at 3:20:19 PM EDT, "Farley Flud" <ff@linux.rocks>
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!"