I thought I had a fairly good understanding of finite projective modules over commutative rings, but I recently asked myself a few questions about them and this exposed how little I actually know. My first question was: can a finite projective module of constant rank $n$ be generated by $n$ elements? The answer is no - a simple example is a non-principal ideal in a Dedekind ring (projective of rank 1 but not generated by one element). (Edit: A finite rank $n$ projective module which can be generated by $n$ elements is necessarily free. There is a surjection from $A^n$ to the module, and a surjection between two finite projective modules of the same constant rank is necessarily an isomorphism). The interesting thing about this example though, is that such an ideal can always be generated by two elements. So, it led me to some other questions:
Let $n<N$ be natural numbers. Is there a commutative ring $A$ and a finite, projective $A$-module $P$ of constant rank $n$ which cannot be generated by fewer than $N$ elements? (Clarification: Can one find such an $A$ and $P$ for every such pair $n, N$?)
If the answer to 1 is no for some $n, N$, then can one find for each $n, N$ a finite module $M$ (not necessarily projective) such that $M_\mathfrak{p}$ can be generated by $n$ elements for each prime ideal $\mathfrak{p}$, but $M$ cannot be generated by fewer than $N$ elements?
Does there exist a commutative ring $A$ and an $A$-module (resp. a projective $A$-module) $M$ which is not finitely generated but such that all localizations $M_\mathfrak{p}, \mathfrak{p} \in Spec(A)$ are finitely generated?
Let $n>0$. Does there exist a commutative ring $A$ and an $A$-module (resp. a projective $A$-module) $M$ which is not finitely generated but such that all localizations $M_\mathfrak{p}, \mathfrak{p} \in Spec(A)$ can be generated by $n$ elements?
Until just a moment ago, I thought I had solved 3 and 4. I thought it was true that: if $M$ is any $A$-module and all localizations $M_\mathfrak{p}$ are finitely generated, then so is $M$.
Incorrect Proof. Let $\mathfrak{p} \in Spec(A)$, and choose a surjective map $A_\mathfrak{p}^n \to M_\mathfrak{p}$. Then since $A^n$ is finitely presented, $\text{Hom}_A(A^n, M)_\mathfrak{p} = \text{Hom}_{A_\mathfrak{p}}(A_\mathfrak{p}^n, M_\mathfrak{p})$ so this surjection can be taken to be the localization of some $f : A^n \to M$. Then since localization is exact,
$U_\mathfrak{p} = \{\mathfrak{q} \in Spec(A) | f_\mathfrak{q} \text{is surjective} \} = \{ \mathfrak{q} | (\text{Coker}(f))_\mathfrak{q} = 0 \} = Spec(A) \setminus Supp(\text{Coker}(f))$
is an open neighborhood of $U_\mathfrak{p}$. Let $D(a_\mathfrak{p})$ be a principal neighborhood of $\mathfrak{p}$ contained in $U_\mathfrak{p}$. Then $M_{a_\mathfrak{p}}$ is a finitely generated $A_{a_\mathfrak{p}}$-module: for every prime $\mathfrak{q}$ of $A_{a_\mathfrak{p}}$, $(f_{a_\mathfrak{p}})_\mathfrak{q}$ is surjective, so $f_{a_\mathfrak{p}}$ is surjective. Also,
$$\bigcup_{\mathfrak{p}} D(a_\mathfrak{p}) = Spec(A)$$
so there is a finite subcover, indexed by $\mathfrak{p}_1, \dots , \mathfrak{p}_n$. Set $a_i = a_{\mathfrak{p}_i}$. Then $a_1, \dots , a_n$ generated the unit ideal of $A$, so $A_{a_1} \times \cdots \times A_{a_n}$ is a faithfully flat $A$-algebra. Further, each $M_{a_i}$ is finitely generated as an $A_{a_i}$ module as we noted earlier. Hence
$$M \otimes (A_{a_1} \times \cdots \times A_{a_n}) = M_{a_1} \times \cdots \times M_{a_n}$$
is a finitely generated $A_{a_1} \times \cdots \times A_{a_n}$-module. By faithful flatness, $M$ is a finitely generated $A$-module.
The error in the proof comes when I show that $U_\mathfrak{p}$ is open: $\text{Coker}(f)$ need not be finitely generated, so $Supp(\text{Coker}(f))$ need not be closed in $Spec(A)$.
So, in the end I am unsure about all of 1,2,3 and 4. I would love to hear anyone's thoughts!