Multi-base primes: Difference between revisions
m
C++ performance improvement
m (C++ - specify CPU model) |
m (C++ performance improvement) |
||
Line 45:
=={{header|C++}}==
Originally translated from [[#Wren|Wren]] with ideas borrowed from other solutions.
The maximum base and number of characters can be specified as command line arguments.
<lang cpp>#include <algorithm>
Line 129:
bases.clear();
for (unsigned int b = min_base; b <= max_base; ++b) {
if (max_base - b + 1 + bases.size() < most_bases)
break;
uint64_t n = 0;
for (auto d : digits)
Line 174 ⟶ 176:
{{out}}
Maximum base 36 and maximum length 6. This takes 0.
<pre>
1-character strings which are prime in most bases: 34
Line 199 ⟶ 201:
</pre>
Maximum base 62 and maximum length 5. This takes 0.
<pre>
1-character strings which are prime in most bases: 60
|