Consider the following Condition (C) on a positive integer $k$:
(C) If $R$ is a commutative ring, if $F$ is a free $R$-module, and if $f$ is an endomorphism of $F$, then $f$ is an $R$-linear combination of $k$ idempotent endomorphisms of $F$.
The question is
(a) Is there a positive integer $k$ satisfying Condition (C)?
If $R$ is a field and $F$ finite dimensional, Clément de Seguins Pazzis proves in this paper that $f$ is an $R$-linear combination of three idempotents. George Lowther announced a generalization of this result to the infinite dimensional case.
In this post George Lowther shows the following:
(b) Any endomorphism of any free $R$-module of infinite rank is a $\mathbb Z$-linear combination of twelve idempotents. (The argument works even if $R$ is not commutative.)
For any positive integer $n$ let $R_n$ be the ring $$ R_n:=\mathbb Z[(a_{ij})_{1\le i,j\le n}], $$ where the $a_{ij}$ are indeterminates, and form the $n$ by $n$ matrix with entries in $R_n$ $$ A_n:=(a_{ij})_{1\le i,j\le n}. $$ In view of (b), Question (a) is equivalent to
Is there a positive integer $k$ such that, for all $n$, the matrix $A_n$ is an $R_n$-linear combination of $k$ idempotents of $M_n(R_n)$?
I asked a related question on Mathematics Stack Exchange.