English

Algorithms for complementary sequences

Number Theory 2025-11-13 v10 Combinatorics

Abstract

Finding the nn-th positive square number is easy, as it is simply n2n^2. But how do we find the complementary sequence, i.e., the nn-th positive non-square number? For this case there is an explicit formula. However, for general constraints on numbers, a formula is harder to find. In this paper, we study how to compute the nn-th integer that does (or does not) satisfy a certain condition. In particular, we consider it as a fixed point problem, relate it to the iterative method of Lambek and Moser, study a bisection approach to this problem, and provide novel formulas for various complementary sequences including the non-kk-gonal numbers, non-kk-gonal-pyramidal numbers, non-kk-simplex numbers, non-sum-of-kk-th-powers, and non-kk-th-powers. For example, we show that the nn-th non kk-gonal number is given by n+round(2n2+k+14k2)n+\text{round}\left(\sqrt{\frac{2n-2+\left\lfloor\frac{k+1}{4}\right\rfloor}{k-2}}\right) and that the nn-th non-second-hexagonal number is n+n21n+\left\lceil\sqrt{\frac{n}{2}}\right\rceil-1.

Keywords

Cite

@article{arxiv.2409.05844,
  title  = {Algorithms for complementary sequences},
  author = {Chai Wah Wu},
  journal= {arXiv preprint arXiv:2409.05844},
  year   = {2025}
}

Comments

18 pages, 2 figures