Proofs
Suppose first that $p$ is composite. Then $p$ has a factor $d > 1$ that is less than or equal to $p-1$. Then $d$ divides $(p-1)!$, so $d$ does not divide $(p-1)! + 1$. Therefore $p$ does not divide $(p-1)! + 1$.

Two proofs of the converse are provided: an elementary one that rests close to basic principles of modular arithmetic, and an elegant method that relies on more powerful algebraic tools.

Elementary proof
Suppose $p$ is a prime. Then each of the integers $1, \dotsc, p-1$ has an inverse modulo $p$. (Indeed, if one such integer $a$ does not have an inverse, then for some distinct $b$ and $c$ modulo $p$, $ab \equiv ac \pmod{p}$, so that $a(b-c)$ is a multiple of $p$, when $p$ does not divide $a$ or $b-c$—a contradiction.) This inverse is unique, and each number is the inverse of its inverse. If one integer $a$ is its own inverse, then \[0 \equiv a^2 - 1 \equiv (a-1)(a+1) \pmod{p} ,\] so that $a \equiv 1$ or $a \equiv p-1$. Thus we can partition the set $\{ 2 ,\dotsc, p-2\}$ into pairs $\{a,b\}$ such that $ab \equiv 1 \pmod{p}$. It follows that $(p-1)$ is the product of these pairs times $1 \cdot (-1)$. Since the product of each pair is conguent to 1 modulo $p$, we have \[(p-1)! \equiv 1\cdot 1 \cdot (-1) \equiv -1 \pmod{p},\] as desired. $\blacksquare$

Algebraic proof
Let $p$ be a prime. Consider the field of integers modulo $p$. By Fermat's Little Theorem, every nonzero element of this field is a root of the polynomial \[P(x) = x^{p-1} - 1 .\] Since this field has only $p-1$ nonzero elements, it follows that \[x^{p-1} - 1 = \prod_{r=1}^{p-1}(x-r) .\] Now, either $p=2$, in which case $a \equiv -a \pmod 2$ for any integer $a$, or $p-1$ is even. In either case, $(-1)^{p-1} \equiv 1 \pmod{p}$, so that \[x^{p-1} - 1 = \prod_{r=1}^{p-1}(x-r) = \prod_{r=1}^{p-1}(-x + r) .\] If we set $x$ equal to 0, the theorem follows. $\blacksquare$

Problems
Introductory
(Source: ARML 2002) Let $a$ be an integer such that $\frac{1}{1}+\frac{1}{2}+\frac{1}{3}+\cdots+\frac{1}{23}=\frac{a}{23!}$. Find the remainder when $a$ is divided by $13$.
Solution
Multiplying both sides by $23!$ yields \[\frac{23!}{1}+\frac{23!}{2}+...+\frac{23!}{23}=a\] Note that $13\mid\frac{23!}{k}$ for all $k\neq13$. Thus we are left with \[a\equiv\frac{23!}{13}\equiv12!\cdot14\cdot15\cdot16\cdot...\cdot23\equiv(-1)(1)(2)(3)(...)(10)\equiv\boxed{7}\mod13\]
Advanced
If ${p}$ is a prime greater than 2, define $p=2q+1$. Prove that $(q!)^2 + (-1)^q$ is divisible by ${p}$. Solution.
Let ${p}$ be a prime number such that dividing ${p}$ by 4 leaves the remainder 1. Show that there is an integer ${n}$ such that $n^2 + 1$ is divisible by ${p}$.

Problem
For how many integers $n$ between $1$ and $50$, inclusive, is \[\frac{(n^2-1)!}{(n!)^n}\] an integer? (Recall that $0! = 1$.)

$\textbf{(A) } 31 \qquad \textbf{(B) } 32 \qquad \textbf{(C) } 33 \qquad \textbf{(D) } 34 \qquad \textbf{(E) } 35$

Solution 1
The main insight is that

\[\frac{(n^2)!}{(n!)^{n+1}}\]
is always an integer. This is true because it is precisely the number of ways to split up $n^2$ objects into $n$ unordered groups of size $n$. Thus,

\[\frac{(n^2-1)!}{(n!)^n}=\frac{(n^2)!}{(n!)^{n+1}}\cdot\frac{n!}{n^2}\]
is an integer if $n^2 \mid n!$, or in other words, if $n \mid (n-1)!$. This condition is false precisely when $n=4$ or $n$ is prime, by Wilson's Theorem. There are $15$ primes between $1$ and $50$, inclusive, so there are 15 + 1 = 16 terms for which

\[\frac{(n^2-1)!}{(n!)^{n}}\]
is potentially not an integer. It can be easily verified that the above expression is not an integer for $n=4$ as there are more factors of 2 in the denominator than the numerator. Similarly, it can be verified that the above expression is not an integer for any prime $n=p$, as there are more factors of p in the denominator than the numerator. Thus all 16 values of n make the expression not an integer and the answer is $50-16=\boxed{\mathbf{(D)}\ 34}$.

Solution 2
We can use the P-Adic Valuation of n to solve this problem (recall the P-Adic Valuation of 'n' is denoted by $v_p (n)$ and is defined as the greatest power of some prime 'p' that divides n. For example, $v_2 (6)=1$ or $v_7 (245)=2$ .) Using Legendre's formula, we know that :

\[v_p (n!)= \sum_{i=1}^\infty \lfloor \frac {n}{p^i} \rfloor\]
Seeing factorials involved in the problem, this prompts us to use Legendre's formula where n is a power of a prime.

We also know that , $v_p (m^n) = n \cdot v_p (m)$ . Knowing that $a\mid b$ if $v_p (a) \le v_p (b)$ , we have that :

\[n \cdot v_p (n!) \le v_p ((n^2 -1 )!)\] and we must find all n for which this is true.

If we plug in $n=p$, by Legendre's we get two equations:

\[v_p ((n^2 -1)!) = \sum_{i=1}^\infty \lfloor \frac {n^2 -1}{p^i} \rfloor = (p-1)+0+...+0 = p-1\]
And we also get :

\[v_p ((n!)^n) = n \cdot v_p (n!)= n \cdot \sum_{i=1}^\infty \lfloor \frac {n}{p^i} \rfloor = p \cdot ( 1+0+...0) = p\]
But we are asked to prove that $n \cdot v_p (n!) \le v_p ((n^2 -1 )!) \Longrightarrow p \le p-1$ which is false for all 'n' where n is prime.

Now we try the same for $n=p^2$ , where p is a prime. By Legendre we arrive at:

\[v_p ((p^4 -1)!) = p^3 + p^2 + p -3\] and \[p^2 \cdot v_p (p^2 !) = p^3 + p^2\]
Then we get:

\[p^2 \cdot v_p (p!) \le v_p ((n^4 -1)!) \Longrightarrow p^3 + p^2 \le p^3 + p^2 + p -3\] Which is true for all primes except for 2, so $2^2 = 4$ doesn't work. It can easily be verified that for all $n=p^i$ where $i$ is an integer greater than 2, satisfies the inequality :\[n \cdot v_p (n!) \le v_p ((n^2 -1 )!)\].

Therefore, there are 16 values that don't work and $50-16 = \boxed{\mathbf{(D)}\ 34}$ values that work.

Wilson's Theorem的更多相关文章

  1. Wilson's theorem在RSA题中运用

    引言 最近一段时间在再练习数论相关的密码学题目,自己之前对于数论掌握不是很熟练,借此机会先对数论基本的四大定理进行练习 这次的练习时基于Wilson's theorem(威尔逊定理)在RSA题目中的练 ...

  2. The Hundred Greatest Theorems

    The Hundred Greatest Theorems The millenium seemed to spur a lot of people to compile "Top 100& ...

  3. Parseval's theorem 帕塞瓦尔定理

    Source: wiki: Parseval's theorem As for signal processing, the power within certain frequency band = ...

  4. 利用Cayley-Hamilton theorem 优化矩阵线性递推

    平时有关线性递推的题,很多都可以利用矩阵乘法来解决. 时间复杂度一般是O(K3logn)因此对矩阵的规模限制比较大. 下面介绍一种利用利用Cayley-Hamilton theorem加速矩阵乘法的方 ...

  5. Kernel Methods (6) The Representer Theorem

    The Representer Theorem, 表示定理. 给定: 非空样本空间: \(\chi\) \(m\)个样本:\(\{(x_1, y_1), \dots, (x_m, y_m)\}, x_ ...

  6. 加州大学伯克利分校Stat2.2x Probability 概率初步学习笔记: Section 4 The Central Limit Theorem

    Stat2.2x Probability(概率)课程由加州大学伯克利分校(University of California, Berkeley)于2014年在edX平台讲授. PDF笔记下载(Acad ...

  7. Wilson定理证明

    Wilson定理证明 就是那个\((p-1)! \equiv -1 \pmod{p}\),\(p\)是一个素数. Lemma A \(\mathbb{Z}_p\)可以去掉一个零元变成一个群. 即\(\ ...

  8. 生成树的个数——基尔霍夫定理(Matrix-Tree Theorem)

    树有很多种形态,给定结点个数,求生成不同形态二叉树的个数,显然要用到Catalan数列. 那如果给定一个图(Graph)\(G=(V,E)\),要求其最小生成树G',最好的方法莫过于Prim或Krus ...

  9. uva 11178 - Morley's Theorem

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

随机推荐

  1. Rancher2.x 一键式部署 Prometheus + Grafana 监控 Kubernetes 集群

    目录 1.Prometheus & Grafana 介绍 2.环境.软件准备 3.Rancher 2.x 应用商店 4.一键式部署 Prometheus 5.验证 Prometheus + G ...

  2. shell命令之一天一见:grep

    一. 简介 grep (缩写来自Globally search a Regular Expression and Print)是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来 ...

  3. 计蒜客A1998 Ka Chang (分块+dfs序+树状数组)

    题意 给你一个\(1e5\)的有点权的树,有\(1e5\)个操作: 1.给第\(x\)层的点加上\(y\) 2.求以\(x\)为根的子树的点权和 思路 首先处理出层数为x的所有点 操作2一般都是用df ...

  4. BZOJ 3343 教主的魔法(分块)

    题意: 有一个1e6的数组,t次操作:将[l,r]内的值增加w,或者查询[l,r]内的值大于等于add的 思路: 分块,块大小为sqrt(n),每次只需要暴力头尾两块,中间的整块打标记, 对于查询查操 ...

  5. 7天用Go动手写/从零实现分布式缓存GeeCache

    1 谈谈分布式缓存 第一次请求时将一些耗时操作的结果暂存,以后遇到相同的请求,直接返回暂存的数据.我想这是大部分童鞋对于缓存的理解.在计算机系统中,缓存无处不在,比如我们访问一个网页,网页和引用的 J ...

  6. 虚拟机 .NAT模式下 配置静态ip后无法ping域名,但可以ping公网ip 问题处理

    在之前的文章 https://www.cnblogs.com/dxxdsw/p/10643540.html 中,在虚拟机中给linux配置了静态ip.[.NAT模式] centos系统: 今天连接发现 ...

  7. centos系统组件优化

    CentOS Linux在公司服务器上广泛被使用,本文总结了一些常见的加固方法. 基本原则: 最小的权限+最小的服务=最大的安全 操作之前先备份: 为避免配置错误无法登录主机,请始终保持有一个终端已用 ...

  8. Go语言实现:【剑指offer】二叉搜索树的第k个的结点

    该题目来源于牛客网<剑指offer>专题. 给定一棵二叉搜索树,请找出其中的第k小的结点.例如,(5,3,7,2,4,6,8) 中,按结点数值大小顺序第三小结点的值为4. Go语言实现: ...

  9. python中调用函数时,参数顺序与参数赋值问题

    设置类和函数如下:class MM(): def ff(self,url(1),method(2),data=None(3),cookie=None(4)): if method.lower()==& ...

  10. python3 ansible api 命令和playbook

    一.api代码 # coding: utf-8 import os import sys from collections import namedtuple from ansible.parsing ...