There's more than one way to do things | |
PerlMonks |
Re^2: Optimizing with Caching vs. Parallelizing (MCE::Map) (traps for the unwary)by vr (Curate) |
on Apr 20, 2020 at 10:00 UTC ( [id://11115825]=note: print w/replies, xml ) | Need Help?? |
Many thanks for providing this wonderful challenge! If all goes at the pace it's rolling now, the fun may well continue into the month of May! Therefore, a warning: some people are at danger of gaining (or loosing) more than what they have bargained for!:) I decided to ask people to output the top 20, because that presents an interesting mini-challenge by itself Well said, dear rjt, well said. But it seems it were YOU, who fell into the trap that you so cunningly crafted for poor innocent learners! The top 20 out of million Collatz sequences has an insidious property: there are six "445" lengths in 1e6, but only four in top-20 (so, all six are in top-22). Which to extract? Aha! Well, the challenge did not clearly state how to order numbers with the same Collatz lengths (CL). But I think it is reasonable to assume, that, since numbers with longer CL are rated better/closer to top, then smaller numbers among producing same CL are to be valued more. Like: "Look! This brave little number commendably creates as long CL as that huge number! And this undeservedly huge number has only managed to generate so puny CL! Loser!" At least, there must be some consistency in arranging results, don't you agree? In other words, I think that if CL column descends, then numbers column must ascend (for equal CLs). See ordering for CL 450, too. Well, dear Perl users, I happened to notice this, because in another my (unpublished) solution I had to endure great pain in arranging top-20 properly. Just how many of you, looking at output of (almost all) scripts in this and related 2 threads, have noticed, that top 20 are neatly ordered? And yet, this "natural" result comes at no cost at all, with Perl! Just appreciate what you so ungratefully consume!:) To illustrate, rjt, here's, in parallel, output of your script and Laurent_R's with marioroy fixes:
But wait... What's that??? The 922526 number is listed twice, on the left?? Is this...
In Section
Meditations
|
|