Matsumura, Exercise 18.8: Cohen-Macaulay and (not) Gorenstein I need an answer to the exercise 18.8 of Matsumura's book:" Commutative Ring Theory", and generate an algorithm if possible. 
Let $k$ be a field and $t$ an indeterminate. Consider the subring $A = k[[t^3, t^5,t^7]]$ of $k[[t]]$ and show that $A$ is a one-dimensional Cohen-Macaulay ring which is not Gorenstein. How about $k[[t^3,t^4,t^5]]$ and $k[[t^4,t^5,t^6]]$?  
ADDED: Is there an algorithm for the general case: $A=k[[t^a,t^b,t^c]]$, where $a,b,c$ are natural numbers?
My attempt: $A$ is Cohen-Macaulay, because it's a domain of $\dim\, 1$.
 A: This is a classic question, concerning the Gorenstein property of affine semigroup rings. I will follow the presentation in Bruns-Herzog, section 4.4. Let $S$ be a numerical semigroup, i.e. a submonoid of $\mathbb{N}$ with $|\mathbb{N} \setminus S| < \infty$, with minimal generating set $S = \langle a_1, \ldots, a_n \rangle$ (so that every $s \in S$ is of the form $s = z_1a_1 + \ldots + z_na_n$, $z_i \in \mathbb{N}$). Let $c := \max\{a \in \mathbb{N} \mid a - 1 \not \in S\}$ be the conductor of $S$, and $k[S] = k[t^{a_1}, \ldots, t^{a_n}]$ the semigroup ring. As noted above, $k[S]$ is a $1$-dim Noetherian domain, hence Cohen-Macaulay.
Proposition: $k[S]$ is Gorenstein iff $S$ is symmetric, in the sense that for each $0 \le i \le c - 1$, $i \in S \iff c - i - 1 \not \in S$. Equivalently, $S$ is symmetric iff $|S \cap [0, \ldots, c-1]| = c/2$ (in particular, $c$ must be even). 
Examples: i) $S = \langle 3, 5, 7 \rangle$: then $c = 5$ is odd, so $S$ is not symmetric. Note that the interval $[0, 1, 2, 3, 4]$ contains $2$ elements of $S$ (i.e. $0$ and $3$) but $3$ elements outside $S$.
ii) $S = \langle 3, 4, 5 \rangle$: then $c = 3$ is again odd, so $S$ is not symmetric.
iii) $S = \langle 4, 5, 6 \rangle$: then $c = 8$, and $[0, 1, 2, 3, 4, 5, 6, 7]$ contains the same number of elements of $S$ (i.e. $0, 4, 5, 6$) as non-elements, so $S$ is symmetric.
