From 889275a8b4b02ddd5e0b3c23cdaaa4c9811a84e2 Mon Sep 17 00:00:00 2001 From: James Smith Date: Thu, 4 Nov 2021 17:11:27 +0000 Subject: Update README.md --- challenge-137/james-smith/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/challenge-137/james-smith/README.md b/challenge-137/james-smith/README.md index b32381ed19..a70002eab8 100644 --- a/challenge-137/james-smith/README.md +++ b/challenge-137/james-smith/README.md @@ -164,7 +164,13 @@ say $_ foreach sort { $a <=> $b } keys %lychrel; Using this script to generate all candidate Lychrel numbers up to 1 million took approximately `12` seconds. To use the `lychrel_large` routine took approximately 2180 seconds (36 minutes 20 seconds), a speed gain of approximately `180x`. -To 10 million the time taken was approximately 6 minutes. +To 10 million the time taken was approximately 1 min 40s; 20 million ~ 3 min 50s; 30 million ~ 31 min 40s {I think the time for this got large as the machine was starting to hit SWAP storage}. The code fails shortly after this as memory and swap was exhausted ~ 12GB. + +| N | Lycrhel < N | Time taken | +| ---------: | ----------: | ---------: | +| 10,000,000 | 2,010,871 | 1 min 40s | +| 20,000,000 | 4,521,930 | 3 min 50s | +| 30,000,000 | 7,177,742 | 31 min 40s | ### Explanation -- cgit From c1a9ecb43a5a9194946c464511f0ec0054dde082 Mon Sep 17 00:00:00 2001 From: James Smith Date: Thu, 4 Nov 2021 17:11:53 +0000 Subject: Update README.md --- challenge-137/james-smith/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-137/james-smith/README.md b/challenge-137/james-smith/README.md index a70002eab8..16a55aa072 100644 --- a/challenge-137/james-smith/README.md +++ b/challenge-137/james-smith/README.md @@ -166,7 +166,7 @@ Using this script to generate all candidate Lychrel numbers up to 1 million took To 10 million the time taken was approximately 1 min 40s; 20 million ~ 3 min 50s; 30 million ~ 31 min 40s {I think the time for this got large as the machine was starting to hit SWAP storage}. The code fails shortly after this as memory and swap was exhausted ~ 12GB. -| N | Lycrhel < N | Time taken | +| N | Lychrel < N | Time taken | | ---------: | ----------: | ---------: | | 10,000,000 | 2,010,871 | 1 min 40s | | 20,000,000 | 4,521,930 | 3 min 50s | -- cgit From bf5538ad1f5731602298463bb9c819339f94736b Mon Sep 17 00:00:00 2001 From: James Smith Date: Thu, 4 Nov 2021 17:13:45 +0000 Subject: Update README.md --- challenge-137/james-smith/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/challenge-137/james-smith/README.md b/challenge-137/james-smith/README.md index 16a55aa072..9bdd58ce27 100644 --- a/challenge-137/james-smith/README.md +++ b/challenge-137/james-smith/README.md @@ -172,6 +172,7 @@ To 10 million the time taken was approximately 1 min 40s; 20 million ~ 3 min 50s | 20,000,000 | 4,521,930 | 3 min 50s | | 30,000,000 | 7,177,742 | 31 min 40s | +The last of these is still quicker than getting Lychrel numbers up to 1,000,000 using the "large" method. ### Explanation For every sequence generated above - all the numbers are either not Lychral numbers or candidate Lychral numbers. Once we either get to a palindrome OR reach the "end of the sequence" we can tag every number as either a candidate Lychral number or not. This reduces the number of calculations. -- cgit