Bitcoin full node and query server

Apr 7, 2024

View in context in the libbitcoin Slack #general mirror.

evoskuil15:29
std::vector<size_t> 
tuple_sizes_from_set_size(size_t set)
{
    using namespace system;

    if (set < 3) return {};
    if (is_odd(set)) return {};

std::vector<size_t> out{};
for (auto tuple = one;
     tuple <= to_half(set);
     tuple *= two)
    {
        for (auto u = set - tuple,
             auto t = tuple;
             !is_zero(t);
             t = to_half(t),
             u = to_half(u))
        {
            if (is_odd(u))
            {
                if (t == one) out.push_back(tuple);
                break;
            }
        }
    }

    return out;
}
(edited)