Talk:Rare numbers: Difference between revisions

m
→‎Tweaks, C++: Further syntax-highlighting fixes
m (→‎Tweaks, Go (Turbo): added remark about long)
m (→‎Tweaks, C++: Further syntax-highlighting fixes)
 
(16 intermediate revisions by 6 users not shown)
Line 6:
 
(a URL reference):
:*   author's  website:   [http://www.shyamsundergupta.com/rare.htmhtml rare numbers]   by Shyam Sunder Gupta.     (lots of hints and some observations).
 
 
Line 76:
== the 1<sup>st</sup> REXX version ==
This is the 1<sup>st</sup> REXX version, &nbsp; before all the optimizations were added:
<syntaxhighlight lang="rexx">
<lang rexx>/*REXX program to calculate and display an specified amount of rare numbers. */
/*REXX program to calculate and display an specified amount of rare numbers. */
numeric digits 20; w= digits() + digits() % 3 /*ensure enough decimal digs for calcs.*/
parse arg many start . /*obtain optional argument from the CL.*/
Line 103 ⟶ 104:
if _>=0 then do; x= _; $= $ + q
end
end /*while q>1*/; return $</lang>
</syntaxhighlight>
Pretty simple, &nbsp; but slow as molasses in January.
 
Line 112 ⟶ 114:
of &nbsp; ''rare'' &nbsp; numbers) &nbsp; within Shyam Sunder Gupta's
<br>[http://www.shyamsundergupta.com/rare.htm <u>webpage</u>] &nbsp; have been incorporated in this REXX program.
<langsyntaxhighlight lang="rexx">/*REXX program to calculate and display an specified amount of rare numbers. */
numeric digits 20; w= digits() + digits() % 3 /*ensure enough decimal digs for calcs.*/
parse arg many start . /*obtain optional argument from the CL.*/
Line 219 ⟶ 221:
if _>=0 then do; x= _; $= $ + q
end
end /*while q>1*/; return $</langsyntaxhighlight>
Still pretty sluggish, &nbsp; like molasses in March.
 
Line 521 ⟶ 523:
square containing the combination 9 or 14 as the first/last digit.
 
<langsyntaxhighlight lang="go">package main
import (
Line 778 ⟶ 780:
bStart = time.Now() // restart block timing
}
}</langsyntaxhighlight>
{{out}}
Results on the core i7-7700 @ 3.6Ghz.
Line 862 ⟶ 864:
:I've also updated Nigel's C++ version with the same tweaks:
 
<langsyntaxhighlight lang="cpp">#include <iostream>
#include <functional>
#include <bitset>
Line 902 ⟶ 904:
int main(){
Rare(19);
}</langsyntaxhighlight>
:Compiling this with g++ brings the overall execution time down from 30 to 21 minutes in round figures. So the figures for clang or mingw may well come in at below 10 minutes now.
 
Line 911 ⟶ 913:
 
:: I also installed gmp and tried the c++ 20+ digit version, but found issues. 10, 12, & 13 had normal output, but digits 14 and up spent the approximate calculation time without producing any solutions. Has anyone else observed this issue? (By the way, I had to change ''long'' to ''long long'' in either version. Perhaps part of my issue?) --[[User:Enter your username|Enter your username]] ([[User talk:Enter your username|talk]]) 02:30, 23 March 2020 (UTC)
 
::: Ah, just missed sub-10 minutes on the overall time but still impressively fast.
 
::: In C++ the width of the ''long'' type is, of course, implementation dependent and in g++ running on Ubuntu 18.04, amd64, sizeof(long) is 8 bytes. It looks like it's only 4 bytes on the version of mingw you're using (I don't know what Nigel's using), hence the need for ''long long''.
 
::: I haven't looked at the 20+ digit C++ version at all though, at first sight, it looks similar to the 10-19 digit version but with ''long'' replaced where necessary with ''mpz_t''. FWIW, I compiled (g++ -std=c++17 -O3 rare_ng3.cpp -lgmp -lgmpxx -o rare_ng3) and ran it on my machine and whilst it seemed to execute OK it wasn't very fast taking about 1 minute and 7.25 minutes respectively to complete up to and including the 16 and 17 digit blocks - g++ doesn't seem to be even at the races here :(
 
::: I've no idea what could be causing the issues you're having though it may be GMP related as it can be a pig to install correctly. A more fruitful approach might be to try and translate the C++ version to C# using the 128 bit integer library you found rather than System.Numerics.BigInteger though whether this will be any quicker than what you've done already I don't know. --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 10:37, 23 March 2020 (UTC)
 
== Tweaks, C++ ==
Wringing out some more performance here, just over 5 minutes for 19 digits by themselves, and just over 6 minutes for digits 2 thru 19. See the code comments for details on what was tweaked. Curiously, I found that the g++ version executes faster than the clang++ version. Compiler arguments used: <code>g++ rare.cpp -o rare.exe -std=c++17 -O3</code><br/>Curious to see if it can go faster on a different platform - But the original executed faster on g++ than clang++ for me on my platform too. Perhaps I don't have clang++ set up the same as others?
<syntaxhighlight lang="cpp">// Rare Numbers : Nigel Galloway - December 20th., 2019
 
/*
speed related tweaks:
skip certain "outer" permutations which cannot produce squares (ends with 2, 3, 7, or 8), or will not produce squares for less than 20 digits (5 for diffs, and 9 & 14 for sums).
"outer" compute 5 digits instead of 4, that is, start at 12 digits instead of 10
diffs pre-computation of squares does only multiples of 9
don't compute every square up to 100_000, split diffs pre-computation of squares from sums pre-computation, and each has a separate limit for the pre-computation
do 2 through 11 digits by only looking at "middles" (no "outers") - accomplished by adding an additional definition for nLH() that takes only the function of optional long
when doing less that 12 digits, limit diffs to be above zero, and sums to be above a limit at which smaller squares produced are less than the forward number itself (pow10[n-1] * 4)
makeL(), makeH() return nLH() now, instead of nLH() components. That is, no pair<> construction
computes "outers" to a single value (vector of long instead of a vector of pair<long, long>)
sends one power of ten to the mutable section instead of four
nLH.odd / nLH.even selection based on oddness of current "outer" value, instead of the sqare itself
 
cosmetic or unnecessary tweaks:
start calculations at 2 digits instead of 10
converted output to printf()
indicate count of solutions
added elasped time indications
sorted output
optional command line argument for maximum number of digits to compute
compute the power of ten array instead of declaring it with literals
*/
 
#include <functional>
#include <bitset>
#include <cmath>
#include <chrono>
 
using namespace std;
using namespace chrono;
 
template <typename T> // concatenates vectors
vector<T>& operator +=(vector<T>& v, const vector<T>& w) { v.insert(v.end(), w.begin(), w.end()); return v; }
 
int sc = 0; // solution counter
auto st = steady_clock::now(), st0 = st, tmp = st; double dir = 0; // for determining elasped time
 
using Z2 = optional<long long>;
using Z1 = function<Z2()>;
using VU = vector<unsigned long long>;
using VS = vector<string>;
 
constexpr array<const int, 7> li { 1, 3, 0, 0, 2, 0, 1 };
constexpr array<const int, 17> lu { 1, 2, 0, 0, 1, 1, 4, 0, 0, 0, 1, 4, 0, 0, 0, 1, 1 };
 
// powers of 10 array
constexpr auto pow10 = [] { array <long long, 19> n {1}; for (int j{0}, i{1}; i < 19; j = i++) n[i] = n[j] * 10; return n; } ();
 
bool izRev(int n, unsigned long long i, unsigned long long g) {
return (i / pow10[n - 1] != g % 10) ? false : n < 2 ? true : izRev(n - 1, i % pow10[n - 1], g / 10);
}
 
const Z1 fG(Z1 n, int start, int end, int reset, const long long step, long long &l) {
return [n, i{step * start}, g{step * end}, e{step * reset}, &l, step] () mutable {
while (i < g) { i += step; return Z2(l += step); }
l -= g - (i = e); return n(); };
}
 
int c = 0; // solution counter
long long acc, l, llim;
 
struct nLH {
vector<unsigned long long>even{}, odd{};
nLH(Z1 a) { unsigned long long r;
while (auto i = a()) if (*i > llim) {
r = sqrt(*i); if (r * r == i) *i & 1 ? even.push_back(*i) : odd.push_back(*i); } }
nLH(Z1 a, vector<long long> b) { unsigned long long sq, r;
while (auto i = a()) for (auto ng : b) if ((ng > 0) | (*i > 0)) {
r = sqrt(sq = ng + *i); if (r * r == sq) ng & 1 ? even.push_back(sq) : odd.push_back(sq); } }
};
 
// formats elasped time
string dFmt(duration<double> et, int digs) {
string res = ""; double dt = et.count();
if (dt > 60.0) { int m = (int)(dt / 60.0); dt -= m * 60.0; res = to_string(m) + "m"; }
res += to_string(dt); return res.substr(0, digs - 1) + 's';
}
 
// combines list of square differences with list of square sums, reports compatible results
VS dump(int nd, VU lo, VU hi) {
VS res {};
for (auto l : lo) for (auto h : hi) {
auto r { (h - l) >> 1 }, z { h - r };
if (izRev(nd, r, z)) {
char buf[99]; sprintf(buf, "%20llu %11lu %10lu", z, (long long)sqrt(h), (long long)sqrt(l));
res.push_back(buf); } } return res;
}
 
const double fac = 3.94;
const int mbs = (int)sqrt(fac * pow10[9]), mbt = (int)sqrt(fac * fac * pow10[9]) >> 3;
const bitset<100000>bs {[]{bitset<100000>n{false}; for(int g{3};g<mbs;g+=3) n[(g*g)%100000]=true; return n;}()};
const bitset<100000>bt {[]{bitset<100000>n{false}; for(int g{11};g<mbt;g++) n[(g*g)%100000]=true; return n;}()};
 
// reports one block of digits
void doOne(int n, nLH L, nLH H) {
VS lines = dump(n, L.even, H.even); lines += dump(n, L.odd , H.odd); sort(lines.begin(), lines.end());
duration<double> tet = (tmp = steady_clock::now()) - st; int ls = lines.size();
if (ls-- > 0)
for (int i = 0; i <= ls; i++)
printf("%3d %s%s", ++c, lines[i].c_str(), i == ls ? "" : "\n");
else printf("%s", string(47, ' ').c_str());
printf(" %2d: %s %s\n", n, dFmt(tmp - st0, 8).c_str(), dFmt(tet, 8).c_str()); st0 = tmp;
}
 
class Rare {
const nLH makeL(const int n) {
constexpr int r = 9; acc = llim = 0; Z1 g = [] { return Z2 {}; }; int s = -r, q = (n > 11) * 5;
for (int i = 1; i < n / 2 - q + 1; ++i) {
l = pow10[n - i - q] - pow10[i + q - 1]; s -= i == n / 2 - q; g = fG(g, s, r, -r, l, acc += l * s); }
return q ? nLH( g, [g0{0}, g1{0}, g2{0}, g3{0}, g4{0}, l3{pow10[n - 5]}] () mutable {
vector<long long> w {}; long long g; while (g0 < 7) {
if (bs[((g = -10000 * g4 -1000 * g3 - 100 * g2 - 10 * g1 - g0) + 1000000000000LL) % 100000]) w.push_back(l3 * (g4 + g3 * 10 + g2 * 100 + g1 * 1000 + g0 * 10000) + g);
if (g4 < r) ++g4; else { g4 = -r; if (g3 < r) ++g3; else { g3 = -r; if (g2 < r) ++g2; else { g2 = -r; if (g1 < r) ++g1; else { g1 = -r; g0 += li[g0]; } } } } }
return w; } () ) : nLH(g);
}
const nLH makeH(const int n) {
constexpr int r = 18; llim = pow10[n - 1] << 2; acc = -pow10[n >> 1] - pow10[(n - 1) >> 1]; Z1 g = [] { return Z2 {}; };
int q = (n > 11) * 5;
for (int i = 1; i < (n >> 1) - q + 1; ++i)
g = fG(g, 0, r, 0, pow10[n - i - q] + pow10[i + q - 1], acc);
if (n & 1) { l = pow10[n >> 1] << 1; g = fG(g, 0, r >> 1, 0, l, acc += l); }
return q ? nLH(g, [g0{4}, g1{0}, g2{0}, g3{0}, g4{0}, l3{pow10[n - 5]}] () mutable {
vector<long long> w {}; long long g; while (g0 < 17) {
if (bt[(g = g4 * 10000 + g3 * 1000 + g2 * 100 + g1 * 10 + g0) % 100000]) w.push_back(l3 * (g4 + g3 * 10 + g2 * 100 + g1 * 1000 + g0 * 10000) + g);
if (g4 < r) ++g4; else { g4 = 0; if (g3 < r) ++g3; else { g3 = 0; if (g2 < r) ++g2; else { g2 = 0; if (g1 < r) ++g1; else { g1 = 0; g0 += lu[g0]; } } } } }
return w; } () ) : nLH(g);
}
public: Rare(int n) { doOne(n, makeL(n), makeH(n)); }
};
 
int main(int argc, char *argv[]) {
int max = argc > 1 ? stoi(argv[1]) : 19; if (max < 2) max = 2; if (max > 19 ) max = 19;
printf("%4s %19s %11s %10s %5s %11s %9s\n", "nth", "forward", "rt.sum", "rt.diff", "digs", "block.et", "total.et");
for (int nd = 2; nd <= max; nd++) Rare(int(nd));
}</syntaxhighlight>
{{out}}
Results on the core i7-7700 @ 3.6Ghz.
<pre style="height:64ex;overflow:scroll"> nth forward rt.sum rt.diff digs block.et total.et
1 65 11 3 2: 0.00334s 0.00334s
3: 0.00289s 0.00623s
4: 0.00244s 0.00868s
5: 0.00320s 0.01188s
2 621770 836 738 6: 0.00308s 0.01496s
7: 0.00281s 0.01777s
8: 0.00336s 0.02113s
3 281089082 23708 330 9: 0.00746s 0.02860s
4 2022652202 63602 300
5 2042832002 63602 6360 10: 0.01855s 0.04715s
11: 0.09707s 0.14422s
6 868591084757 1275175 333333
7 872546974178 1320616 32670
8 872568754178 1320616 33330 12: 0.01456s 0.15879s
9 6979302951885 3586209 1047717 13: 0.04947s 0.20826s
10 20313693904202 6368252 269730
11 20313839704202 6368252 270270
12 20331657922202 6368252 329670
13 20331875722202 6368252 330330
14 20333875702202 6368252 336330
15 40313893704200 6368252 6330336
16 40351893720200 6368252 6336336 14: 0.12746s 0.33572s
17 200142385731002 20006998 69300
18 204238494066002 20122102 1891560
19 221462345754122 21045662 69300
20 244062891224042 22011022 1908060
21 245518996076442 22140228 921030
22 248359494187442 22206778 1891560
23 403058392434500 20211202 19940514
24 441054594034340 22011022 19940514
25 816984566129618 40421606 250800 15: 0.73898s 1.07470s
26 2078311262161202 64030648 7529850
27 2133786945766212 65272218 2666730
28 2135568943984212 65272218 3267330
29 2135764587964212 65272218 3326670
30 2135786765764212 65272218 3333330
31 4135786945764210 65272218 63333336
32 6157577986646405 105849161 33333333
33 6889765708183410 83866464 82133718
34 8052956026592517 123312255 29999997
35 8052956206592517 123312255 30000003
36 8191154686620818 127950856 3299670
37 8191156864620818 127950856 3300330
38 8191376864400818 127950856 3366330
39 8650327689541457 127246955 33299667
40 8650349867341457 127246955 33300333 16: 2.25107s 3.32578s
41 22542040692914522 212329862 333300
42 67725910561765640 269040196 251135808
43 86965750494756968 417050956 33000 17: 13.6768s 17.0026s
44 225342456863243522 671330638 297000
45 225342458663243522 671330638 303000
46 225342478643243522 671330638 363000
47 284684666566486482 754565658 30000
48 284684868364486482 754565658 636000
49 297128548234950692 770186978 32697330
50 297128722852950692 770186978 32702670
51 297148324656930692 770186978 33296670
52 297148546434930692 770186978 33303330
53 497168548234910690 770186978 633363336
54 619431353040136925 1071943279 299667003
55 619631153042134925 1071943279 300333003
56 631688638047992345 1083968809 297302703
57 633288858025996145 1083968809 302637303
58 633488632647994145 1083968809 303296697
59 653488856225994125 1083968809 363303363
60 811865096390477018 1273828556 33030330
61 865721270017296468 1315452006 32071170
62 871975098681469178 1320582934 3303300
63 898907259301737498 1339270086 64576740 18: 42.5039s 59.5065s
64 2042401829204402402 2021001202 18915600
65 2060303819041450202 2020110202 199405140
66 2420424089100600242 2200110022 19080600
67 2551755006254571552 2259094848 693000
68 2702373360882732072 2324811012 693000
69 2825378427312735282 2377130742 2508000
70 6531727101458000045 3454234451 1063822617
71 6988066446726832640 2729551744 2554541088
72 8066308349502036608 4016542096 2508000
73 8197906905009010818 4046976144 133408770
74 8200756128308135597 4019461925 495417087
75 8320411466598809138 4079154376 36366330 19: 5m3.388s 6m2.894s</pre>
--[[User:Enter your username|Enter your username]] ([[User talk:Enter your username|talk]]) 23:46, 25 May 2020 (UTC)
 
::Good to see the spirit of C is alive and well multyplying bools by integers and mysterious 3.94's. Idiotmatic? who cares? but old fashioned never, so perhaps int sc{0}; rather than int sc=0;. I have compiled the code using mingw on an Core I5 1035G1 and using g++ and clang++ on a Core I7 Q720 (now a very old machine). Interestingly the poor old Q720 takes about the same time for g++ and clang++ with this code. The time taken by the Core I5 1035G1 is the same as your i7 for 2..18 but interestingly about 10secs faster for 19. I shall look at the actual changes over the next few days, the important thing is that they mustnot be based on knowing the result. The timings I have obtained are:
<pre>
nth forward rt.sum rt.diff digs block.et total.et
1 65 11 3 2: 0.00027s 0.00027s
3: 0.00002s 0.00030s
4: 0.00001s 0.00031s
5: 0.00002s 0.00034s
2 621770 836 738 6: 0.00005s 0.00040s
7: 0.00025s 0.00066s
8: 0.00075s 0.00142s
3 281089082 23708 330 9: 0.00477s 0.00619s
4 2022652202 63602 300
5 2042832002 63602 6360 10: 0.01432s 0.02051s
11: 0.08783s 0.10835s
6 868591084757 1275175 333333
7 872546974178 1320616 32670
8 872568754178 1320616 33330 12: 0.01142s 0.11977s
9 6979302951885 3586209 1047717 13: 0.05034s 0.17011s
10 20313693904202 6368252 269730
11 20313839704202 6368252 270270
12 20331657922202 6368252 329670
13 20331875722202 6368252 330330
14 20333875702202 6368252 336330
15 40313893704200 6368252 6330336
16 40351893720200 6368252 6336336 14: 0.12319s 0.29331s
17 200142385731002 20006998 69300
18 204238494066002 20122102 1891560
19 221462345754122 21045662 69300
20 244062891224042 22011022 1908060
21 245518996076442 22140228 921030
22 248359494187442 22206778 1891560
23 403058392434500 20211202 19940514
24 441054594034340 22011022 19940514
25 816984566129618 40421606 250800 15: 0.72540s 1.01872s
26 2078311262161202 64030648 7529850
27 2133786945766212 65272218 2666730
28 2135568943984212 65272218 3267330
29 2135764587964212 65272218 3326670
30 2135786765764212 65272218 3333330
31 4135786945764210 65272218 63333336
32 6157577986646405 105849161 33333333
33 6889765708183410 83866464 82133718
34 8052956026592517 123312255 29999997
35 8052956206592517 123312255 30000003
36 8191154686620818 127950856 3299670
37 8191156864620818 127950856 3300330
38 8191376864400818 127950856 3366330
39 8650327689541457 127246955 33299667
40 8650349867341457 127246955 33300333 16: 2.24472s 3.26344s
41 22542040692914522 212329862 333300
42 67725910561765640 269040196 251135808
43 86965750494756968 417050956 33000 17: 13.9236s 17.1870s
44 225342456863243522 671330638 297000
45 225342458663243522 671330638 303000
46 225342478643243522 671330638 363000
47 284684666566486482 754565658 30000
48 284684868364486482 754565658 636000
49 297128548234950692 770186978 32697330
50 297128722852950692 770186978 32702670
51 297148324656930692 770186978 33296670
52 297148546434930692 770186978 33303330
53 497168548234910690 770186978 633363336
54 619431353040136925 1071943279 299667003
55 619631153042134925 1071943279 300333003
56 631688638047992345 1083968809 297302703
57 633288858025996145 1083968809 302637303
58 633488632647994145 1083968809 303296697
59 653488856225994125 1083968809 363303363
60 811865096390477018 1273828556 33030330
61 865721270017296468 1315452006 32071170
62 871975098681469178 1320582934 3303300
63 898907259301737498 1339270086 64576740 18: 42.8003s 59.9873s
64 2042401829204402402 2021001202 18915600
65 2060303819041450202 2020110202 199405140
66 2420424089100600242 2200110022 19080600
67 2551755006254571552 2259094848 693000
68 2702373360882732072 2324811012 693000
69 2825378427312735282 2377130742 2508000
70 6531727101458000045 3454234451 1063822617
71 6988066446726832640 2729551744 2554541088
72 8066308349502036608 4016542096 2508000
73 8197906905009010818 4046976144 133408770
74 8200756128308135597 4019461925 495417087
75 8320411466598809138 4079154376 36366330 19: 4m52.40s 5m52.39s
g++ (SUSE Linux) 9.2.1 20200109 [gcc-9-branch revision 280039]
40 8650349867341457 127246955 33300333 16: 15.5694s 22.0091s
43 86965750494756968 417050956 33000 17: 1m33.80s 1m55.81s
63 898907259301737498 1339270086 64576740 18: 4m57.66s 6m53.47s
75 8320411466598809138 4079154376 36366330 19: 30m31.1s 37m24.5s
 
clang version 9.0.1
 
40 8650349867341457 127246955 33300333 16: 15.1173s 21.4643s
43 86965750494756968 417050956 33000 17: 1m32.36s 1m53.82s
63 898907259301737498 1339270086 64576740 18: 4m47.22s 6m41.04s
75 8320411466598809138 4079154376 36366330 19: 29m5.71s 35m46.7s
</pre>
--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:05, 10 June 2020 (UTC)
:::Thanks for those comparisons, appreciated. Re ''3.94'', the limit is 4, I was just undercutting it a bit. --[[User:Enter your username|Enter your username]] ([[User talk:Enter your username|talk]]) 00:58, 17 June 2020 (UTC)
 
* nLH.odd / nLH.even selection based on oddness of current "outer" value, instead of the sqare itself: Okay but the odd numbers seem to be in the even bucket and the even numbers are in the odd bucket. Probably my fault for calling them odd and even since the only requirement is that the are split, not what the bucket is called, but I couldn't sleep with them the wrong way round so I've but them in the correct named bucket.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:09, 4 January 2021 (UTC)
 
* skip certain "outer" permutations which cannot produce squares (ends with 2, 3, 7, or 8), or will not produce squares for less than 20 digits (5 for diffs, and 9 & 14 for sums): There is no reason why 5 can not produce a rare number. 9 & 14 will not for any Rare number of any length. The situation for g0 and g1 for all rare numbers is:
<pre>
Diffs (L)
 
g0 -> g1
0 -> 0
1 -> -7..2..9
4 -> -8..2..8
5 -> -3;7
6 -> -9..2..9
 
Sums (H)
 
g0 -> g1
4 -> 0..2..18
6 -> 1..2..17
10 -> 9
11 -> 1..2..17
15 -> 1;11
16 -> 0..2..18
</pre>
--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:09, 4 January 2021 (UTC)
* Do 2 through 11 digits by only looking at "middles" (no "outers") - accomplished by adding an additional definition for nLH() that takes only the function of optional long when doing less that 12 digits, limit diffs to be above zero, and sums to be above a limit at which smaller squares produced are less than the forward number itself (pow10[n-1] * 4) makeL(), makeH() return nLH() now, instead of nLH() components: Okay but no need for an extra global variable. It is really a parameter to nLH's constructor (single) as now only one constructor is required.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:09, 4 January 2021 (UTC)
* The pair "construction" shouldn't incur an overhead as the compiler should optimize it away. It adds flexability to the design, the need for which I shall reserve judgement.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:09, 4 January 2021 (UTC)
:::Thank you for the code review and adopting some of the tweaks I presented. Good fix for my awkward handling of digits 2-11. I agree about the pair construction, I only removed it to speed up my C# translation, which was slightly impacting performance (perhaps due to an awkward translation on my part.)<br><br>
:::I agree that digit '5' ought to be considered in the "diff" side. Even though it doesn't contribute to any solution in the ''Int64'' range, if ''Int128'' ever becomes part of C++, your program should be easily extended to the point where checking "diff 5" will contribute a solution. My decision to omit checking '5' was for performance reasons since we are constricted to ''Int64''.--[[User:Enter your username|Enter your username]] ([[User talk:Enter your username|talk]]) 00:01, 25 January 2021 (UTC)
 
== 21+ digit rare numbers ==
Line 1,041 ⟶ 1,407:
 
::::::I tried compiling it using MSVC. It crashed the compiler, well at least caused it to catch an internal error.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 16:40, 13 March 2020 (UTC)
 
==Broken Link==
The link to lots of facts and hints on the main page seems to be broken!
35

edits