bibkey: ordowski2017a000224 authors: Thomas Ordowski year: 2017 title: “OEIS A000224, number of squares modulo n” doi: null url: https://oeis.org/A000224 claim: “a(n) is the number of distinct squares modulo n. Conjecture: n^2 == 1 (mod a(n)*(a(n)-1)) if and only if n is an odd prime.” strata_touched: [] license: citation-only triage: anchor
OEIS A000224, squares modulo n
The conjecture quoted above is open and nothing in this repository proves it. An attempt produced no theorem; this note records what the attempt established, so a later one does not repeat it.
The statement needs a boundary correction
As literally quoted the equivalence is false at n = 1. There a(1) = 1, so the modulus
a(a-1) is 0, and n^2 - 1 is also 0; under integer divisibility 0 divides 0, and
congruence modulo zero is equality, so the left side holds while 1 is not an odd prime. A
faithful formalisation must carry an explicit positive-modulus hypothesis, or restrict to
n >= 2.
This is worth recording because a numerical check will not surface it: an implementation that
guards the modulus with m > 0 before testing divisibility silently repairs the statement and
reports no violation. The conjecture holds with zero violations for 2 <= n <= 2000 once the
boundary is fixed.
The easy direction, and why it is not the problem
For an odd prime p the squares modulo p are 0 together with the (p-1)/2 quadratic
residues, so a(p) = (p+1)/2 and
a(p) * (a(p) - 1) = ((p+1)/2) * ((p-1)/2) = (p^2 - 1)/4
which divides p^2 - 1. Verified pointwise at p = 3, 5, 7, 11, 13, where a is
2, 3, 4, 6, 7. The content of the conjecture is entirely the converse.
What the converse needs, and where it stalls
Three families were handled: all even n; all odd prime powers; and all composites with
gcd(n, a(a-1)) > 1. The boundary n = 2 has a = 2, modulus 2 and n^2 - 1 = 3.
For odd prime powers the valuation strata give
a(p^e) = 1 + ((p-1)/2) * sum_j p^(e-1-2j).
Even e makes p divide a - 1. For odd e >= 3 the assumed divisibility forces
1 + p^2 + ... + p^(e-1) to divide 2(p+1), which fails on size.
The obstruction is composites with several distinct odd prime factors, where a is a product
of prime-power square counts through the Chinese remainder decomposition. The smallest case
outside the arguments above is n = 35 = 5 * 7, with a(35) = 12, a(a-1) = 132,
n^2 - 1 = 1224 and remainder 36. That is an obstruction to the argument, not a
counterexample to the corrected conjecture.
What is missing is a general arithmetic obstruction to A(A-1) dividing n^2 - 1 when A is
that Chinese remainder product over several distinct odd primes.
Object status
Pinned Mathlib counts the square roots of a given element in a field of characteristic not two
(card_sqrts, quadraticChar_card_sqrts) and supplies nothing for the number of distinct
square values modulo a composite. This repository has no declaration counting squares modulo
n. The OEIS entry carries no comment, formula or link asserting a proof, read in full on
2026-09-13.
Verified locator
- URL: https://oeis.org/A000224