8 #ifndef PROGS_SRC_COMMON_SIGMAODD_HELPER__INLINE_HPP_ 9 #define PROGS_SRC_COMMON_SIGMAODD_HELPER__INLINE_HPP_ 102 return (rk - 1)/(r - 1) + rk;
168 #endif // PROGS_SRC_COMMON_SIGMAODD_HELPER__INLINE_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 pow_nat(nat_type n, unsigned int k)
Return x^k, x power k.
nat_type ceil_fourth_root(nat_type n)
nat_type floor_fourth_root(nat_type n)
Return the fourth root of n rounded to below.
constexpr double square(double x)
Return x*x.
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).