39 std::cerr <<
"Usage: table [options]" << std::endl
41 <<
"Options:" << std::endl
42 <<
" --first n first number to check (1 by default)" << std::endl
43 <<
" --last n last number to check (101 by default)" << std::endl
44 <<
" --nb n number of odd numbers to check" << std::endl;
56 main(
int argc,
const char*
const argv[]) {
70 for (
unsigned int i = 1; i < static_cast<unsigned int>(argc); ++i) {
71 const std::string param(argv[i]);
73 if (param ==
"--first") {
76 else if (param ==
"--last") {
79 else if (param ==
"--nb") {
93 std::cout <<
"First: " << first
95 <<
"\tNb: " << (first <= last
102 std::cout << std::endl
103 <<
"n\tsigma\tsigma_odd\tvarsigma_odd" 116 <<
'\t' << varsum_odd
Define type and some generic functions.
uint64_t nat_type
Type for natural number used in all code, on 64 bits.
const std::string prime_filename
Default filename for the binary file "big_data/prime28.bin".
nat_type sum_odd_divisors_divided_until_odd__factorize(nat_type n, bool skip_primes_table)
Calculates the sum of all odd divisors of n by the factorization method, divides the results by 2 unt...
int main(int argc, const char *const argv[])
bool read_primes_table()
Read the binary file prime_filename to fill the table with all primes < 2^28. This table must be read...
nat_type varsum_odd(nat_type n)
Calculates the sum of all odd divisors of n by the factorization method, divides the results by 2 unt...
Functions to access to tables of precaculated prime numbers and offsets to iterate on possible prime ...
nat_type sum_odd_divisors__factorize(nat_type n)
Calculates the sum of odd divisors of n by the factorization method and returns it.
nat_type sum_divisors__factorize(nat_type n)
Calculates the sum of all divisors of n by the factorization method and returns it.
Some generic helper functions for programs.
void print_intern_config_compiler()
Print to stdcout the intern configuration of the compiler.
Main functions to deal the sigma_odd problem.
unsigned long get_ulong(int argc, const char *const argv[], unsigned int i, void(*help_and_exit_function)())
Return argv[i] converted in integer.
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).