Skip to main content
QUICK REVIEW

[Paper Review] Algorithms for determining integer complexity

Juan Arias de Reyna, J. Lune|arXiv (Cornell University)|Apr 8, 2014
Advanced Combinatorial MathematicsMathematics5 references8 citations
TL;DR

This paper presents an optimized algorithm for computing the integer complexity ‖n‖—the minimum number of 1s needed to express n using only +, ×, and parentheses—across all n ≤ N. By leveraging a space-efficient block-based approach inspired by Martin N. Fuller's work, the authors achieve O(N^α) time complexity with α ≈ 1.230175 and O(N^{(1+β)/2} log log N) space, significantly improving upon prior O(N²) and O(N log²N) methods.

ABSTRACT

We present three algorithms to compute the complexity $\Vert n\Vert$ of all natural numbers $ n\le N$. The first of them is a brute force algorithm, computing all these complexities in time $O(N^2)$ and space $O(N\log^2 N)$. The main problem of this algorithm is the time needed for the computation. In 2008 there appeared three independent solutions to this problem: V. V. Srinivas and B. R. Shankar [11], M. N. Fuller [7], and J. Arias de Reyna and J. van de Lune [3]. All three are very similar. Only [11] gives an estimation of the performance of its algorithm, proving that the algorithm computes the complexities in time $O(N^{1+β})$, where $1+β=\log3/\log2\approx1.584963$. The other two algorithms, presented in [7] and [3], were very similar but both superior to the one in [11]. In Section 2 we present a version of these algorithms and in Section 4 it is shown that they run in time $O(N^α)$ and space $O(N\log\log N)$. (Here $α= 1.230175$). In Section 2 we present the algorithm of [7] and [3]. The main advantage of this algorithm with respect to that in [11] is the definition of kMax in Section 2.7. This explains the difference in performance from $O(N^{1+β})$ to $O(N^α)$. In Section 3 we present a detailed description a space-improved algorithm of Fuller and in Section 5 we prove that it runs in time $O(N^α)$ and space $O(N^{(1+β)/2}\log\log N)$, where $α=1.230175$ and $(1+β)/2\approx0.792481$.

Motivation & Objective

  • To develop an efficient algorithm for computing the integer complexity ‖n‖ for all n ≤ N, where complexity is defined as the minimal number of 1s needed using only + and × operations.
  • To reduce the time complexity from O(N²) in brute-force methods to O(N^α) with α ≈ 1.230175, significantly improving scalability.
  • To minimize space usage by introducing a block-based memory management strategy inspired by Fuller’s optimization, reducing space to O(N^{(1+β)/2} log log N).
  • To formally prove the time and space complexity bounds of the improved algorithm, filling a gap in prior literature where such analysis was missing.
  • To enable the computation of integer complexities for all n ≤ 10^12, as announced in follow-up work, by providing a theoretically sound and efficient algorithm.

Proposed method

  • Adopt a dynamic programming approach where complexity values are computed iteratively using the recurrence: ‖n‖ = min{‖a‖ + ‖b‖} over all a,b < n such that a + b = n or a × b = n.
  • Introduce a kMax threshold to limit the number of sum-based checks per n, reducing redundant computations and improving time efficiency.
  • Implement a block-based memory model: a fixed block of size H and N/H running blocks of size L, with L = 2ℓ and H ≈ N^{(1+β)/2}, to manage memory efficiently.
  • Use base-b digit decomposition and the function D(b,r) to bound the growth of complexity, enabling the derivation of the exponent α via logarithmic optimization over bases b = 2^n 3^m.
  • Apply asymptotic analysis using zeta function bounds and geometric series to show that the total cost of sum and product operations across blocks remains O(N^α).
  • Optimize block initialization and data copying by aligning block sizes with divisibility constraints (ℓ | H, ℓ | N), ensuring correctness and efficiency.

Experimental results

Research questions

  • RQ1What is the optimal time complexity achievable for computing integer complexity for all n ≤ N using dynamic programming with sum and product operations?
  • RQ2How can memory usage be minimized in such a computation while maintaining near-optimal time performance?
  • RQ3Can the performance of prior algorithms—such as the O(N^{1+β}) method with β = log₃2 − 1 ≈ 0.584963—be improved by refining the block-based memory model?
  • RQ4What is the minimal value of the exponent α such that the algorithm runs in O(N^α) time, and for which base b = 2^n 3^m is this minimized?
  • RQ5Can the theoretical time and space bounds of the algorithm be formally proven, especially for the space-improved version inspired by Fuller’s work?

Key findings

  • The time-improved algorithm achieves O(N^α) time complexity with α ≈ 1.230175, derived from minimizing the logarithmic expression involving base-b digit contributions D(b,r).
  • The space-improved algorithm, based on Fuller’s block-based optimization, reduces space usage to O(N^{(1+β)/2} log log N), where (1+β)/2 ≈ 0.792481.
  • The algorithm computes integer complexities for all n ≤ 10^12, as announced in follow-up work, demonstrating practical scalability.
  • The theoretical analysis confirms that the total cost of sum and product operations across blocks remains O(N^α), with the dominant term being the sum computation over j ≤ N/H.
  • The optimal base b = 2^10 × 3^7 = 2,239,488 yields the minimal α ≈ 1.230174997, confirming the theoretical lower bound on the exponent.
  • The space and time bounds are formally proven using zeta function estimates and geometric series, establishing the algorithm’s efficiency beyond empirical observation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.