10 #ifndef PROGS_SRC_COMMON_SIGMAODD_HELPER_HPP_ 11 #define PROGS_SRC_COMMON_SIGMAODD_HELPER_HPP_ 40 #pragma GCC diagnostic push 41 #pragma GCC diagnostic ignored "-Wpedantic" 43 #pragma GCC diagnostic pop 126 std::vector<nat_type>
128 const std::vector<nat_type> &bad_table = std::vector<nat_type>());
136 std::vector<nat_type>
145 pow_nat(nat_type n,
unsigned int k);
235 #endif // PROGS_SRC_COMMON_SIGMAODD_HELPER_HPP_ constexpr nat_type sum_geometric_progression(nat_type r, unsigned int k)
Return the sum of the (k + 1) terms of the geometric progression of the common ratio r...
constexpr nat_type sum_geometric_progression_strict(nat_type r, unsigned int k)
Return sum_geometric_progression(r, k) but only for r > 1.
nat_type floor_square_root(nat_type n)
Return the square root of n rounded to below.
uint64_t nat_type
Type for natural number used in all code, on 64 bits.
nat_type ceil_square_root(nat_type n)
Return the square root of n rounded to above.
constexpr bool is_odd(nat_type n)
Return true iff n is odd.
nat_type ceil_eighth_root(nat_type n)
Return the eighth root of n rounded to above.
constexpr bool is_even(nat_type n)
Return true iff n is even.
nat_type floor_eighth_root(nat_type n)
Return the eighth root of n rounded to below.
A lot of functions and stuffs to deal the sigma_odd problem and related stuffs.
constexpr nat_type MAX_POSSIBLE_N
Lower bound of the bigger number such that it is possible to compute the result of the sigma function...
constexpr nat_type pow_nat(nat_type n, unsigned int k)
Return x^k, x power k.
nat_type ceilx_fourth_root(nat_type n)
Return the fourth root of n rounded to above.
unsigned __int128 tmp_uint128_type
Type double size for some temporary calculation.
nat_type floor_fourth_root(nat_type n)
Return the fourth root of n rounded to below.
std::vector< nat_type > load_numbers(const std::string &filename)
Read the file and extract each natural number begining a line. Return the list of these numbers...
constexpr double square(double x)
Return x*x.
std::vector< nat_type > load_bad_table(const std::string &filename, const std::vector< nat_type > &bad_table)
Read a file that contains list of bad numbers, add after bad_table, and return the result...
constexpr nat_type sum_natural(nat_type n)
Return 1 + 2 + 3 + 4 + ... + n = n(n + 1)/2.
constexpr nat_type sum_even(nat_type n)
Return 2 + 4 + 6 + 8 + ... + (n or n-1) = k(k + 1) with k = floor(n/2).
constexpr nat_type sum_odd(nat_type n)
Return 1 + 3 + 5 + 7 + ... + (n or n-1) = k^2 with k floor((n+1)/2).