Loading [MathJax]/extensions/tex2jax.js
Parallel numerical verification of the σ_odd problem  October 6, 2018
All Classes Namespaces Files Functions Variables Typedefs Macros
pentagonal.hpp
Go to the documentation of this file.
1 /* -*- coding: latin-1 -*- */
2 /** \file common/sigmaodd/pentagonal.hpp (December 9, 2017)
3  * \brief
4  * Functions to calculate pentagonal numbers
5  * and one useless algorithm that used the Euler formula to calculate the sum of divisors.
6  *
7  * http://mathworld.wolfram.com/PentagonalNumber.html
8  *
9  * GPLv3 --- Copyright (C) 2017 Olivier Pirson
10  * http://www.opimedia.be/
11  */
12 
13 #ifndef PROGS_SRC_COMMON_SIGMAODD_PENTAGONAL_HPP_
14 #define PROGS_SRC_COMMON_SIGMAODD_PENTAGONAL_HPP_
15 
16 #include "helper.hpp"
17 
18 
19 namespace sigmaodd {
20 
21  /* ************
22  * Prototypes *
23  **************/
24 
25  /** \brief
26  * Return the pentagonal number of n.
27  *
28  * https://oeis.org/A000326
29  *
30  * @return (3n - 1)n / 2
31  */
32  constexpr
33  nat_type
35 
36 
37  /** \brief
38  * Return the generalized pentagonal number of -n.
39  *
40  * https://oeis.org/A005449
41  *
42  * @return (3n + 1)n / 2
43  */
44  constexpr
45  nat_type
47 
48 
49  /** \brief
50  * Calculates the sum of all divisors of n with the Euler formula about pentagonal numbers
51  * and returns it.
52  *
53  * @param n != 0
54  *
55  * @return the sum of all divisors of n
56  */
57  nat_type
59 
60 
61  /** \brief
62  * Return true iff the cache used by sum_divisors__euler() is full.
63  * The function can clean space, but it is less efficient.
64  */
65  bool
67 
68 
69  /** \brief
70  * Return the current number of items in the cache used by sum_divisors__euler()
71  */
72  std::size_t
74 
75 
76  /** \brief
77  * Return the (constant) number of items in the table used by sum_divisors__euler()
78  */
79  std::size_t
81 
82 } // namespace sigmaodd
83 
84 #include "pentagonal__inline.hpp"
85 
86 #endif // PROGS_SRC_COMMON_SIGMAODD_PENTAGONAL_HPP_
unsigned long nat_type
Type for natural number used in all code, on 64 bits.
Definition: sigmaodd.cl:22
Define type and some generic functions.
std::size_t sum_divisors__euler_cache_nb()
Return the current number of items in the cache used by sum_divisors__euler()
Definition: pentagonal.cpp:158
constexpr nat_type pentagonal_neg(nat_type n)
Return the generalized pentagonal number of -n.
A lot of functions and stuffs to deal the sigma_odd problem and related stuffs.
Definition: divisors.cpp:22
bool sum_divisors__euler_cache_is_full()
Return true iff the cache used by sum_divisors__euler() is full. The function can clean space...
Definition: pentagonal.cpp:152
constexpr nat_type pentagonal(nat_type n)
Return the pentagonal number of n.
std::size_t sum_divisors__euler_table_nb()
Return the (constant) number of items in the table used by sum_divisors__euler()
Definition: pentagonal.cpp:164
nat_type sum_divisors__euler(nat_type n)
Calculates the sum of all divisors of n with the Euler formula about pentagonal numbers and returns i...
Definition: pentagonal.cpp:70