Determining if a ring satisfies Serre's condition S_{n} Given a specific ring $R$ (eg, $R=k[x_{1}, \cdots, x_{n}]/I)$ is there a (simple) way to determine whether or not $R$ satisfies Serre's condition $S_{n}$?  In particular, is there a way to do this in Macaulay2?
($R$ satisfies $S_{n}$ if $depth R_{p} \geq \min(height(p), n)$ for all $p \in Spec R$.)
 A: I think there is a neat answer to this question. 

Lemma: Let $S$ be regular local of dimension $d$, $M$ a f.g $S$-module. Then:
  $$\text{depth}(M)\geq n \Longleftrightarrow \text{Ext}^i(M,S)=0\  \text{for} \ i>d-n$$  

Proof: LHS is equivalent to $e= \text{pd}_SM \leq d-n$. By using a minimal free resolution of $M$ to compute Ext, one sees that $\text{Ext}^i(M,S)$ is not $0$ for $i=e$ (Nakayama's lemma) and $0$ for $i>e$. 
Now let $A=k[x_1,\cdots,x_d]$, $R=A/I$. Here is the main:

Claim: $R\ \text{is}\ (S_n) \Longleftrightarrow \text{dim}(\text{Ext}_A^i(R,A))\leq d-n-i \ \forall i>d- \text{dim}(R)$ 

(of course, we only need to check for values of $i$ up to $d$, as $A$ has finite global  dimension $d$).
Proof: By Lemma one needs to check that for all $p\in \text{Spec} \ A$:
$$\text{Ext}_{A_p}^i(M_p,A_p)=0\  \text{for} \ i>\text{dim}(A_p) -\min\{n,\text{\dim}(R_p)\}=\max\{\text{dim}(A_p)-n,\text{dim}(A_p)-\text{dim}(R_p)\}$$
This condition is equivalent to the fact that for all $i>0$ and each $p$ in the support of $\text{Ext}_A^i(R,A)$ we must have $i\leq \max\{\text{dim}(A_p)-n,d-\text{dim}(R)\}$. Note if $i < d-\text{dim}(R)$, $\text{Ext}^i(R,A)=0$, so the claim follows. 
You can compute both Ext and dimension with Macaulay 2. 
