8 #ifndef PROGS_SRC_COMMON_SIGMAODD_HARMONIC__INLINE_HPP_ 9 #define PROGS_SRC_COMMON_SIGMAODD_HARMONIC__INLINE_HPP_ 24 h += 1.0/
static_cast<double>(i);
43 for (
nat_type i = 1; i <= n; i += 2) {
44 h += 1.0/
static_cast<double>(i);
52 #endif // PROGS_SRC_COMMON_SIGMAODD_HARMONIC__INLINE_HPP_ uint64_t nat_type
Type for natural number used in all code, on 64 bits.
A lot of functions and stuffs to deal the sigma_odd problem and related stuffs.
constexpr double harmonic_even(nat_type n)
Return 1/2 + 1/4 + 1/6 + 1/8 + ... + (1/n or 1/(n-1)).
constexpr double harmonic(nat_type n)
Return the harmonic number H_n = 1/1 + 1/2 + 1/3 + 1/4 + ... + 1/n.
constexpr double harmonic_odd(nat_type n)
Return 1/1 + 1/3 + 1/5 + 1/7 + ... + (1/n or 1/(n-1)).