WorksMathematics
An Asymptotic for E. P. Stein Numbers
Abstract
Epstein's put-or-take-a-square game is an impartial combinatorial game in which a player may, in each turn, add or subtract the largest square not exceeding the current integer. We study E. P. Stein numbers, the positions from which both legal moves lead directly to positive squares, and prove the following asymptotic formula for the counting function of these positions:
Introduction and Motivation
Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps or piles; the player who removes the last object wins. Game theorist Richard A. Epstein proposed a variant of Nim known as the put-or-take-a-square game [1], which we study in this paper.
The game starts with a positive integer. Each turn, writing for the number the player to move is faced with, that player has two moves:
Subtract from ; that is, subtract off , where is the largest integer with . We write for this move.
Add to . We write for this move.
Formally, the two functions, for “down” and “up” respectively, are
So from the position , the set of positions reachable in one move is . The game ends when a player moves to 0, and that player wins.
Example 1.1. We illustrate by playing a put-or-take-a-square game starting with .
Player 1 starts with . Since and , the moves are ; say Player 1 chooses .
Player 2 now has , whose moves are ; say Player 2 chooses .
Player 1 now has , whose moves are ; say Player 1 chooses .
Player 2 now has , whose moves are . Player 2 chooses and wins the game.
Definition 1.2. A remoteness function is a function that gives the number of moves until the game ends, given optimal play from position .
Note that for our game, if and only if , and that if and only if is a positive perfect square. Some numbers, such as 2 and 3, have infinite remoteness, because two perfectly rational players would just alternate between 2 and 3 forever.

Figure 1. A sample play of the game starting at . The highlighted path shows the sequence , in which Player 2 wins.
I specified the game and desired illustration, and Astra generated a visual design and TikZ implementation. I manually adjusted the positioning and styling of nodes and edges to improve clarity and decreased the size of the illustration. Produced in 2026.
Definition 1.3. An E. P. Stein number1 is a number such that . In other words, an E. P. Stein number is a number such that no matter which move the current player takes from that number, the next turn is guaranteed to have an available move to —i.e., a number for which there exist positive integers and such that and .
Example 1.4. The number is an E. P. Stein number, since and . Although is a losing position given optimal play for the current player, it is not an E. P. Stein number, since ; and indeed, .
The first few E. P. Stein numbers are [3].
Definition 1.5. The E. P. Stein counting function is defined as the number of E. P. Stein numbers less than or equal to :
The purpose of this paper is to prove the following asymptotic:
Theorem 1.6. As , we have
Equivalently, ; that is,
with relative error .
Steuding and Volkert [2] prove that there are infinitely many E. P. Stein numbers, and develop a parameterization for them along the way. For our proof of Theorem 1.6, we build on their method to develop an alternate parameterization that bijectively characterizes the E. P. Stein numbers, using triples .
After parameterizing E. P. Stein numbers in this way, we count the number of such triples satisfying the necessary inequalities using lattice geometry and equidistribution techniques. Finally, to obtain the asymptotic for , we will sum over all possible values of using Möbius inversion and a weighted harmonic sum.2
A Bijective Parameterization of E. P. Stein Numbers
We first focus on the parameterization of E. P. Stein numbers, which assumes the form with certain divisibility conditions on , , and .
Let . For an E. P. Stein number, and . Consequently, we have
Steuding and Volkert [2] proved the not-necessarily-bijective parameterization
where is odd and .
Definition 2.1. We define to be 1 if for all odd primes , and 0 otherwise. In other words, the odd part of is square-free; the even part may have arbitrary powers of 2.
We now convert the Steuding–Volkert parameterization into a unique form with a condition rather than a coprimality condition.
Theorem 2.2 (Parameterization of E. P. Stein numbers). Define
Then the map
is a bijection from to the set of E. P. Stein numbers.
Proof. We prove that the displayed map indeed sends every triple in to an E. P. Stein number, and that it is surjective and injective.
To prove that the map is well defined, take and set and . We then have
It now suffices to show that . Since , we have from . Note that cannot be zero because is odd. Moreover, because , it follows that , and so . Hence , so that and are both positive squares and is an E. P. Stein number.
For surjectivity, let be an E. P. Stein number. The argument of Steuding and Volkert [2 p.3] yields positive integers , , , with odd and , such that
with . Uniquely factor , where is odd and : all powers of 2 remain in , while for each odd prime , pairs of powers of go into , leaving exponent 0 or 1 in . Now set and . We then have
and
Because and are odd, is too; and by the construction . Thus , as desired; in other words, every E. P. Stein number is in the image of the stated map.
To prove injectivity, suppose and . Let for . Then , where , , and ; moreover, , and is odd because it divides the odd number .
From the parameterization argument above, , so . Let and .
We now claim that . This is because
which can be seen from the coprimality of and together with the oddness of , and so . Next, we observe that
the right-hand side depends only on . Of these two integers on the left-hand side of the correspondence above, is the odd one and is the even one. Thus and .
Recall from earlier that . For each we have , where is odd and . This factorization is unique: for every odd prime, all pairs of prime factors go into , while the remaining exponent 0 or 1 stays in , and the entire power of 2 stays in . Hence and ; it then follows that and . Thus
so the map is injective. Having shown that the map sends into the E. P. Stein numbers and is both injective and surjective, we conclude that it is a bijection, as desired. □
Theorem 2.2 allows us to iterate over positive integer triples satisfying the stated inequality with no coprimality conditions on and (as opposed to Steuding and Volkert’s original parameterization); this lets us sum over the relevant triples more directly.
Example 2.3. Take , , . Then
Since and , the triple produces an E. P. Stein number, 145, as desired. In our game, both of 145’s legal moves reach positive squares, and the player’s opponent can reach 0 on the next turn regardless of which move is chosen.
Definition 2.4. Define as the number of positive integer pairs , with odd, satisfying
and
Throughout, denotes the fourth root of the cutoff, so that counting E. P. Stein numbers up to means taking ; the condition is then exactly the requirement that the E. P. Stein number constructed from be at most . We can thus think of as counting, for fixed , the triples that satisfy every condition defining except , subject to the additional constraint that the associated E. P. Stein number is at most .
As a consequence of Theorem 2.2, our desired count is thus
The factor appears because we have omitted the condition in the definition of . Note, however, that satisfies
and thus ; otherwise . This allows us to evaluate the sum
Lattice Geometry and Equidistribution
We have now converted the problem of counting E. P. Stein numbers into a number-theoretic problem of counting integer points in a region defined by certain inequalities. Moving forward, we will estimate the distribution of the lattice points in this valid region by utilizing a change of variables and approximating each lattice point count with the corresponding area of the region it occupies.
Our eventual counting problem will reduce to determining how often the fractional parts of lie in a short interval; the following lemma provides a rough estimate for this count.
Lemma 3.1. Let , and let be a rational number with , , and
Then, uniformly over real phases , over intervals of length taken modulo , and over integers , we have
where denotes the fractional part of , so that is (mod ).
Figure 2. Schematic illustration of the orbit points on the unit interval—illustrated as a circle here for visualizing the modular arithmetic—and the highlighted interval of length , where counts the number of points falling into . The plotted positions of the orbit points are schematic and spaced for legibility and are not the actual positions of for any particular and .
The initial diagram was generated with Astra; Astra subsequently supplied TikZ code and revisions based on my visual feedback, and then I manually edited the positioning and size of various nodes to improve readability and spacing. Produced in 2026.
Proof. We define a block to be consecutive terms of the sequence
Say that we are analyzing the block for . Comparing this with , continued fraction theory for non-zero [4] yields the inequality
and so each actual point is within of the corresponding rational point. Since , the rational comparison points form a translate modulo of the evenly spaced grid
Hence an interval of length contains of these comparison points. Moving a comparison point by less than can change whether it belongs to only if it lies within distance of an endpoint of . Since the grid points are spaced apart, only points can lie in these endpoint neighborhoods. Therefore, each complete block contains actual orbit points in , uniformly in the starting index, phase, and interval.
Now write , where . The first terms consist of complete blocks, each contributing points in . Let denote the number of points in among the remaining terms. Since these terms are contained in one additional complete block, we have
Moreover, , so
Combining the complete blocks and the remainder gives
as desired.
We now employ a “sandwich” argument and a change of variables—where —to trap the admissible pairs between two rectangles: an inner rectangle and an outer rectangle . Define
Note that is in general irrational, so the points of are not themselves lattice points. Rather, counts the integer pairs , with odd, whose transformed coordinates lie in . The difference between the two rectangles is that if , it necessarily follows that ; whereas if , it only follows that . The next three propositions establish precise bounds for within these rectangles, and hence bound the region; in other words, they show that .
Figure 3. Schematic illustration of . We use this schematic to visualize bounding the area of between the areas of the inner and outer rectangles. Astra generated the original visual, then recreated it in TikZ after I requested the design. The figure is schematic rather than an exact plot of —I manually adjusted the shape of some of the boundaries and the positioning of the rectangles and arrows for readability. Produced in 2026.
Throughout, we use the conventions , , and .
The inequality defining is nonlinear in and , but becomes simpler when expressed in terms of the distance from the line . The following equivalence allows us to bound the width of in the -direction.
Proposition 3.2. Let , , and , and let and . Then
Proof. First, note that and satisfy and . Using the condition , we find that
as desired. The converse is obtained by reversing these steps. □
To obtain a lower bound for , we first construct a rectangle contained entirely in . Counting integer pairs in this rectangle will provide a lower bound for the count in .
Proposition 3.3. For and , let
Then .
Proof. Suppose . Apply the norm to the points and , together with the triangle inequality, to obtain
where as before. Since satisfies the bound defining ,
Rearranging shows that , as desired. Next, since and , we have ; hence , so and
which by Proposition 3.2 is the required inequality. □
For the corresponding upper bound, we enclose in a larger rectangle. Together with Proposition 3.3, this will allow us to estimate by counting points in two simpler regions.
Proposition 3.4. For and , let
Then .
Proof. Suppose that . By Proposition 3.2, we know that , and thus . Hence , as desired.
From the same norm argument we used to prove the inequality in Proposition 3.3, we have
and thus
so that , as desired. □
Now that we have inequalities describing the inner and outer rectangles that sandwich , we can estimate the number of integer pairs with odd in these regions to bound .
Lemma 3.5. The quantity satisfies
Proof. Let count the number of integer pairs with odd in our rectangles, with counting those in the outer rectangle and counting those in the inner rectangle . Notice that counting the odd satisfying is equivalent to counting the solutions of
Thus the fractional part of must lie in the interval
Both the inner and outer rectangles have the form and , where must be odd. Thus we may apply Lemma 3.1 to obtain
Now select a convergent denominator such that , which is possible since the denominators increase by a factor less than 6 by a standard recursion in Pell’s equations [4]; this gives the approximation . From Propositions 3.3 and 3.4, we know that and .
We now evaluate the error terms in the expression for . Since , we have and . Thus the overall error term simplifies to
We then have
and similarly
Writing , the preceding estimates give . Since , the counts satisfy , and we obtain
as desired.
Proof of the Asymptotic
Having developed our machinery, we now turn to the proof of Theorem 1.6, which we restate here for convenience: as , the counting function of the E. P. Stein numbers—that is, of the losing positions of remoteness 2—satisfies
so that the relative error is .
The constant is of particular interest: as we will see, it arises from a Dirichlet sum that comes from the parameterization of every E. P. Stein number.
In Lemma 4.1 below it will be convenient to write .
Lemma 4.1. We have
The proof rests on the following elementary identity.
Proposition 4.2. The odd square-free indicator function is given by
where is the classical Möbius function.
Proof. The sum is equivalent to
This is exactly the definition of the odd square-free indicator function , since if any one of the odd primes squared divides then the corresponding term in the product is 0, and otherwise the product is 1.
Proof of Lemma 4.1. We apply Proposition 4.2 to evaluate the sum:
Lemma 4.3. We have
Proof. We split the sum into three separate sums:
We are now in a position to prove the main theorem.
Proof of Theorem 1.6. Substituting in Lemma 4.1 and combining it with Lemmas 3.5 and 4.3 yields
as desired. Here we used that , so the weighted errors are at most the unweighted ones. □
Computational Results
While Theorem 1.6 gives an asymptotic for , it says nothing about how closely that asymptotic tracks at any particular . Thus here we perform an exact enumeration of the E. P. Stein numbers up to , so that the asymptotic can be checked against exact counts over a wide range. In our proof earlier, we counted normalized triples with and no coprimality restrictions on and . For the enumeration below, however, we instead iterate over coprime pairs with odd, where denotes the scaling factor in the original Steuding–Volkert parameterization.
For any triple and an E. P. Stein number , we have
Given a coprime pair , then, we can count the number of valid to sum over as
To sum over and , notice that , and so it suffices to consider
By Proposition 3.2, any admissible satisfies , so it lies in an interval of length ; since consecutive odd numbers differ by 2, at most one odd can satisfy this condition for a given . Our program thus iterates over all valid values of and, for each , checks the unique odd (if it exists) that satisfies the conditions. It then sums over all such pairs to compute the exact count of E. P. Stein numbers. At , the bound is only 7,071,067 candidate values of , making the computation feasible; the results are summarized in Table 1.
| Exact | Ratio | ||
| 15 | 9.3 | 1.607 | |
| 281 | 186.6 | 1.506 | |
| 3,329 | 2,799.6 | 1.189 | |
| 42,367 | 37,328.1 | 1.135 | |
| 543,144 | 466,601.3 | 1.164 | |
| 6,178,005 | 5,599,215.5 | 1.103 | |
| 70,201,703 | 65,324,181.2 | 1.075 |
Table 1. Exact counts of E. P. Stein numbers compared with the leading asymptotic .
Table 1 created by the author, Cameron Rampell; the exact counts were computed with the author’s own Python implementation of the parameterization in Section 2. Produced in 2026.
When comparing the ratio of the exact counts to the predicted asymptotic values, we observe that the ratio tends to 1 as increases, but it does so in a nonmonotonic, oscillatory fashion. This suggests that by capturing the oscillations, an error term of order may be best possible for the asymptotic formula.

Figure 4. Ratio of exact counts to the leading asymptotic. The dashed horizontal line marks the limiting value 1. I input student-produced verified data to Astra, and Astra generated TikZ and PGFPlots code using said data. I manually adjusted the axis limits, tick marks, and plot styling for clarity and readability. Produced in 2026.
Remarks
In Richard Guy’s collection [5] of unsolved problems in number theory, Problem E26 asks whether the losing positions or the winning positions of Epstein’s game make up a positive-density subset of the positive integers. Our asymptotic settles this for the remoteness-2 positions: the E. P. Stein numbers form an infinite but density-zero subset of the positive integers, since
A related problem, A7(18), in Richard Nowakowski’s Unsolved Problems in Combinatorial Games [6] explicitly asks for asymptotic proportions of winning, losing, and draw positions. Although we have determined an asymptotic for remoteness-2 numbers, the general problem of asymptotic proportions for all positions remains open.
Further questions to investigate include whether is the best error obtainable and whether useful arithmetic characterizations exist for positions of higher remoteness in Epstein’s game.
References
References
- [1]E. R. Berlekamp, J. H. Conway, and R. K. Guy, Winning Ways for Your Mathematical Plays, Volume 3, 2nd edition. A K Peters, 2003.
- [2]J. Steuding and K. Volkert, “A Diophantine Problem Related to a Nim-like Game,” Integers 19, Article G2, 2019.DOI
- [3]OEIS Foundation Inc., “E. P. Stein numbers, entry A397453 in the On-Line Encyclopedia of Integer Sequences.” https://oeis.org/A397453, 2026. Sequence proposed by C. Rampell.
- [4]A. Y. Khinchin, Continued Fractions. Dover Publications, 1997.
- [5]R. K. Guy, Unsolved Problems in Number Theory, 2nd edition. Springer-Verlag, 1994.
- [6]R. Nowakowski, “Unsolved problems in combinatorial games,” in Games of No Chance 6, Cambridge University Press, 2025.

