This project is a C++ implementation of my paper "Improved Algorithms for Integer Complexity"[1] for computing the integer complexity
For more context, see OEIS A005245.
[1] Qizheng He, Improved Algorithms for Integer Complexity, arXiv:2308.10301 [cs.DS], 2023.
-
$f(2^i)=2i$ ? -
$f(2^i3^j5^k)=2i+3j+5k$ ($k\leq 5$ )? -
$f(2^i+1)=2i+1$ ? (except 3 and 9) -
$f(p^i)=i\cdot f(p)$ , for$p=109,433,163,487,2$ ?
The theoretical running time of the single-target algorithm is
For integers within long long (
For larger integers within u128, see single.cpp. It used C-RHO and C-Quadratic-Sieve for factoring. It also supports printing the formulas.
Run compile.bat to compile.
The code also supports computing the integer complexity using the operators
We designed a more efficient algorithm that can compute an upper bound for the integer complexity, which holds for a set of numbers with natural density 1. The result is correct with high probability.
upper_bound_slow.cpp:
upper_bound.cpp:
upper_bound_3D.cpp:
upper_bound_slow_4D.cpp: using base
upper_bound_slow_5D.cpp: using base
See upper_bound_3D.cpp.
- Use a better factorization library.
- Use parallelization.
- Improve the lower bound computation.
- Need u256 and more memory for a significantly larger range.
This project is shared under the terms of the GNU General Public License.