20 #include "../common/helper/helper.hpp" 40 std::cerr <<
"Usage: interactive [options]" << std::endl
42 <<
" --no-prompt do not print the prompt" << std::endl
43 <<
" --no-separator do not print the separator" << std::endl;
55 main(
int argc,
const char*
const argv[]) {
65 bool separator =
true;
69 for (
unsigned int i = 1; i < static_cast<unsigned int>(argc); ++i) {
70 const std::string param(argv[i]);
72 if (param ==
"--no-prompt") {
75 else if (param ==
"--no-separator") {
88 std::cout <<
"0 or CTRL-D for exit" << std::endl;
98 std::cout <<
">>> n = ";
102 if (std::cin.eof()) {
108 if (!std::all_of(s.cbegin(), s.cend(),
109 [] (
int c) {
return ((
'0' <= c) && (c <=
'9')); })) {
121 std::cout <<
"Too big!" << std::endl;
140 const std::set<sigmaodd::nat_type> empty_bad_table;
145 std::cout <<
"n = " << n;
146 if ((prime_exps.size() > 1)
147 || ((prime_exps.size() == 1) && (prime_exps[0].exp > 1))) {
150 || ((prime_exps.size() == 2) && (prime_exps[1].exp > 1)))) {
151 std::cout <<
" = " << prime_exps[0] <<
' ' << n_odd;
156 std::cout <<
' ' << prime_exp;
165 std::cout <<
"fixed point";
168 std::cout <<
"square";
170 else if (varsigma_odd > n) {
174 std::cout <<
"gentle";
179 std::cout <<
"\tnu_odd(n) = " << nu_odd;
181 std::cout <<
" < nu(n) = " << nu;
186 std::cout <<
"\tvarsigma_odd(n) = " << varsigma_odd
187 <<
' ' << (varsigma_odd == sigma_odd
189 :
'<')<<
" sigma_odd(n) = " << sigma_odd;
191 std::cout <<
" < sigma(n) = " << sigma;
194 std::cout <<
"\t sigma_odd(n) upper bound = " << sigma_odd_upper_bound
206 std::cout << std::string(50,
'-') << std::endl;
211 std::cout << std::endl;
uint64_t nat_type
Type for natural number used in all code, on 64 bits.
Structure to represent a factor with its exponent.
nat_type factorization_to_nu_odd(std::vector< FactorExp > prime_exps)
Return the number of odd divisors of the number corresponding to the factorization.
const std::string prime_filename
Default filename for the binary file "big_data/prime28.bin".
void sequential_check_varsigma_odd_complete(nat_type first_n, nat_type last_n, bool check_useless, bool print_bad, bool print_all, bool print_category, bool print_lower, bool print_length, bool print_path)
Check completely (until 1) in the order all odd numbers between first_n and last_n. The consequence of the result is that: all odd numbers checked between first_n and last_n (included) respect the conjecture.
nat_type divide_until_odd(nat_type n)
Return n divided by 2 until the result is odd.
constexpr bool is_even(nat_type n)
Return true iff n is even.
bool is_square(nat_type n)
Return true iff n is a perfect square.
bool read_primes_table()
Read the binary file prime_filename to fill the table with all primes < 2^28. This table must be read...
constexpr nat_type sequential_sigma_odd_upper_bound(nat_type n, const std::set< nat_type > &bad_table, nat_type bad_first_n)
Return an upper bound of varsigma_odd(n).
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...
nat_type sum_odd_divisors__factorize(nat_type n)
Calculates the sum of odd divisors of n by the factorization method and returns it.
std::vector< FactorExp > factorize(nat_type n)
Return a list of prime factors with their exponents.
nat_type sum_divisors__factorize(nat_type n)
Calculates the sum of all divisors of n by the factorization method and returns it.
Implementation of the sequential algorithms presented in the report. (Some functions are not use in t...
nat_type factorization_to_sigma_odd(std::vector< FactorExp > prime_exps)
Return the sum of odd divisors of the number corresponding to the factorization.
nat_type factorization_to_sigma(std::vector< FactorExp > prime_exps)
Return the sum of all divisors of the number corresponding to the factorization.
void print_intern_config_compiler()
Print to stdcout the intern configuration of the compiler.
int main(int argc, const char *const argv[])
nat_type sigma_odd_upper_bound(nat_type n)
Return an upper bound of sigma_odd(n).
nat_type factorization_to_nu(std::vector< FactorExp > prime_exps)
Return the number of all divisors of the number corresponding to the factorization.
std::string to_string(bool b)
Return the string "true" if b, else "false".
nat_type varsigma_odd(__global const prime_type *primes, nat_type n)
Return varsigma_odd(n), i.e. the sum of all odd divisors of n, divided by 2 until to be odd...