16 #include "../../common/sigmaodd/divisors.hpp" 17 #include "../../common/sigmaodd/sigmaodd.hpp" 33 assert(first_n <= last_n);
36 assert(last_n < 65536);
39 std::set<nat_type> bad_table;
41 for (
nat_type n = first_n; n <= last_n; n += 2) {
48 std::cout << n << std::endl;
62 const std::set<nat_type> &bad_table,
67 assert(first_n <= last_n);
70 assert(last_n < 65536);
73 std::set<nat_type> new_bad_table;
75 for (
nat_type n = first_n; n <= last_n; n += 2) {
79 bad_first_n, bad_last_n)) {
80 new_bad_table.insert(n);
82 std::cout << n << std::endl;
103 assert(3 <= first_n);
104 assert(first_n <= last_n);
107 assert(last_n < 65536);
110 for (
nat_type n = first_n; n <= last_n; n += 2) {
115 print_bad, print_all,
117 print_lower, print_length, print_path);
137 const std::vector<nat_type> path
143 print_lower, print_length, print_path);
157 assert(3 <= first_n);
158 assert(first_n <= last_n);
161 assert(last_n < 65536);
164 for (
nat_type n = first_n; n <= last_n; n += 2) {
170 print_bad, print_all,
172 print_lower, print_length, print_path);
197 print_lower, print_length, print_path);
203 const std::set<nat_type> &bad_table,
220 while ((prime = *(++prime_ptr)) <= sqrt_n_divided) {
223 unsigned int alpha = 0;
237 sqrt_n_divided) < n) {
248 return (varsigma_odd < n);
254 const std::set<nat_type> &bad_table,
271 while ((prime = *(++prime_ptr)) <= sqrt_n_divided) {
274 unsigned int alpha = 0;
288 sqrt_n_divided) < n) {
299 return (varsigma_odd < n);
303 std::vector<nat_type>
306 assert(3 <= start_n);
309 assert(start_n < 65536);
313 std::set<nat_type> already;
314 std::vector<nat_type> path;
321 if (already.find(n) != already.end()) {
322 std::cout <<
"! Found not trivial cycle ";
324 std::cout << std::endl;
329 std::cout <<
"! Impossible to check ";
331 std::cout << std::endl;
344 std::vector<nat_type>
348 assert(3 <= start_n);
351 assert(start_n < 65536);
355 std::set<nat_type> already;
356 std::vector<nat_type> path;
367 std::cout <<
"! Impossible to check ";
369 std::cout << std::endl;
375 if (already.find(n) != already.end()) {
376 std::cout <<
"! Found not trivial cycle ";
378 std::cout << std::endl;
391 std::vector<nat_type>
394 assert(3 <= start_n);
397 assert(start_n < 65536);
401 std::set<nat_type> already;
402 std::vector<nat_type> path;
409 if (already.find(n) != already.end()) {
410 std::cout <<
"! Found not trivial cycle ";
412 std::cout << std::endl;
417 std::cout <<
"! Impossible to check ";
419 std::cout << std::endl;
426 }
while (n > start_n);
432 std::vector<nat_type>
436 assert(3 <= start_n);
439 assert(start_n < 65536);
443 std::set<nat_type> already;
444 std::vector<nat_type> path;
455 std::cout <<
"! Impossible to check ";
457 std::cout << std::endl;
463 if (already.find(n) != already.end()) {
464 std::cout <<
"! Found not trivial cycle ";
466 std::cout << std::endl;
473 }
while (n > start_n);
479 std::vector<nat_type>
481 std::vector<nat_type> list;
483 list.insert(list.begin(), ns.cbegin(), ns.cend());
484 sort(list.begin(), list.end());
486 std::cout << n << std::endl;
509 while ((prime = *(++prime_ptr)) <= sqrt_n_divided) {
512 unsigned int alpha = 0;
551 while (*(++p) <= sqrt4_n) {
554 unsigned int alpha = 0;
572 unsigned int alpha = 0;
589 const std::set<nat_type> &bad_table,
592 std::set<nat_type> new_bad_table;
603 new_bad_table.insert(n);
607 return new_bad_table;
std::vector< nat_type > sequential_print_in_order(const std::set< nat_type > &ns)
Print number from ns, in increasing order and return a list of these number in the same order...
std::set< nat_type > sequential_check_gentle_varsigma_odd(nat_type first_n, nat_type last_n, bool print_bad)
Check in the order all odd gentle numbers between first_n and last_n, and if print_bad then print all...
constexpr nat_type sum_geometric_progression_strict(nat_type r, unsigned int k)
Return sum_geometric_progression(r, k) but only for r > 1.
void sequential_check_varsigma_odd_perfect_square(nat_type n, bool print, bool print_lower, bool print_length, bool print_path)
Return sequential_check_varsigma_odd(), but only for n perfect square.
nat_type floor_square_root(nat_type n)
Return the square root of n rounded to below.
sigmaodd::nat_type nat_type
void print_path_infos(const std::vector< nat_type > &path, bool print_bad, bool print_all, bool print_category, bool print_lower, bool print_length, bool print_path, std::ostream &out)
Send (if the below condition is true) to the stream a string representation of the path with some inf...
constexpr bool is_odd(nat_type n)
Return true iff n is odd.
sigmaodd::prime_type prime_type
std::vector< nat_type > sequential_iterate_varsigma_odd_perfect_square_until_1(nat_type start_n)
Return sequential_iterate_varsigma_odd_until_1(), but only for n perfect square.
std::vector< nat_type > sequential_iterate_varsigma_odd_until_lower(nat_type start_n)
Iterate sequential_varsigma_odd(start_n) until to be have a result < start_n. Return this partial pat...
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.
bool sequential_is_varsigma_odd_lower(nat_type n, const std::set< nat_type > &bad_table, nat_type bad_first_n)
Return true iff varsigma_odd(n) < n.
bool is_square(nat_type n)
Return true iff n is a perfect square.
std::set< nat_type > sequential_varsigma_odd_greater_set(const std::vector< nat_type > &ns, const std::set< nat_type > &bad_table, nat_type bad_first_n, nat_type bad_last_n)
Return the set of n from ns such that varsigma_odd(n) > 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...
constexpr bool is_divide(nat_type d, nat_type n)
Return true iff d divide n, i.e. if n is divisible by d.
const prime_type * odd_primes_table_ptr()
Return a pointer to the first number in the precalculated table.
nat_type sequential_varsigma_odd_perfect_square(nat_type n)
Return sequential_varsigma_odd(), but only for n perfect square.
void sequential_check_varsigma_odd_perfect_square_complete(nat_type n, bool print, bool print_lower, bool print_length, bool print_path)
Return sequential_check_varsigma_odd_complete(), but only for n perfect square.
nat_type floor_fourth_root(nat_type n)
Return the fourth root of n rounded to below.
Implementation of the sequential algorithms presented in the report. (Some functions are not use in t...
constexpr nat_type sequential_sigma_odd_upper_bound_with_sqrt(nat_type n, const std::set< nat_type > &bad_table, nat_type bad_first_n, nat_type sqrt_n)
Return an upper bound of varsigma_odd(n).
std::vector< nat_type > sequential_iterate_varsigma_odd_until_1(nat_type start_n)
Iterate sequential_varsigma_odd(start_n) until to reach 1. Return this complete path.
constexpr bool is_first_mersenne_prime_unitary_divide_or_square(nat_type n)
Return true iff is_first_mersenne_prime_unitary_divide(n) or is_square(n).
void print_path(const std::vector< nat_type > &path, std::ostream &out)
Send to the stream a string representation of the path. All numbers are separated by the correspondin...
constexpr bool is_first_mersenne_prime_unitary_divide(nat_type n)
Return true iff at least one of 3, 7, 31 or 127 is an unitary divisor of n.
std::vector< nat_type > sequential_iterate_varsigma_odd_perfect_square_until_lower(nat_type start_n)
Return sequential_iterate_varsigma_odd_until_lower(), but only for n perfect square.
constexpr double square(double x)
Return x*x.
nat_type sequential_varsigma_odd(nat_type n)
Return varsigma_odd(n), i.e. the sum of all odd divisors of n, divided by 2 until to be odd...
prime_type * array_odd_primes_
Array of all odd prime numbers < 2^28 with a final 0. (Or < 2^16 if the macro PRIME16 is defined...
void sequential_check_varsigma_odd(nat_type first_n, nat_type last_n, bool print_bad, bool print_all, bool print_category, bool print_lower, bool print_length, bool print_path)
Check in the order all odd numbers between first_n and last_n. The consequence of the result is that:...
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...