#include <iostream>
#include <vector>
#include <cstdint>

constexpr bool is_prime(std::uint64_t num) noexcept
{
    if (num == 1)
    {
        return false;
    }

    // Assumes that num is never overflow and NOT negative
    // Trying negative numbers results in UB
    for (std::uint64_t i = 2; i < num; i++)
    {
        if (num % 2 == 0)
        {
            return false;
        }
    }
    return true;
}

auto get_prime_numbers(std::uint64_t min, std::uint64_t max)
{
    std::vector<std::uint64_t> prime_nums{};

    for (std::uint64_t i = min; i <= max; i++)
    {
        if (is_prime(i))
        {
            prime_nums.emplace_back(i);
        }
    }

    return prime_nums;
}

int main()
{
    std::uint64_t min;
    std::uint64_t max;

    std::cout << "Range begin: "; std::cin >> min;
    std::cout << "Range end: "; std::cin >> max;

    const auto result{get_prime_numbers(min, max)};

    for (auto val : result)
    {
        std::cout << val << "\n";
    }

    return 0;
}
