Say $f$ is a newform of weight $k$ and level $\Gamma\_1(N)$. $f$ is called CM if, for example, there is an imaginary quadratic field $K$ such that for all $p\nmid N$ which are inert in $K$, the $p$th Fourier coefficient $a\_p$ of $f$ is 0. (Ribet's article [*Galois representations attached to eigenforms with Nebentypus*](http://dx.doi.org/10.1007/BFb0063943) is a nice reference for this material). Specific examples include the newforms attached to CM elliptic curves. All examples arise as inductions of algebraic Hecke characters of $K$ of type $(k-1,0)$.


Is there an effective bound in terms of $k$ and $N$ (or other basic invariants of $f$) on how many $a\_p$ you have to check to know whether or not $f$ is CM? Or, is there an effective bound on the discriminant of the associated $K$ and the conductor of the associated algebraic Hecke character? What if we assume GRH?


A related question was asked [here](https://mathoverflow.net/questions/49937) by Mike Bennett, but no answer has been given.


My motivation is simply to be able to computationally check if a given newform is CM using, say, SAGE. Thanks.



Effective detection of CM modular forms
If the form is CM then it will be isomorphic to a quadratic twist of itself. So I think what I'd do with a form which I suspect is or is not CM is to just twist by all the (finitely many ) possible quadratic characters that could be involved and then to check to see if $f$ is the same as its twist, which one can do by proving that the difference is zero using the standard bound (1+degree of $\omega^k$ on the modular curve).


