36 const std::string color = (is_sqr
39 const unsigned int penwidth = (is_sqr
44 std::cout <<
" " << from <<
" [style=filled" 46 ?
", height=3, width=3" 50 else if ((from < to) || (length > 1)) {
51 std::cout <<
" " << from <<
" [color=" << color <<
", style=filled];" << std::endl;
58 if ((from < to) || (length > 1)) {
59 std::cout <<
" [color=" << color <<
", penwidth=" << penwidth;
66 std::cout <<
';' << std::endl;
77 bool shortcut,
bool circular) {
81 std::map<nat_type, std::pair<nat_type, unsigned int>> map;
83 map[1] = std::make_pair(1, 1);
85 for (
nat_type start_n = first; start_n <= last; start_n += 2) {
95 map[n] = std::make_pair(to, 1);
103 std::cout <<
"digraph \"sigma odd\" {" << std::endl
105 ?
" layout=\"circo\";" 106 :
" rankdir=\"LR\";") << std::endl;
108 std::cout <<
" node[shape=point];" << std::endl;
110 std::cout << std::endl;
112 for (std::pair<
nat_type, std::pair<nat_type, unsigned int>> from_to_length : map) {
113 print_arrow_(from_to_length.first, from_to_length.second.first,
114 from_to_length.second.second, circular);
117 std::cout <<
'}' << std::endl;
unsigned long nat_type
Type for natural number used in all code, on 64 bits.
uint64_t nat_type
Type for natural number used in all code, on 64 bits.
constexpr bool is_odd(nat_type n)
Return true iff n is odd.
std::pair< nat_type, unsigned int > sum_odd_divisors_divided_until_odd_iterate_until_lower__factorize(nat_type n)
Iterates the sum_odd_divisors_divided_until_odd__factorize() function from n until have a result lowe...
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...
bool is_square(nat_type n)
Return true iff n is a perfect square.
void print_arrow_(nat_type from, nat_type to, unsigned int length, bool circular)
A lot of functions and stuffs to deal the sigma_odd problem and related stuffs.
To produce graph DOT file.
void print_varsigmaodd_dot(nat_type first, nat_type last, bool show_node, bool shortcut, bool circular)
Print to std::cout in a DOT format, a graph of path of the sigma odd problem.
Main functions to deal the sigma_odd problem.
std::string to_string(bool b)
Return the string "true" if b, else "false".