Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

How apt the poor are to be proud. -- William Shakespeare, "Twelfth-Night"


comp / comp.os.linux.advocacy / Re: C Programming Challenge

SubjectAuthor
* C Programming ChallengeFarley Flud
+* Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming Challenge)Tyrone
|`* Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming Challenge)Diego Garcia
| +- Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming Challenge)candycanearter07
| `- Re: Another Feeb Fail. Poseurs Indeed.DFS
+* Re: C Programming ChallengeChris Ahlstrom
|`- Re: C Programming ChallengeJoel
`* Re: C Programming ChallengeFarley Flud
 +* Re: C Programming ChallengeFarley Flud
 |`- Re: C Programming ChallengeStéphane CARPENTIER
 `* Re: C Non-Programming Non-Challenge (was: C Programming Challenge)Tyrone
  +* Re: C Non-Programming Non-Challenge (was: C Programming Challenge)vallor
  |+- Re: C Non-Programming Non-Challenge (was: C Programming Challenge)vallor
  |+- Re: C Non-Programming Non-Challenge (was: C Programming Challenge)Farley Flud
  |`* Re: C Non-Programming Non-ChallengeDFS
  | `* Re: C Non-Programming Non-Challengevallor
  |  +* Re: C Non-Programming Non-Challenge%
  |  |+* Re: C Non-Programming Non-Challengevallor
  |  ||`- Re: C Non-Programming Non-Challenge%
  |  |`* Fine. (was: Re: C Non-Programming Non-Challenge)vallor
  |  | `* Re: Fine. (was: Re: C Non-Programming Non-Challenge)Farley Flud
  |  |  `* Re: Fine. (was: Re: C Non-Programming Non-Challenge)Joel
  |  |   `* Re: Fine. (was: Re: C Non-Programming Non-Challenge)vallor
  |  |    `* Re: Fine. (was: Re: C Non-Programming Non-Challenge)Farley Flud
  |  |     +* Re: Fine. (was: Re: C Non-Programming Non-Challenge)vallor
  |  |     |+* Re: Fine.%
  |  |     ||`* Re: Fine.vallor
  |  |     || +* Re: Fine.Joel
  |  |     || |`* Re: Fine.%
  |  |     || | +* Re: Fine.vallor
  |  |     || | |+* Re: Fine.Joel
  |  |     || | ||+* Re: Fine.vallor
  |  |     || | |||`- Re: Fine.Chris Ahlstrom
  |  |     || | ||`* Re: Fine.DFS
  |  |     || | || +* Re: Fine.Joel
  |  |     || | || |`* Re: Fine.chrisv
  |  |     || | || | +* Re: Fine.Joel
  |  |     || | || | |`* Re: Fine.chrisv
  |  |     || | || | | `- Re: Fine.Joel
  |  |     || | || | `* Re: Fine.vallor
  |  |     || | || |  +* Re: Fine.%
  |  |     || | || |  |`* Re: Fine.Andrzej Matuch
  |  |     || | || |  | `- Re: Fine.Joel
  |  |     || | || |  `- Re: Fine.chrisv
  |  |     || | || `- Re: Fine.rbowman
  |  |     || | |+- Re: Fine.%
  |  |     || | |`- Re: Fine.Andrzej Matuch
  |  |     || | +* Re: Fine.Joel
  |  |     || | |`* Re: Fine.%
  |  |     || | | `* Re: Fine.vallor
  |  |     || | |  `* Re: Fine.%
  |  |     || | |   `* Re: Fine.vallor
  |  |     || | |    `* Re: Fine.%
  |  |     || | |     `- Re: Fine.%
  |  |     || | `* Re: Fine.Andrzej Matuch
  |  |     || |  +* Re: Fine.%
  |  |     || |  |`- Re: Fine.chrisv
  |  |     || |  +* Re: Fine.chrisv
  |  |     || |  |+- Re: Fine.Joel
  |  |     || |  |`- Re: Fine.Andrzej Matuch
  |  |     || |  `- Re: Fine.rbowman
  |  |     || +- Re: Fine.%
  |  |     || `* Re: Fine.DFS
  |  |     ||  +* Re: Fine.Andrzej Matuch
  |  |     ||  |`* Re: Fine.Chris Ahlstrom
  |  |     ||  | `- Re: Fine.Andrzej Matuch
  |  |     ||  `* Re: Fine.vallor
  |  |     ||   `- Re: Fine.chrisv
  |  |     |`* Re: Fine. (was: Re: C Non-Programming Non-Challenge)Farley Flud
  |  |     | `* Re: Fine.vallor
  |  |     |  `- Re: Fine.Chris Ahlstrom
  |  |     `- Re: Fine. (was: Re: C Non-Programming Non-Challenge)Stéphane CARPENTIER
  |  +* Re: C Non-Programming Non-ChallengeDFS
  |  |`- Re: C Non-Programming Non-Challengevallor
  |  +- Re: C Non-Programming Non-ChallengeFarley Flud
  |  `* Re: C Non-Programming Non-ChallengeDFS
  |   `* Re: C Non-Programming Non-Challengevallor
  |    +- Re: C Non-Programming Non-Challenge%
  |    +* Re: C Non-Programming Non-ChallengeFarley Flud
  |    |+- Re: C Non-Programming Non-ChallengeChris Ahlstrom
  |    |`* Re: C Non-Programming Non-Challengecandycanearter07
  |    | `* Re: C Non-Programming Non-ChallengeStéphane CARPENTIER
  |    |  `* Re: C Non-Programming Non-Challengecandycanearter07
  |    |   `- Re: C Non-Programming Non-ChallengeStéphane CARPENTIER
  |    +- [OT] Re: C Non-Programming Non-Challengevallor
  |    +* Re: C Non-Programming Non-Challengechrisv
  |    |`* Re: C Non-Programming Non-Challengerbowman
  |    | `- Re: C Non-Programming Non-Challengechrisv
  |    `- Re: C Non-Programming Non-Challengecandycanearter07
  `* Re: C Non-Programming Non-Challenge (was: C Programming Challenge)rbowman
   `- Re: C Non-Programming Non-ChallengeTyrone

Pages:1234
Subject: C Programming Challenge
From: Farley Flud
Newsgroups: comp.os.linux.advocacy
Organization: UsenetExpress - www.usenetexpress.com
Date: Sat, 15 Jun 2024 14:29 UTC
From: ff@linux.rocks (Farley Flud)
Subject: C Programming Challenge
Newsgroups: comp.os.linux.advocacy
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 33
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!panix!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Sat, 15 Jun 2024 14:29:04 +0000
Nntp-Posting-Date: Sat, 15 Jun 2024 14:29:04 +0000
X-Received-Bytes: 3560
X-Complaints-To: abuse@usenetexpress.com
Organization: UsenetExpress - www.usenetexpress.com
Message-Id: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
View all headers

Hey poseurs. We got one for you.

Write a C program to compute the subfactorial of an integer N.

Y'all have heard of a factorial. How 'bout a subfactorial?

Here is a sequence of subfactorials for N = {1 ... 23}:

https://oeis.org/A000166

Up to only 23???!!!

Sheesh! We can do better than than:

[~] ./subfact 100

34332795984163804765195977526776142032365783805375784983543400282685180793327632432791396429850988990237345920155783984828001486412574060553756854137069878601

Want more? Sure thing:

[~] ./subfact 1000

14803000037166908036391661411896605423778724677168346155469184608988881712223607118131898739105486754595907261891306739525659267393783595677224116822252829559568359672098066622060942783190488524202959939181458674649296321772234031777719557526036601005901065517214473828487886175820813100473503581847756936878643206163201618844680768591094032183257299664998148177225232519104008615442655465753845844453576571787103394661377170235030562526500432038824338609787926268308284687038595978195448895638997039257894428866045929503123450747873671688182413678362258453513880598228814528531570929204492468054921792979011598454501444152175573572630619545719977057269175466361778739141804356429129546354423234562381423409107524548165524061776819460080161337045457955036099046921494250558537193329579482073018245976548713930256766892643871330503507495009590818187572187062902844270418881793062808259576971164630971090271338957781392498508419548968760204661950200896096197933697120001184583297276649682042523230901442416038335254943258717580459951322429538762079323749213310619485478167533526424544336840634977862657715415393616579517641428024670820968425502109482342196679493125860192623788850206306117990892038912
24372800966941803187567295401877435229552876934033446271920081932431500479266831162067898087375203299321759266896310398013332052717730686941198866814394082086345366161621254849682464332990866189720387263201435245301591551228160672094793591589751046761756899429729095389819155186104380589668134545521358106176432683265088847400075630578125577568721198279481770124987200028465843200836028835056752239304157102409433831420876970912375704827813522561628095930489973076363690716903735444753347277222269644018381058041040336988590465080726362211212847672561792613846955758001267778719146087997403331351690780850403018707387007219860265183241445978545343939401105488747714567335488196900148911502998833745690361445040756502842471542911226022625777386345023944680666372606015155904126779976563721389884798926297873448554696259931889022153417439765913357861346124264844165570744850851379226488885571276189802041073412065174561117871776566686203971568747523655416897364591156339098482517035347569029493318500822966694103069801757199864821884463334464508239561580295442683950514237400428199863686124549042552063736848425988571362282393268539068601119113908474985451813508750353980668686219599738700364731082064
70890805125591766035651660263166256071859066523494404932873989243033885387310363168734739688132495065765084286985470381074859852651721482664917019227944750044815550686001

Now you try.

C only.

See y'all in 2632.

Ha, ha, ha, ha, ha, ha, ha, ha, ha, ha!

Subject: Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming Challenge)
From: Tyrone
Newsgroups: comp.os.linux.advocacy
Date: Sat, 15 Jun 2024 17:13 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 15 Jun 2024 17:13:10 +0000
From: none@none.none (Tyrone)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming Challenge)
X-No-Archive: Yes
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
User-Agent: Usenapp for MacOS
X-Usenapp: v1.27.4/l - Full License
Message-ID: <ZFOdnXz5Oao7VvD7nZ2dnZfqnPWdnZ2d@supernews.com>
Date: Sat, 15 Jun 2024 17:13:10 +0000
Lines: 17
X-Trace: sv3-Z6byEhpEfISVX+ceJPmRNgfGovVEzM6w7+EYwrytpOT/2+IdWfOpVVW22tP8SYOKB8dKdM7ajVoyK8L!NbQgeDYIV6SFVTrDkKe+3l1vnFT/C3bG3ZfiI6I60Ii1csehxcxe4J70OxInietWPhVmuGd9jB1v!jRIUlYHOZCA=
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

On Jun 15, 2024 at 10:29:04 AM EDT, "Farley Flud" <ff@linux.rocks> wrote:

> Hey poseurs. We got one for you.
>
> Write a C program to compute the subfactorial of an integer N.

Why don't you come up with something original? All of these trivial math
problems have already been solved. Millions of times. A simple search will
bring up the code. Which is undoubtedly how you did it.

AGAIN, there is SO much more to programming than "solving" math problems that
no longer need to be "solved". The fact that all you do is "solve math
problems" proves how clueless you are about programming.

"Look at me. My computer can do math!" Whoopee! SO impressive.

What's next from you? "Write a C Program to Display the Fibonacci Sequence"?

Subject: Re: C Programming Challenge
From: Chris Ahlstrom
Newsgroups: comp.os.linux.advocacy
Organization: None
Date: Sat, 15 Jun 2024 18:34 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: OFeem1987@teleworm.us (Chris Ahlstrom)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Programming Challenge
Date: Sat, 15 Jun 2024 14:34:29 -0400
Organization: None
Lines: 9
Message-ID: <v4kmrl$3j8d6$1@dont-email.me>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
Reply-To: OFeem1987@teleworm.us
Injection-Date: Sat, 15 Jun 2024 20:34:30 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="17eeaceed6d1bcb6e85bb909cc8fc549";
logging-data="3776934"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UKoaSXZz3QUsHPzUePcg7"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:DDIRn2Niye2Al3d4XBR3Id/sRHY=
X-Mutt: The most widely-used MUA
X-Slrn: Why use anything else?
X-User-Agent: Microsoft Outl00k, Usenet K00k Editions
View all headers

Farley Flud wrote this copyrighted missive and expects royalties:

> <junksnip>

I got bigger fish to fry.

--
As flies to wanton boys are we to the gods; they kill us for their sport.
-- Shakespeare, "King Lear"

Subject: Re: C Programming Challenge
From: Farley Flud
Newsgroups: comp.os.linux.advocacy
Organization: UsenetExpress - www.usenetexpress.com
Date: Sat, 15 Jun 2024 19:20 UTC
References: 1
From: ff@linux.rocks (Farley Flud)
Subject: Re: C Programming Challenge
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 132
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Sat, 15 Jun 2024 19:20:19 +0000
Nntp-Posting-Date: Sat, 15 Jun 2024 19:20:19 +0000
X-Received-Bytes: 3896
Organization: UsenetExpress - www.usenetexpress.com
X-Complaints-To: abuse@usenetexpress.com
Message-Id: <17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
View all headers

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).

The code is posted below.

We use the GNU Multi-Precision library (GMP) to compute for N of
any size up to ULONG_MAX. The subfactorial of ULONG_MAX could not
be stored in even the top supercomputer memory.

GMP is the absolute best mp library on planet Earth and that's
why it's used by all top software. Without GMP, Microslop would
be dead in the fucking water.

Dynamic programming is utilized for the best speed/storage.

As an extra, the ratio subfactorial/factorial is also calculated
as this should quickly converge to 0.367879...

=========================
Begin GMP Code
=========================

// ./subfact N
// don't attempt ./subfact ULONG_MAX, you'll break your machine
// but if anyone has a terabyte or so of ram then report run time
// this code should beat anything else anywhere

#include <stdlib.h>
#include <stdio.h>
#include <gmp.h>

int main(int argc, char **argv)
{

unsigned long int n, i;
double ratio;
mpz_t subfact, p1, p2, curr, fact;
mpq_t dvd, div;

mpz_inits(subfact, p1, p2, curr, fact, NULL);
mpq_inits(dvd, div, NULL);

n = atol(argv[1]);
mpz_set_str(p2, "1", 10);

// we ignore N = 1, 2 as they are trivial

for (i = 3L; i <= n; ++i) {
mpz_add(curr, p1, p2);
mpz_mul_ui(curr, curr, (i - 1L));
mpz_set(p1, p2);
mpz_set(p2, curr);
}
mpz_set(subfact, p2);

mpz_out_str(stdout, 10, subfact);
putchar('\n');

// Extra:
// for probability calcs we determine the factorial
// and then the ratio subfact/fact

mpz_fac_ui(fact, n);
mpq_set_z(div, fact); mpq_set_z(dvd, subfact);
mpq_div(dvd, dvd, div);
ratio = mpq_get_d(dvd);
fprintf(stdout, "Ratio to fact: %g\n", ratio);

return 0;

}

===================
End
===================

Subfactorials for 3 - 50

2
9 44
265
1854
14833
133496
1334961
14684570
176214841
2290792932
32071101049
481066515734
7697064251745
130850092279664
2355301661033953
44750731559645106
895014631192902121
18795307255050944540
413496759611120779881
9510425471055777937262
228250211305338670494289
5706255282633466762357224
148362637348470135821287825
4005791208408693667174771274
112162153835443422680893595673
3252702461227859257745914274516
97581073836835777732377428235481
3025013288941909109703700275299910
96800425246141091510518408809597121
3194414033122656019847107490716704992
108610077126170304674801654684367969729
3801352699415960663618057913952878940514
136848697178974583890250084902303641858505
5063401795622059603939253141385234748764684
192409268233638264949691619372638920453057993
7503961461111892333037973155532917897669261726
300158458444475693321518926221316715906770469041
12306496796223503426182275975073985352177589230680
22225533213979647187685190410983617546032726150608122
22225533213979647187685190410983617546032726150608122
977923461415104476258148378083279172025439950626757369
44006555763679701431616677013747562741144797778204081604
2024301565129266265854367142632387886092660697797387753785
95142173561075514495155255703722230646355052796477224427894
4566824330931624695767452273778667071025042534230906772538913
223774392215649610092605161415154686480227084177314431854406736
11188719610782480504630258070757734324011354208865721592720336801

Subject: Re: C Programming Challenge
From: Joel
Newsgroups: comp.os.linux.advocacy
Date: Sat, 15 Jun 2024 19:21 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-3.nntp.ord.giganews.com!nntp.giganews.com!news-out.netnews.com!postmaster.netnews.com!us11.netnews.com!not-for-mail
X-Trace: DXC=V\S?\:lLae_2BFZQ=P]QnYHWonT5<]0T]djI?Uho:Xe[lL51CP6LDL\95GMl]75=8QTbWEAa^@:KP7@<I4Rf8bAQl3[[dIf;_mV2Do^b@=QS7W
X-Complaints-To: support@blocknews.net
From: joelcrump@gmail.com (Joel)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Programming Challenge
Date: Sat, 15 Jun 2024 15:21:06 -0400
Message-ID: <7cqr6jp37l3a0apknmmis5tcngjg45sv4a@4ax.com>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com> <v4kmrl$3j8d6$1@dont-email.me>
User-Agent: ForteAgent/8.00.32.1272
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
OS: Linux Mint 21.3 Cinnamon, with Wine 9.0 for WinAPI
Lines: 26
NNTP-Posting-Host: 127.0.0.1
X-Trace: 1718479266 reader.netnews.com 2363140 127.0.0.1:53997
View all headers

Chris Ahlstrom <OFeem1987@teleworm.us> wrote:
>Farley Flud wrote this copyrighted missive and expects royalties:
>
>> <junksnip>
>
>I got bigger fish to fry.

Yeah, how does some obscure "challenge" like that advocate an
operating system? Just retarded.

--
Joel W. Crump

Amendment XIV
Section 1.

[...] No state shall make or enforce any law which shall
abridge the privileges or immunities of citizens of the
United States; nor shall any state deprive any person of
life, liberty, or property, without due process of law;
nor deny to any person within its jurisdiction the equal
protection of the laws.

Dobbs rewrites this, it is invalid precedent. States are
liable for denying needed abortions, e.g. TX.

Subject: Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming Challenge)
From: Diego Garcia
Newsgroups: comp.os.linux.advocacy
Organization: UsenetExpress - www.usenetexpress.com
Date: Sat, 15 Jun 2024 19:57 UTC
References: 1 2
From: dg@chaos.rocks (Diego Garcia)
Subject: Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming Challenge)
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com> <ZFOdnXz5Oao7VvD7nZ2dnZfqnPWdnZ2d@supernews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 23
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Sat, 15 Jun 2024 19:57:52 +0000
Nntp-Posting-Date: Sat, 15 Jun 2024 19:57:52 +0000
X-Received-Bytes: 1154
X-Complaints-To: abuse@usenetexpress.com
Organization: UsenetExpress - www.usenetexpress.com
Message-Id: <17d945cb55739b19$393584$1616079$802601b3@news.usenetexpress.com>
View all headers

On Sat, 15 Jun 2024 17:13:10 +0000, Tyrone wrote:

>
> AGAIN, there is SO much more to programming than "solving" math
>

Totally incorrect.

ALL programming is reducible to mathematics.

YOU just cannot understand this basic fact because your pathetic indoctrination
to programming has occurred through multi-layers of obscuring abstractions.

You should thank the gods for such abstractions, otherwise you'd be begging
on the streets.

Ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha!

Question: Why is Rust so popular?

Answer: Because it saves all the incompetent idiots who cannot adequately
wield C.

Subject: Re: C Programming Challenge
From: Farley Flud
Newsgroups: comp.os.linux.advocacy
Organization: UsenetExpress - www.usenetexpress.com
Date: Sat, 15 Jun 2024 22:22 UTC
References: 1 2
From: ff@linux.rocks (Farley Flud)
Subject: Re: C Programming Challenge
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com> <17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 33
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!panix!weretis.net!feeder9.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Sat, 15 Jun 2024 22:22:06 +0000
Nntp-Posting-Date: Sat, 15 Jun 2024 22:22:06 +0000
X-Received-Bytes: 1419
Organization: UsenetExpress - www.usenetexpress.com
X-Complaints-To: abuse@usenetexpress.com
Message-Id: <17d94daa55b80d53$191120$273357$802601b3@news.usenetexpress.com>
View all headers

On Sat, 15 Jun 2024 19:20:19 +0000, 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).
>
> The code is posted below.
>

Oops. I fergot.

At this point all the poseurs are frantically searching the Interwebs
in a desperate attempt to find code identical or similar to the posted
code.

Well those fucking idiot assholes can search and search until they
are blue in the face but they'll find nothing.

Google should be smart enough (but it isn't) to report "you are a fucking
ignoramus asshole" as the result of their attempts (but it won't).

It's no matter. We already know the truth.

Ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha!

GNU/Linux: The only choice for potent creators.

Microslop Winblows: The only haven for poseurs and cheaters.

Subject: Re: C Programming Challenge
From: Stéphane CARPENTIER
Newsgroups: comp.os.linux.advocacy
Organization: Mulots' Killer
Date: Sat, 15 Jun 2024 22:29 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp1-1.free.fr!not-for-mail
Newsgroups: comp.os.linux.advocacy
From: sc@fiat-linux.fr (Stéphane CARPENTIER)
Subject: Re: C Programming Challenge
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<17d94daa55b80d53$191120$273357$802601b3@news.usenetexpress.com>
Organization: Mulots' Killer
User-Agent: slrn/pre1.0.4-9 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Date: 15 Jun 2024 22:29:54 GMT
Lines: 10
Message-ID: <666e15e2$0$10520$426a74cc@news.free.fr>
NNTP-Posting-Date: 16 Jun 2024 00:29:54 CEST
NNTP-Posting-Host: 78.201.248.7
X-Trace: 1718490594 news-3.free.fr 10520 78.201.248.7:36146
X-Complaints-To: abuse@proxad.net
View all headers

Le 15-06-2024, Farley Flud <ff@linux.rocks> a écrit :
>
> We already know the truth.

Yes, you just confirm it. Once again. You are not alone in your head and
you are in an asylum, not in your mother's basement.

--
Si vous avez du temps à perdre :
https://scarpet42.gitlab.io

Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
From: Tyrone
Newsgroups: comp.os.linux.advocacy
Date: Sun, 16 Jun 2024 04:24 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-2.nntp.ord.giganews.com!nntp.giganews.com!local-4.nntp.ord.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 16 Jun 2024 04:24:51 +0000
From: none@none.none (Tyrone)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
X-No-Archive: Yes
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com> <17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
User-Agent: Usenapp for MacOS
X-Usenapp: v1.27.4/l - Full License
Message-ID: <rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
Date: Sun, 16 Jun 2024 04:24:51 +0000
Lines: 23
X-Trace: sv3-x0T3lhWo/yYboSFe5EBsTo/iH7kTOvrhMWrgJnzHMzX6mEf5To47zy4C2VjVL7UrSaOsPujAQg+Xqlf!t13OnZQT3BTL2t73798IzlBzCLAbNbU778v97X8p/3xs2L1lOpWBlEtH5XPvNj5zCxVulQlLr/G6!Cc613k+2aKQ=
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

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.

This is all trivial stuff. These math "problems" have already been solved
multiple times. That you think this is a "programming challenge" just shows
how utterly clueless you are.

Hint: people were doing this 60 years ago on mainframes using Fortran. That
you have only now discovered this proves AGAIN how utterly clueless you are.

What's next? Compute Pi to a million decimal places? That also has already
been done many times. Sounds like another great "programming challenge" for
your feeble brain.

Subject: Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming Challenge)
From: candycanearter07
Newsgroups: comp.os.linux.advocacy
Organization: the-candyden-of-code
Date: Sun, 16 Jun 2024 06:20 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: candycanearter07@candycanearter07.nomail.afraid (candycanearter07)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Another Feeb Fail. Poseurs Indeed. (was: C Programming
Challenge)
Date: Sun, 16 Jun 2024 06:20:03 -0000 (UTC)
Organization: the-candyden-of-code
Lines: 31
Message-ID: <slrnv6t0k4.eqd.candycanearter07@candydeb.host.invalid>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<ZFOdnXz5Oao7VvD7nZ2dnZfqnPWdnZ2d@supernews.com>
<17d945cb55739b19$393584$1616079$802601b3@news.usenetexpress.com>
Injection-Date: Sun, 16 Jun 2024 08:20:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f3e91f8700849ae8ac5f1bf9e5ec9bcf";
logging-data="4135142"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3ly0Ky0iCa5MtkJ9umKs5xnCJGNu7B+vrhAq/hMU7zQ=="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:2KXoH3uEV7XytpgFZnuQfhpRgXE=
X-Face: b{dPmN&%4|lEo,wUO\"KLEOu5N_br(N2Yuc5/qcR5i>9-!^e\.Tw9?/m0}/~:UOM:Zf]%
b+ V4R8q|QiU/R8\|G\WpC`-s?=)\fbtNc&=/a3a)r7xbRI]Vl)r<%PTriJ3pGpl_/B6!8pe\btzx
`~R! r3.0#lHRE+^Gro0[cjsban'vZ#j7,?I/tHk{s=TFJ:H?~=]`O*~3ZX`qik`b:.gVIc-[$t/e
ZrQsWJ >|l^I_[pbsIqwoz.WGA]<D
View all headers

Diego Garcia <dg@chaos.rocks> wrote at 19:57 this Saturday (GMT):
> On Sat, 15 Jun 2024 17:13:10 +0000, Tyrone wrote:
>
>>
>> AGAIN, there is SO much more to programming than "solving" math
>>
>
> Totally incorrect.
>
> ALL programming is reducible to mathematics.

Right!

> YOU just cannot understand this basic fact because your pathetic indoctrination
> to programming has occurred through multi-layers of obscuring abstractions.
>
> You should thank the gods for such abstractions, otherwise you'd be begging
> on the streets.
>
> Ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha!
>
> Question: Why is Rust so popular?
>
> Answer: Because it saves all the incompetent idiots who cannot adequately
> wield C.

Well, Rust does have some nice features. I subjectively dislike the
syntax, but it is a nice language (despite the controversies)
--
user <candycane> is generated from /dev/urandom

Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
From: vallor
Newsgroups: comp.os.linux.advocacy
Date: Sun, 16 Jun 2024 08:19 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
Date: 16 Jun 2024 08:19:11 GMT
Lines: 80
Message-ID: <ld7lfuF433iU2@mid.individual.net>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net UdOmTXi2NS4y3UoWK9M4TARn2RRNKLap0Eb7i6QjEgge6vNUZN
Cancel-Lock: sha1:rw87jutgtA4NXEKjc8BcQyPSeQI= sha256:8ja4vj5aJnqKax6VHggCjwoKnlxaWcKCJs7g/iEzxRQ=
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)
View all headers

> 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.

Furled Fart lost the opportunity to show his prowess with
the GMP library by not demonstrating use of gmp_printf().

> This is all trivial stuff. These math "problems" have already been
> solved multiple times. That you think this is a "programming challenge"
> just shows how utterly clueless you are.

It's more of a "let's learn libgmp" challenge, which is a library
that he already has familiarity with. I don't think he learned anything.
And it's not that difficult a library to use.

> Hint: people were doing this 60 years ago on mainframes using Fortran.
> That you have only now discovered this proves AGAIN how utterly clueless
> you are.
>
>
> What's next? Compute Pi to a million decimal places? That also has
> already been done many times. Sounds like another great "programming
> challenge" for your feeble brain.

$ time ./try_mpz
0:1
1:0
2:1
3:2
4:9
5:44
[...]
49:223774392215649610092605161415154686480227084177314431854406736
50:11188719610782480504630258070757734324011354208865721592720336801

real 0m0.002s
user 0m0.001s
sys 0m0.001s

I also was interested in the recursive version. Here's the
run with N=50 with long long int's, which gives the wrong answer
due to overflow:

$ time ./try2
7531320031745615777

real 0m35.541s
user 0m35.530s
sys 0m0.001s

So: don't bother with the recursive version, except as
a pedantic exercize.

*Do* use GMP if you ever need to work with big numbers...
maybe numpy in Python can do the same thing, I wouldn't
know about that.

$ ll /usr/share/doc/gmp-doc/gmp.pdf.gz
-rw-r--r-- 1 root root 812615 Nov 16 2020 /usr/share/doc/gmp-doc/
gmp.pdf.gz

$ grep FLAGS Makefile
CFLAGS=-Wall -O3 -g -Wpedantic

--
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
OS: Linux 6.9.4 Release: Mint 21.3 Mem: 258G
"Unrecoverable Error #666: Armegeddon in 30..29..28..27.."

Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
From: vallor
Newsgroups: comp.os.linux.advocacy
Date: Sun, 16 Jun 2024 08:56 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
Date: 16 Jun 2024 08:56:53 GMT
Lines: 14
Message-ID: <ld7nmlF8s0rU1@mid.individual.net>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 2I8ZFsBm0tHRkVM4HPwrNgvUCXBEvT4DkrdiWhcOPVpg4iz/z9
Cancel-Lock: sha1:y+kIlcJ4oZXj/S/gT+55rQAieK0= sha256:eLiFz4eh/JPB0X8R1MTm4WnrcrHxynzB3nMcfftKGZM=
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)
View all headers

> use of gmp_printf()

From the GMP manual:

|The flags accepted are as follows. GLIBC style ‘’’ is only for the
|standard C types (not the GMP types), and only if the C library supports
|it.

Lame.

--
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
OS: Linux 6.9.4 Release: Mint 21.3 Mem: 258G
"MIPS: Meaningless Indicator of Processor Speed."

Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
From: Farley Flud
Newsgroups: comp.os.linux.advocacy
Organization: UsenetExpress - www.usenetexpress.com
Date: Sun, 16 Jun 2024 11:48 UTC
References: 1 2 3 4
From: ff@linux.rocks (Farley Flud)
Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com> <17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com> <rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com> <ld7lfuF433iU2@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 64
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!panix!weretis.net!feeder9.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Sun, 16 Jun 2024 11:48:10 +0000
Nntp-Posting-Date: Sun, 16 Jun 2024 11:48:10 +0000
X-Complaints-To: abuse@usenetexpress.com
Organization: UsenetExpress - www.usenetexpress.com
Message-Id: <17d979a6e66c7915$37094$3648231$802601b3@news.usenetexpress.com>
X-Received-Bytes: 2251
View all headers

On 16 Jun 2024 08:19:11 GMT, vallor wrote:

>
> Furled Fart lost the opportunity to show his prowess with
> the GMP library by not demonstrating use of gmp_printf().
>

There's no reason to use that particular output function.

But you missed a definite error in the code that I deliberately
placed to catch any sharp eyes, but no catch.

>
> real 0m0.002s
> user 0m0.001s
> sys 0m0.001s
>

Whoa! That's slow!

On one of my "ancient" i7-4770 CPU machines:

time ./subfactorial 2500
[snip few hundred lines]
real 0m0.001s
user 0m0.001s
sys 0m0.000s

>
> I also was interested in the recursive version. Here's the
> run with N=50 with long long int's, which gives the wrong answer
> due to overflow:
>

Why long long? On an amd64 system, long long is actually the same
size as long, i.e. 64 bits.

But if you insist it should be UNSIGNED LONG LONG INT.

>
> maybe numpy in Python can do the same thing, I wouldn't
> know about that.
>

Numpy is just a front end to GMP.

Mathematica, Maple, Matlab, and all the other billion dollar
commercial math software use GMP.

How's that for mere "hobbyware?" Ha, ha, ha, ha, ha, ha!

>
> $ grep FLAGS Makefile
> CFLAGS=-Wall -O3 -g -Wpedantic
>

You should also have "-march=native -malign-data=cacheline" so
that the compiler can optimize cache access.

Subject: Re: Another Feeb Fail. Poseurs Indeed.
From: DFS
Newsgroups: comp.os.linux.advocacy
Date: Sun, 16 Jun 2024 15:05 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-2.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.netnews.com!postmaster.netnews.com!us4.netnews.com!not-for-mail
X-Trace: DXC=J^Oi5Bo`61Q;WJ0ZJ7CLb_HWonT5<]0T]Q;nb^V>PUfV5[gZBW6J?L\ZHjmnLVPdB]k4G3cSPE1c_nT`JO7@`Z@PMba][>SC2CWf;]EoU=id5V=R<hY6_C9TX
X-Complaints-To: support@blocknews.net
Date: Sun, 16 Jun 2024 11:05:33 -0400
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
From: nospam@dfs.com (DFS)
Subject: Re: Another Feeb Fail. Poseurs Indeed.
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<ZFOdnXz5Oao7VvD7nZ2dnZfqnPWdnZ2d@supernews.com>
<17d945cb55739b19$393584$1616079$802601b3@news.usenetexpress.com>
Content-Language: en-US
In-Reply-To: <17d945cb55739b19$393584$1616079$802601b3@news.usenetexpress.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 11
Message-ID: <666eff3a$2$1412894$882e4bbb@reader.netnews.com>
NNTP-Posting-Host: 127.0.0.1
X-Trace: 1718550330 reader.netnews.com 1412894 127.0.0.1:36335
View all headers

On 6/15/2024 3:57 PM, Despicable Diego wrote:

> Question: Why is Rust so popular?
>
> Answer: Because it saves all the incompetent idiots who cannot adequately
> wield C.

Such as you.

Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
From: rbowman
Newsgroups: comp.os.linux.advocacy
Date: Sun, 16 Jun 2024 17:25 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bowman@montana.com (rbowman)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Non-Programming Non-Challenge (was: C Programming Challenge)
Date: 16 Jun 2024 17:25:50 GMT
Lines: 10
Message-ID: <ld8lgtFdeclU1@mid.individual.net>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net EiaFx1blDD2IQQpaJtP9LQdAFmZwb0XfJBq4hKLgOZqgPqfsKY
Cancel-Lock: sha1:0Kc0LPZspZkn1sgxiNxHHvUF8RE= sha256:IQrOR5mLa6c2HIHtcw8zf15dX8YV9C5R18CI1OYgk+Y=
User-Agent: Pan/0.149 (Bellevue; 4c157ba)
View all headers

On Sun, 16 Jun 2024 04:24:51 +0000, Tyrone wrote:

> What's next? Compute Pi to a million decimal places? That also has
> already been done many times. Sounds like another great "programming
> challenge" for your feeble brain.

https://arstechnica.com/gaming/2024/06/retired-engineer-discovers-55-year-
old-bug-in-lunar-lander-computer-game-code/

Maybe a clean room version of Lunar Lander without the bug?

Subject: Re: C Non-Programming Non-Challenge
From: DFS
Newsgroups: comp.os.linux.advocacy
Date: Sun, 16 Jun 2024 18:30 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-3.nntp.ord.giganews.com!backlog-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.netnews.com!postmaster.netnews.com!us7.netnews.com!not-for-mail
X-Trace: DXC=g7EB\AmPd3cPHaK9SYdC3bHWonT5<]0TmQ;nb^V>PUff5[gZBW6J?LlTD;10@6=i=nZ[0LWn0`0Eb>G9_h6]J@kjWjB\<Me8\Ag@GM\IYO6WZd>Oa:X5b?f8h
X-Complaints-To: support@blocknews.net
Date: Sun, 16 Jun 2024 14:30:11 -0400
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
From: nospam@dfs.com (DFS)
Subject: Re: C Non-Programming Non-Challenge
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
Content-Language: en-US
In-Reply-To: <ld7lfuF433iU2@mid.individual.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 148
Message-ID: <666f2f33$0$3102233$882e4bbb@reader.netnews.com>
NNTP-Posting-Host: 127.0.0.1
X-Trace: 1718562611 reader.netnews.com 3102233 127.0.0.1:49193
View all headers

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?

Here's an approximation of !n, using round(n!/e)
-----------------------------------------
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
int n = atoi(argv[1]);
for(int i=1;i<=n;i++){
double f=1.0;
for(int n=1;n<=i;n++){
f*=n;
}
f/=2.71828;
printf("%d. %.0f\n",i,(f));
}
}
-----------------------------------------
$ ./prog n

Without using a bignum library, it craps out at 171 and prints 'inf' (so
does python)

1. 0
2. 1
3. 2
4. 9
5. 44
6. 265
7. 1854
8. 14833
9. 133496
10. 1334962
11. 14684580
12. 176214959
13. 2290794473
14. 32071122622
15. 481066839325
16. 7697069429198
17. 130850180296364
18. 2355303245334550
19. 44750761661356448
20. 895015233227128960
21. 18795319897769705472
22. 413497037750933585920
23. 9510431868271472934912
24. 228250364838515316883456
25. 5706259120962883593175040
....
50. 11188727136907667116392988817975029667335257249097046505283387392
....
170.
2669855796793558290010001570575275101705027811519977073818130755407973315261224007251979700779512228624245141462623296456740188588977348681648565542706396927622340485993465997718765185927438606647566078414539613618036013433690401156103581768582773608415498699128984156662958003889715092930354450116728848384
171. inf

> Furled Fart lost the opportunity to show his prowess with
> the GMP library by not demonstrating use of gmp_printf().

Note he also lied "we ignore N = 1, 2 as they are trivial"

He ignored them because he didn't know how to handle those cases.
That's the kind of devious, evasive wanker he is.

Notice he said "you missed a definite error in the code that I
deliberately placed to catch any sharp eyes, but no catch."

This is another devious lie he uses to try and excuse mistakes in his
"perfect code".

>> This is all trivial stuff. These math "problems" have already been
>> solved multiple times. That you think this is a "programming challenge"
>> just shows how utterly clueless you are.
>
> It's more of a "let's learn libgmp" challenge, which is a library
> that he already has familiarity with. I don't think he learned anything.
> And it's not that difficult a library to use.
>
>> Hint: people were doing this 60 years ago on mainframes using Fortran.
>> That you have only now discovered this proves AGAIN how utterly clueless
>> you are.
>>
>>
>> What's next? Compute Pi to a million decimal places? That also has
>> already been done many times. Sounds like another great "programming
>> challenge" for your feeble brain.
>
> $ time ./try_mpz
> 0:1
> 1:0
> 2:1
> 3:2
> 4:9
> 5:44
> [...]
> 49:223774392215649610092605161415154686480227084177314431854406736
> 50:11188719610782480504630258070757734324011354208865721592720336801
>
> real 0m0.002s
> user 0m0.001s
> sys 0m0.001s
>
> I also was interested in the recursive version. Here's the
> run with N=50 with long long int's, which gives the wrong answer
> due to overflow:
>
> $ time ./try2
> 7531320031745615777
>
> real 0m35.541s
> user 0m35.530s
> sys 0m0.001s
>
> So: don't bother with the recursive version, except as
> a pedantic exercize.
>
> *Do* use GMP if you ever need to work with big numbers...
> maybe numpy in Python can do the same thing, I wouldn't
> know about that.
>
> $ ll /usr/share/doc/gmp-doc/gmp.pdf.gz
> -rw-r--r-- 1 root root 812615 Nov 16 2020 /usr/share/doc/gmp-doc/
> gmp.pdf.gz
>
> $ grep FLAGS Makefile
> CFLAGS=-Wall -O3 -g -Wpedantic
>

Subject: Re: C Non-Programming Non-Challenge
From: Tyrone
Newsgroups: comp.os.linux.advocacy
Date: Sun, 16 Jun 2024 20:01 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-1.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 16 Jun 2024 20:01:45 +0000
From: none@none.none (Tyrone)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Non-Programming Non-Challenge
X-No-Archive: Yes
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com> <17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com> <rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com> <ld8lgtFdeclU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
User-Agent: Usenapp for MacOS
X-Usenapp: v1.27.4/l - Full License
Message-ID: <dBmcnX1Yo9Q02fL7nZ2dnZfqn_SdnZ2d@supernews.com>
Date: Sun, 16 Jun 2024 20:01:45 +0000
Lines: 20
X-Trace: sv3-8ZLiqf/mNkfbXwFHTh6LLJEYeJB05R0HirS3ehQE8x3UT7nmadBcRxk0SIinKDebxdXRurW0ayzTCYn!ili1DDJ8FGGCe2QkrVW8Z3zDKTQehO7fSnC8DDdloo/LjBAVdlAw9G92hpOBa210zIampfos/QyQ!TweLw4apPBM=
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

On Jun 16, 2024 at 1:25:50 PM EDT, "rbowman" <bowman@montana.com> wrote:

> On Sun, 16 Jun 2024 04:24:51 +0000, Tyrone wrote:
>
>> What's next? Compute Pi to a million decimal places? That also has
>> already been done many times. Sounds like another great "programming
>> challenge" for your feeble brain.
>
> https://arstechnica.com/gaming/2024/06/retired-engineer-discovers-55-year-
> old-bug-in-lunar-lander-computer-game-code/

I remember playing that game. It was very difficult to have a successful
landing. We were playing on an NCR 605(IIRC) mini computer that was the size
of a washing machine. No screen, just paper printout. This was around 1980 or
so.

> Maybe a clean room version of Lunar Lander without the bug?

A clean room version of "Hello World" would be beyond his capabilities,
because no math is involved.

Subject: Re: C Non-Programming Non-Challenge
From: vallor
Newsgroups: comp.os.linux.advocacy
Date: Mon, 17 Jun 2024 00:04 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor@cultnix.org (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: <ld9ct8F8s0rU5@mid.individual.net>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
<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)
View all headers

> 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!"

Subject: Re: C Non-Programming Non-Challenge
From: %
Newsgroups: comp.os.linux.advocacy
Date: Mon, 17 Jun 2024 01:24 UTC
References: 1 2 3 4 5 6
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-4.nntp.ord.giganews.com!nntp.giganews.com!local-3.nntp.ord.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 17 Jun 2024 01:24:08 +0000
Subject: Re: C Non-Programming Non-Challenge
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
<666f2f33$0$3102233$882e4bbb@reader.netnews.com>
<ld9ct8F8s0rU5@mid.individual.net>
From: pursent100@gmail.com (%)
Date: Sun, 16 Jun 2024 18:24:08 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.2
MIME-Version: 1.0
In-Reply-To: <ld9ct8F8s0rU5@mid.individual.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Antivirus: AVG (VPS 240616-2, 2024-6-16), Outbound message
X-Antivirus-Status: Clean
Message-ID: <FoGdnfEtJYWlDfL7nZ2dnZfqn_gAAAAA@giganews.com>
Lines: 40
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-kiyAqnBnXVMzYkCgSzxbifnL5U3v2aEGfveh68hrzGrWIlXQtOVBqVW+HuYrwb98diYd5o29bD3G3Pl!JMTIfoyZ0FnaR/YmtSxMyF0kqiqs5NtIm7FjMNqnHO8nnpsgA+DgzMyyXmfttXZesBSdiT3vOOBV
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

vallor wrote:
>> 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.)
>
this is not advocacy , you're off topic

Subject: Re: C Non-Programming Non-Challenge
From: vallor
Newsgroups: comp.os.linux.advocacy
Date: Mon, 17 Jun 2024 01:47 UTC
References: 1 2 3 4 5 6 7
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Non-Programming Non-Challenge
Date: 17 Jun 2024 01:47:37 GMT
Lines: 54
Message-ID: <ld9itpFgt18U2@mid.individual.net>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
<666f2f33$0$3102233$882e4bbb@reader.netnews.com>
<ld9ct8F8s0rU5@mid.individual.net>
<FoGdnfEtJYWlDfL7nZ2dnZfqn_gAAAAA@giganews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net +i85dg0IVPZr/jTTeqOzkQpi9CG0H5QAlbC0HHDMC9yEkE5BQj
Cancel-Lock: sha1:Byh0uTP7HoyalX66U+efPqQM/dE= sha256:7V32kUpjspFugV755yC/ogrmfm01j5QcyxmMVkJQJaA=
X-Face: +McU)#<-H?9lTb(Th!zR`EpVrp<0)1p5CmPu.kOscy8LRp_\u`:tW;dxPo./(fCl
CaKku`)]}.V/"6rISCIDP`
User-Agent: Pan/0.159 (Vovchansk; 873418b; Linux-6.9.4)
View all headers

> vallor wrote:
>>> 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.)
>>
> this is not advocacy , you're off topic

Au contraire, Monseur -- showing off the capabilities of
the GNU Multi-precision library highlights the easy of
numeric computation on LINUX.

And my quick-and-dirty formatter fills in a deficiency
in gmp_printf() -- it doesn't grok "'" for a format
specifier for mpz entities.

Show your mom! 🖖️👽️

--
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
OS: Linux 6.9.4 Release: Mint 21.3 Mem: 258G

Subject: Fine. (was: Re: C Non-Programming Non-Challenge)
From: vallor
Newsgroups: comp.os.linux.advocacy
Date: Mon, 17 Jun 2024 03:38 UTC
References: 1 2 3 4 5 6 7
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.advocacy
Subject: Fine. (was: Re: C Non-Programming Non-Challenge)
Date: 17 Jun 2024 03:38:35 GMT
Lines: 22
Message-ID: <ld9pdrFiih7U1@mid.individual.net>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
<666f2f33$0$3102233$882e4bbb@reader.netnews.com>
<ld9ct8F8s0rU5@mid.individual.net>
<FoGdnfEtJYWlDfL7nZ2dnZfqn_gAAAAA@giganews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net C2fc6fcNAzGPq/GWb5chYQyz3tm9yfSXUz3qS6sdSd3M4i9jAa
Cancel-Lock: sha1:HRXbpXFbVG0Q0hc4MWUG9cAo4N8= sha256:ZAMl+JiVHlPrYHS9tZmVHBAOQpaUlIlEghAzBzulg48=
X-Face: +McU)#<-H?9lTb(Th!zR`EpVrp<0)1p5CmPu.kOscy8LRp_\u`:tW;dxPo./(fCl
CaKku`)]}.V/"6rISCIDP`
User-Agent: Pan/0.159 (Vovchansk; 873418b; Linux-6.9.5)
View all headers

On Sun, 16 Jun 2024 18:24:08 -0700, % <pursent100@gmail.com> wrote in
<FoGdnfEtJYWlDfL7nZ2dnZfqn_gAAAAA@giganews.com>:
> this is not advocacy , you're off topic

Fine.

FRESH! LINUX!

$ uname -a
Linux lm 6.9.5 #1 SMP PREEMPT_DYNAMIC Sun Jun 16 20:09:50 PDT 2024 x86_64
x86_64 x86_64 GNU/Linux

Compile time with -j48 and sources on my NAS:

real 2371.85
user 16336.41
sys 4707.19

--
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
OS: Linux 6.9.5 Release: Mint 21.3 Mem: 258G
"Talk is cheap because Supply exceeds Demand."

Subject: Re: C Non-Programming Non-Challenge
From: %
Newsgroups: comp.os.linux.advocacy
Date: Mon, 17 Jun 2024 06:07 UTC
References: 1 2 3 4 5 6 7 8
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 17 Jun 2024 06:07:15 +0000
Subject: Re: C Non-Programming Non-Challenge
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
<666f2f33$0$3102233$882e4bbb@reader.netnews.com>
<ld9ct8F8s0rU5@mid.individual.net>
<FoGdnfEtJYWlDfL7nZ2dnZfqn_gAAAAA@giganews.com>
<ld9itpFgt18U2@mid.individual.net>
From: pursent100@gmail.com (%)
Date: Sun, 16 Jun 2024 23:07:14 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.2
MIME-Version: 1.0
In-Reply-To: <ld9itpFgt18U2@mid.individual.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Antivirus: AVG (VPS 240616-2, 2024-6-16), Outbound message
X-Antivirus-Status: Clean
Message-ID: <6MCcnR0MvOUOT_L7nZ2dnZfqnPidnZ2d@giganews.com>
Lines: 53
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-HEyJJWJrcVqEBnOpEZ7cKB5jiuj+F8tysna0RTnRxWJjmQmsrUKYIqfuFIT5haZJ4Ukd06o44gMibDu!LHyW/kekQZOZ0KQTUFQ9F6Tksezv+0jbc6ZZf+xmVrU1B3M0o3eBQiyBfELXT7UFHYFVrNWt1IZr
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
View all headers

vallor wrote:
>> vallor wrote:
>>>> 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.)
>>>
>> this is not advocacy , you're off topic
>
> Au contraire, Monseur -- showing off the capabilities of
> the GNU Multi-precision library highlights the easy of
> numeric computation on LINUX.
>
> And my quick-and-dirty formatter fills in a deficiency
> in gmp_printf() -- it doesn't grok "'" for a format
> specifier for mpz entities.
>
> Show your mom! 🖖️👽️
>
dragging peoples family into usenet is not advocacy you're off topic

Subject: Re: C Non-Programming Non-Challenge
From: DFS
Newsgroups: comp.os.linux.advocacy
Date: Mon, 17 Jun 2024 18:30 UTC
References: 1 2 3 4 5 6
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!border-2.nntp.ord.giganews.com!border-3.nntp.ord.giganews.com!nntp.giganews.com!news-out.netnews.com!postmaster.netnews.com!us8.netnews.com!not-for-mail
X-Trace: DXC=];6\K[oCfO]ShVMDdmZ2O_HWonT5<]0T]Q;nb^V>PUfV5[gZBW6J?L\>8J_kK>kdRYD]>mPc=jiARYG5D_7nn;`XMba][>SC2CWf;]EoU=id5V=R<hY6_C9TX
X-Complaints-To: support@blocknews.net
Date: Mon, 17 Jun 2024 14:30:47 -0400
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
From: nospam@dfs.com (DFS)
Subject: Re: C Non-Programming Non-Challenge
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
<666f2f33$0$3102233$882e4bbb@reader.netnews.com>
<ld9ct8F8s0rU5@mid.individual.net>
Content-Language: en-US
In-Reply-To: <ld9ct8F8s0rU5@mid.individual.net>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 66
Message-ID: <667080d6$0$3747318$882e4bbb@reader.netnews.com>
NNTP-Posting-Host: 127.0.0.1
X-Trace: 1718649046 reader.netnews.com 3747318 127.0.0.1:57429
View all headers

On 6/16/2024 8:04 PM, vallor wrote:

> 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.)

in C?

Here's a generalized python function I just wrote that puts whatever
character at whatever spacing, working from the end.

------------------------------------------------------------------------
def strfmt(val,char,space):
if space >= len(str(val)):
print("Spacing of %d is too large for '%s'" % (space,str(val)))
return
if len(str(val)) > space:
begin = len(str(val)) - space
end = begin + space
sval = '' #output string
while begin > 0:
sval = str(char) + str(val)[begin:end] + sval
begin -= space
end -= space
sval = str(val)[0:end] + sval #remainder
print(sval)
else:
print(str(val))
------------------------------------------------------------------------

strfmt(11188719610782480504630258070757734324011354208865721592720336801,',',3)
11,188,719,610,782,480,504,630,258,070,757,734,324,011,354,208,865,721,592,720,336,801
strfmt(1234,',',3)
1,234

strfmt(12345,',',3)
12,345

strfmt(123456,',',3)
123,456

strfmt(1234567,'-',2)
1-23-45-67

strfmt(12345678,'.',1)
1.2.3.4.5.6.7.8

strfmt(123456789,' ',3)
123 456 789

strfmt(1234567890,',',3)
1,234,567,890

strfmt('abc','-',4)
Spacing of 4 is too large for 'abc'

strfmt('abcdef','_',1)
a_b_c_d_e_f

strfmt(11188719610782480504630258070757734324011354208865721592720336801,'
',4)
1 1188 7196 1078 2480 5046 3025 8070 7577 3432 4011 3542 0886 5721 5927
2033 6801

Subject: Re: C Non-Programming Non-Challenge
From: vallor
Newsgroups: comp.os.linux.advocacy
Date: Mon, 17 Jun 2024 18:53 UTC
References: 1 2 3 4 5 6 7
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.advocacy
Subject: Re: C Non-Programming Non-Challenge
Date: 17 Jun 2024 18:53:59 GMT
Lines: 28
Message-ID: <ldbf27Fq2igU3@mid.individual.net>
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com>
<17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com>
<rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com>
<ld7lfuF433iU2@mid.individual.net>
<666f2f33$0$3102233$882e4bbb@reader.netnews.com>
<ld9ct8F8s0rU5@mid.individual.net>
<667080d6$0$3747318$882e4bbb@reader.netnews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 5DaXBS/otqDjyvA8a/AD9Q1wIneCVujJSyKQC4057oxc+n5jhO
Cancel-Lock: sha1:DDmaWP44Zlgkq1lHJ2Rks77IqTY= sha256:x9QzqjZWpMvBG8dRYfZcVHdp1bsGCe/csZaFqT8ezUM=
X-Face: +McU)#<-H?9lTb(Th!zR`EpVrp<0)1p5CmPu.kOscy8LRp_\u`:tW;dxPo./(fCl
CaKku`)]}.V/"6rISCIDP`
User-Agent: Pan/0.159 (Vovchansk; 873418b; Linux-6.9.5)
View all headers

On Mon, 17 Jun 2024 14:30:47 -0400, DFS <nospam@dfs.com> wrote in
<667080d6$0$3747318$882e4bbb@reader.netnews.com>:

> On 6/16/2024 8:04 PM, vallor wrote:
>
>>
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.)
>
> in C?

Yes, and it is in the git repo that I posted:

https://github.com/vallor/subfactorial/blob/main/format_longnum.c

There's one thing I'd change about it (adding a "break" to
elide redundant code), but ICBB.

It's also not appropriate for long-running programs as it stands,
since it will leak memory. So if I were do something serious with
it, I'd strcpy() the resulting string to a new malloc'ed chunk of memory,
free the working memory, then return the new chunk (to be free()'ed by
the caller).

--
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
OS: Linux 6.9.5 Release: Mint 21.3 Mem: 258G

Subject: Re: Fine. (was: Re: C Non-Programming Non-Challenge)
From: Farley Flud
Newsgroups: comp.os.linux.advocacy
Organization: UsenetExpress - www.usenetexpress.com
Date: Mon, 17 Jun 2024 19:47 UTC
References: 1 2 3 4 5 6 7 8
From: ff@linux.rocks (Farley Flud)
Subject: Re: Fine. (was: Re: C Non-Programming Non-Challenge)
Newsgroups: comp.os.linux.advocacy
References: <17d933d9ffc8ee40$16989$3694546$802601b3@news.usenetexpress.com> <17d943beaefb3aa2$16097$2041738$802601b3@news.usenetexpress.com> <rPadnWt9mtOO9PP7nZ2dnZfqn_qdnZ2d@supernews.com> <ld7lfuF433iU2@mid.individual.net> <666f2f33$0$3102233$882e4bbb@reader.netnews.com> <ld9ct8F8s0rU5@mid.individual.net> <FoGdnfEtJYWlDfL7nZ2dnZfqn_gAAAAA@giganews.com> <ld9pdrFiih7U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 31
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Mon, 17 Jun 2024 19:47:22 +0000
Nntp-Posting-Date: Mon, 17 Jun 2024 19:47:22 +0000
Organization: UsenetExpress - www.usenetexpress.com
X-Complaints-To: abuse@usenetexpress.com
Message-Id: <17d9e261cfcdfa87$1$4081608$802601b3@news.usenetexpress.com>
X-Received-Bytes: 1900
View all headers

On 17 Jun 2024 03:38:35 GMT, vallor wrote:

>
> Compile time with -j48 and sources on my NAS:
>
> real 2371.85
> user 16336.41
> sys 4707.19
>

What the flamin' fuck!

Do you actually mean that it requires 40+ minutes for you
to compile a kernel?

I have been compiling kernels for years and it's always been
about 2 minutes, at -j8, which includes all the modules.

It must be the kernel configuration. I configure the kernel
to include only the stuff I need and I especially exclude all
that security bullshit.

What is the size of your compressed kernel image? This is
the file named "bzImage" in the kernel source tree.

My bzImage, for kernel 6.9.1, is only 3154944 bytes.

Note that the "bz" does not necessarily indicate that bzip2
compression is used. The particular compression algorithm
is set at kernel configuration. Mine uses LZMA.

Pages:1234

rocksolid light 0.9.8
clearnet tor