# Question 27710: Wilson Domain, Finite Testing, Fermat Comparison and the p=2 Exception Stay Separate

[Return to catalogue page 139](https://ocme.evemisslab.com/en/questions/page/139/)

[← Question derivation index](https://ocme.evemisslab.com/en/questions/) · [Original question batch](https://ocme.evemisslab.com/en/practice/batch-20261015-advance-20261118-r04-wilson-theorem-foundations/#q-20261015-advance-20261118-r04-wilson-theorem-0085)

This teaching derivation has second-context AI mathematical and bilingual semantic review, limited to the model and assumptions stated in this question. It has no human review or new Lean proof and does not promote the original question or MKO to Canonical truth.

R0054-27710 · q-20261015-advance-20261118-r04-wilson-theorem-0085



## Original question and givens

Use mode=fermat_confusion and exact integer n=29. Give (mode, n, running_factorial_residues, factorial_residue, minus_one_residue, Wilson_congruence, Wilson_statement, Fermat_statement, theorem_identification_claim, boundary).


- G001 — Use mode=fermat_confusion and exact integer n=29. Give (mode, n, running_factorial_residues, factorial_residue, minus_one_residue, Wilson_congruence, Wilson_statement, Fermat_statement, theorem_identification_claim, boundary).





## Definition and scope

Use the original question domain, assumptions and cited MKO definitions. This item has second-context mathematical and bilingual review, with the model, answer and every arithmetic step independently recomputed from the original parameters; the source question remains a candidate.


- [mko-wilson-theorem](https://ocme.evemisslab.com/en/mko/mko-wilson-theorem/)





## Step-by-step derivation

S001 · impliesBefore

source roles = [wilson-boundary]

After

derived = [[mode, n, running_factorial_residues, factorial_residue, minus_one_residue, Wilson_congruence, Wilson_statement, Fermat_statement, theorem_identification_claim, boundary]]

Conditions: none

List the complete operation/mode field order without JavaScript or answer-shape inference;Boolean,string,null and an unclaimed result remain distinct.

Step identifiers and dependenciesRule: source_ordered_fields_without_JS · Uses: G001





S002 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product1 := mul(1, 1)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product1 = 1

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S001





S003 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 1, 1, 1]

After

derived = [0, 1, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S002





S004 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product2 := mul(1, 2)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product2 = 2

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S003





S005 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 2, 1, 2]

After

derived = [0, 2, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S004





S006 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product3 := mul(2, 3)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product3 = 6

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S005





S007 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 3, 2, 6]

After

derived = [0, 6, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S006





S008 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product4 := mul(6, 4)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product4 = 24

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S007





S009 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 4, 6, 24]

After

derived = [0, 24, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S008





S010 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product5 := mul(24, 5)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product5 = 120

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S009





S011 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 5, 24, 120]

After

derived = [4, 4, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S010





S012 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product6 := mul(4, 6)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product6 = 24

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S011





S013 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 6, 4, 24]

After

derived = [0, 24, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S012





S014 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product7 := mul(24, 7)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product7 = 168

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S013





S015 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 7, 24, 168]

After

derived = [5, 23, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S014





S016 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product8 := mul(23, 8)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product8 = 184

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S015





S017 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 8, 23, 184]

After

derived = [6, 10, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S016





S018 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product9 := mul(10, 9)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product9 = 90

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S017





S019 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 9, 10, 90]

After

derived = [3, 3, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S018





S020 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product10 := mul(3, 10)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product10 = 30

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S019





S021 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 10, 3, 30]

After

derived = [1, 1, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S020





S022 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product11 := mul(1, 11)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product11 = 11

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S021





S023 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 11, 1, 11]

After

derived = [0, 11, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S022





S024 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product12 := mul(11, 12)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product12 = 132

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S023





S025 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 12, 11, 132]

After

derived = [4, 16, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S024





S026 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product13 := mul(16, 13)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product13 = 208

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S025





S027 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 13, 16, 208]

After

derived = [7, 5, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S026





S028 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product14 := mul(5, 14)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product14 = 70

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S027





S029 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 14, 5, 70]

After

derived = [2, 12, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S028





S030 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product15 := mul(12, 15)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product15 = 180

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S029





S031 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 15, 12, 180]

After

derived = [6, 6, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S030





S032 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product16 := mul(6, 16)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product16 = 96

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S031





S033 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 16, 6, 96]

After

derived = [3, 9, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S032





S034 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product17 := mul(9, 17)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product17 = 153

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S033





S035 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 17, 9, 153]

After

derived = [5, 8, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S034





S036 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product18 := mul(8, 18)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product18 = 144

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S035





S037 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 18, 8, 144]

After

derived = [4, 28, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S036





S038 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product19 := mul(28, 19)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product19 = 532

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S037





S039 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 19, 28, 532]

After

derived = [18, 10, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S038





S040 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product20 := mul(10, 20)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product20 = 200

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S039





S041 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 20, 10, 200]

After

derived = [6, 26, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S040





S042 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product21 := mul(26, 21)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product21 = 546

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S041





S043 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 21, 26, 546]

After

derived = [18, 24, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S042





S044 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product22 := mul(24, 22)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product22 = 528

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S043





S045 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 22, 24, 528]

After

derived = [18, 6, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S044





S046 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product23 := mul(6, 23)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product23 = 138

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S045





S047 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 23, 6, 138]

After

derived = [4, 22, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S046





S048 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product24 := mul(22, 24)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product24 = 528

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S047





S049 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 24, 22, 528]

After

derived = [18, 6, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S048





S050 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product25 := mul(6, 25)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product25 = 150

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S049





S051 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 25, 6, 150]

After

derived = [5, 5, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S050





S052 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product26 := mul(5, 26)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product26 = 130

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S051





S053 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 26, 5, 130]

After

derived = [4, 14, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S052





S054 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product27 := mul(14, 27)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product27 = 378

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S053





S055 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 27, 14, 378]

After

derived = [13, 1, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S054





S056 · calculationBefore

Wilson boundary ORIGINAL prime ORIGINAL running factorial product28 := mul(1, 28)

After

Wilson boundary ORIGINAL prime ORIGINAL running factorial product28 = 28

Conditions: none

Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.

Step identifiers and dependenciesRule: exact_rational_arithmetic · Uses: G001, S055





S057 · impliesBefore

source roles = [Wilson boundary ORIGINAL prime, 29, 28, 1, 28]

After

derived = [0, 28, Yes, Yes]

Conditions: none

Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.

Step identifiers and dependenciesRule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S056





S058 · impliesBefore

source roles = [29, [[1, 1], [2, 2], [3, 6], [4, 24], [5, 4], [6, 24], [7, 23], [8, 10], [9, 3], [10, 1], [11, 11], [12, 16], [13, 5], [14, 12], [15, 6], [16, 9], [17, 8], [18, 28], [19, 10], [20, 26], [21, 24], [22, 6], [23, 22], [24, 6], [25, 5], [26, 14], [27, 1], [28, 28]], 28]

After

derived = [28, Yes, No]

Conditions: none

Wilson concerns(n-1)!;Fermat concerns a^(n-1) when n does not divide a.This branch supplies no a or power computation.The named comparison neither identifies the theorems nor adds an executed power test.

Step identifiers and dependenciesRule: Wilson_and_Fermat_DISTINCT_named_statements_NO_unprovided_a_power · Uses: G001, S057









## Reverse checks


- S058 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S057 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S056 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product28 with exact rational arithmetic, not rounded decimals.
- S055 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S054 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product27 with exact rational arithmetic, not rounded decimals.
- S053 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S052 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product26 with exact rational arithmetic, not rounded decimals.
- S051 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S050 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product25 with exact rational arithmetic, not rounded decimals.
- S049 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S048 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product24 with exact rational arithmetic, not rounded decimals.
- S047 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S046 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product23 with exact rational arithmetic, not rounded decimals.
- S045 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S044 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product22 with exact rational arithmetic, not rounded decimals.
- S043 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S042 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product21 with exact rational arithmetic, not rounded decimals.
- S041 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S040 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product20 with exact rational arithmetic, not rounded decimals.
- S039 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S038 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product19 with exact rational arithmetic, not rounded decimals.
- S037 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S036 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product18 with exact rational arithmetic, not rounded decimals.
- S035 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S034 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product17 with exact rational arithmetic, not rounded decimals.
- S033 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S032 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product16 with exact rational arithmetic, not rounded decimals.
- S031 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S030 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product15 with exact rational arithmetic, not rounded decimals.
- S029 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S028 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product14 with exact rational arithmetic, not rounded decimals.
- S027 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S026 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product13 with exact rational arithmetic, not rounded decimals.
- S025 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S024 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product12 with exact rational arithmetic, not rounded decimals.
- S023 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S022 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product11 with exact rational arithmetic, not rounded decimals.
- S021 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S020 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product10 with exact rational arithmetic, not rounded decimals.
- S019 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S018 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product9 with exact rational arithmetic, not rounded decimals.
- S017 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S016 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product8 with exact rational arithmetic, not rounded decimals.
- S015 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S014 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product7 with exact rational arithmetic, not rounded decimals.
- S013 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S012 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product6 with exact rational arithmetic, not rounded decimals.
- S011 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S010 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product5 with exact rational arithmetic, not rounded decimals.
- S009 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S008 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product4 with exact rational arithmetic, not rounded decimals.
- S007 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S006 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product3 with exact rational arithmetic, not rounded decimals.
- S005 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S004 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product2 with exact rational arithmetic, not rounded decimals.
- S003 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.
- S002 · premise_and_result_audit — Recompute Wilson boundary ORIGINAL prime ORIGINAL running factorial product1 with exact rational arithmetic, not rounded decimals.
- S001 · premise_and_result_audit — Reverse-check original data,operands,complete scope and premises;finite witnesses,conditional theorem use and formal proof remain distinct.





## Result

(fermat_confusion, 29, [[1, 1], [2, 2], [3, 6], [4, 24], [5, 4], [6, 24], [7, 23], [8, 10], [9, 3], [10, 1], [11, 11], [12, 16], [13, 5], [14, 12], [15, 6], [16, 9], [17, 8], [18, 28], [19, 10], [20, 26], [21, 24], [22, 6], [23, 22], [24, 6], [25, 5], [26, 14], [27, 1], [28, 28]], 28, 28, Yes, Wilson:(n-1)!==-1_mod_29, Fermat:a^(29-1)==1_mod_29_when_n_does_not_divide_a, No, distinct_theorems_no_Fermat_power_claim_recomputed)

The full substitutions and premise checks give the original answer; source identity,format and status are unchanged.





## This question review and source binding

Review date: 2026-10-26

Original questions, answers, step expressions, numeric ASTs and historical records are retained. Source candidate labels remain historical and are not overwritten as formal proof.

Source hashes and review receipts
- input commit: 0f7be61e2c22317a4075561dc822c87d881a50db
- original question SHA-256: 40bf2897de447bf05f7caba565a6a771f1210d700d22d914826ec55049bc2b75
- candidate record SHA-256: 8d44b9bec0ac104a32ed98fc0a5b193648356087b9629f5c2a4960570885986e
- semantic review receipt SHA-256: 0a76d8e93c08bb16998a0483f3dfc0504f269fc3e1982e6cd868cab0a2856d54
- question-first witness SHA-256: 09127b736c225714dfa0b7ceb0e6a6e66df27438b480cad8217d3c2f99ce9437
- Lean: NOT_RUN · human review: NOT_PERFORMED

[Same-source full JSON](https://ocme.evemisslab.com/data/question-derivations/questions/q-20261015-advance-20261118-r04-wilson-theorem-0085.json)




