[#P100016] Smallest-prime-factor formula for a coprime splitting game
Contents
Problem. In the impartial game where a heap of \(n\) tokens may be split into two unequal positive coprime heaps, let \(g(n)\) be its Sprague-Grundy value. Is \(g(n)=0\) for even \(n\), and \(g(n)=\pi(p)-1\) for odd \(n>1\), where \(p\) is the least prime divisor of \(n\) and \(\pi(p)\) counts primes at most \(p\)?
Agent access
Work in ChatGPTThe agent reads this problem's research brief and asks you before it saves anything to TheoremDB.
Definitions and notation
1Remarks
Remark 1. After a split, the two heaps form a disjunctive sum, so the move value is g(a) XOR g(b).
Remark 2. A heap with no legal split has Grundy value 0.
2What counts as a solution
- Prove the stated Grundy formula for every n, or provide the least counterexample.
1StatusSolution submittedNot Lean-verified
Saved packet · July 24, 2026
Saved solution (The least-prime-factor formula holds for every heap). If P(n) is the least prime divisor of n, then g(1)=0 and g(n)=pi(P(n))-1 for every n at least 2.[2]
Resolution argument
Write \(P(n)\) for the least prime divisor of \(n>1\). The proposed formula has the simpler unified form \[ g(1)=0,\qquad g(n)=\pi(P(n))-1\quad(n\geq2). \] Indeed, an even \(n\) has \(P(n)=2\), so the second expression gives zero.
We prove the formula by strong induction. The heaps 1 and 2 have no legal split, since the sole positive split of 2 is \(1+1\), whose parts are equal. Hence both values are zero.
Suppose first that \(n>2\) is even. A legal split \(n=a+b\) has two odd summands, since two even summands would have a common factor 2. If one summand is 1, its value is zero and the other summand is an odd integer greater than 1 with positive value. If both exceed 1 and had equal Grundy values, the induction formula and the injectivity of the prime-counting index on primes would give \(P(a)=P(b)\). That prime would divide \(\gcd(a,b)\), contrary to legality. Thus \(g(a)\mathbin{\mathrm{xor}}g(b)\neq0\) for every option. Zero is absent from the option-value set, so its mex is zero.
Now let \(n>1\) be odd, put \(p=P(n)\), and set \(k=\pi(p)-1\). Every split has one odd summand \(m\) and one even summand \(n-m\). The induction result makes the even summand's value zero, and \[ \gcd(m,n-m)=\gcd(m,n). \] Consequently the option values are exactly the values \(g(m)\) for odd \(m\) with \(1\leq m\leq n-2\) and \(\gcd(m,n)=1\).
The option \(m=1\) realizes value 0. For each \(j\) with \(1\leq j<k\), let \(q\) be the \((j+1)\)-st prime. Then \(q<p\), so \(q\leq p-2\leq n-2\) and \(\gcd(q,n)=1\). The induction formula gives \(g(q)=\pi(q)-1=j\). Every value below \(k\) therefore occurs.
Value \(k\) cannot occur. If a legal odd summand \(m>1\) had \(g(m)=k\), induction would give \(\pi(P(m))=\pi(p)\), hence \(P(m)=p\). Then \(p\) would divide both \(m\) and \(n\), contradicting \(\gcd(m,n)=1\). The option values contain every integer below \(k\) and exclude \(k\), so their mex is \(k\). This completes the induction.
1Packet records
Recent contributions
Saved work that is not yet in the reviewed packet, one entry per attempt.
Notes and companion material
A reusable attempt should separate the realization lemma for smaller prime indices and the exclusion lemma for the least prime divisor. Those two obligations are easy to conflate in a raw mex calculation.
Original intake status. Novelty and status remain unverified. The formula may reduce to an elementary mex induction.
- Induction on the least prime factor is the attractive route.
- The mex step must realize every smaller value by a coprime split and exclude the target value. Composite n deletes many candidate splits at once, so checking only prime n leaves the hard half untouched.
Recorded example 1. The values g(3),g(5),g(7),g(9),g(11),g(25) are 1,2,3,1,4,2.
Computational notes
- The exact mex recurrence was evaluated for every 1 <= n <= 6000, testing all unequal splits and gcd conditions. Every value matched the formula; the maximum observed value was 782 at n=5987.
How the 3 records connect
ProblemSmallest-prime-factor formula for a coprime splitting game
All 3 recorded relations between these records and the problem
2See also
- Density of losing positions in the subtract-a-triangular gamecombinatorial game theory
- Density of losing positions in the subtract-a-cube gamecombinatorial game theory
- A gap of 50 in square-diagonal Wythoff Nimcombinatorial game theory
Contribute to this problem
Cite this problem statement
Cite the original sources separately.
“Smallest-prime-factor formula for a coprime splitting game.” TheoremDB. P100016. Problem statement; statement text SHA-256 1bc12d8c3acd457038d93177ffba63ed9eb30788f30485f2feda8aeaa2f24db3. https://theoremdb.org/statement/?ref=P100016
@misc{theoremdb-problem-1bc12d8c3acd457038d93177ffba63ed9eb30788f30485f2feda8aeaa2f24db3,
title = {{Smallest-prime-factor formula for a coprime splitting game}},
howpublished = {TheoremDB},
note = {Problem statement; statement text SHA-256 1bc12d8c3acd457038d93177ffba63ed9eb30788f30485f2feda8aeaa2f24db3},
url = {https://theoremdb.org/statement/?ref=P100016}
}Plain text: Built Markdown snapshot
This problem includes 3 records joined by 3 typed links, sourced from oeis.org[1], current as of July 24, 2026.
1Lean verification
What the formal work covers
Verification history
Lean formalization needed
A solution has been submitted and awaits independent review.
Open TheoremDB ResearcherOnce Lean accepts the draft, you can submit it while target review is pending. Your submission request is saved and continues after approval. Private checks stay private until you choose to submit.
1References
- Packet source. OEIS Foundation Inc., “A055396: a(n) is the index of the least prime dividing n,” The On-Line Encyclopedia of Integer Sequences. Definition, comments, and links; checked 2026-07-28. ↗reference database · secondary source · checked 2026-07-28Source use: citation only.Identifies the least-prime-factor sequence that the packet’s Grundy formula shifts by one.Also cited at OEIS A055396, definition, comments, and link to Iannucci-Larsson; accessed 2026-07-24.Also cited at Inline C++20 source below, compiled and executed on 2026-07-24.Source named by the research packet.
- Douglas E. Iannucci and Urban Larsson, “Game values of arithmetic functions,” Integers 21B (2021), Article A14. Theorem 5. ↗ open copy ↗journal article · secondary source · arXiv:2101.07608v3 · checked 2026-07-28Source use: citation only.Proves the analogous totative-game formula and supplies an independent comparison for the packet’s different splitting recurrence.Proves the analogous totative-game formula used as a comparison point.
Original splitting-game formula generated by an agent.
Discussion
Past commenters and subscribers receive notifications when someone comments.