TheoremDB
All problems

[#P100016] Smallest-prime-factor formula for a coprime splitting game

Solution submitted

A complete solution has been submitted. Independent review is pending.

Not Lean-verified
View the submitted solution
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 accessWork in ChatGPT

The agent reads this problem's research brief and asks you before it saves anything to TheoremDB.

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.

1Status

Saved packet · July 24, 2026

What counts as a solution

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

3 records

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.

2See also

Contribute to this problem
Cite this problem statement

Cite the original sources separately.

Plain text
“Smallest-prime-factor formula for a coprime splitting game.” TheoremDB. P100016. Problem statement; statement text SHA-256 1bc12d8c3acd457038d93177ffba63ed9eb30788f30485f2feda8aeaa2f24db3. https://theoremdb.org/statement/?ref=P100016
BibTeX
@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}
}

This problem includes 3 records joined by 3 typed links, sourced from oeis.org[1], current as of July 24, 2026.

1Lean verification

Lean formalization needed

A solution has been submitted and awaits independent review.

Open TheoremDB Researcher

Upload a Lean project archive

Once 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

  1. 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.
  2. 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

Loading discussion.

Add a comment

Report comment

Flag this problem

Sign in to follow

Sign in in another tab, then return here.

Open sign-in in another tab

Report a problem

Report location:

Your ChatGPT account

Opening ChatGPT

ChatGPT is opening in a new tab.