| 1 | //! @file prime.hpp |
| 2 | //! @author ryftchen |
| 3 | //! @brief The declarations (prime) in the numeric module. |
| 4 | //! @version 0.1.0 |
| 5 | //! @copyright Copyright (c) 2022-2025 ryftchen. All rights reserved. |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #include <cstdint> |
| 10 | #include <vector> |
| 11 | |
| 12 | //! @brief The numeric module. |
| 13 | namespace numeric // NOLINT(modernize-concat-nested-namespaces) |
| 14 | { |
| 15 | //! @brief Prime-related functions in the numeric module. |
| 16 | namespace prime |
| 17 | { |
| 18 | //! @brief Brief function description. |
| 19 | //! @return function description (module_function) |
| 20 | inline static const char* description() noexcept |
| 21 | { |
| 22 | return "NUM_PRIME" ; |
| 23 | } |
| 24 | extern const char* version() noexcept; |
| 25 | |
| 26 | //! @brief Prime methods. |
| 27 | class Prime |
| 28 | { |
| 29 | public: |
| 30 | //! @brief Eratosthenes. |
| 31 | //! @param limit - maximum positive integer |
| 32 | //! @return all prime numbers that are not greater than the maximum positive integer |
| 33 | static std::vector<std::uint32_t> eratosthenes(const std::uint32_t limit); |
| 34 | //! @brief Euler. |
| 35 | //! @param limit - maximum positive integer |
| 36 | //! @return all prime numbers that are not greater than the maximum positive integer |
| 37 | static std::vector<std::uint32_t> euler(const std::uint32_t limit); |
| 38 | }; |
| 39 | } // namespace prime |
| 40 | } // namespace numeric |
| 41 | |