Multi-base primes: Difference between revisions
m
Updated C++ code to match Wren/Go
(Added Go) |
m (Updated C++ code to match Wren/Go) |
||
Line 46:
=={{header|C++}}==
{{trans|Wren}}
This takes
<lang cpp>#include <algorithm>
#include <cmath>
Line 133:
void multi_base_primes::process(const std::vector<unsigned int>& indices) {
std::vector<unsigned int> bases;▼
auto max = std::max_element(indices.begin(), indices.end());
unsigned int min_base = 2;
if (max != indices.end())
min_base = std::max(min_base, *max + 1);
if (most_bases > max_base - min_base)
return;
▲ std::vector<unsigned int> bases;
for (unsigned int b = min_base; b <= max_base; ++b) {
uint64_t n = 0;
|