you are right in thinking # 1 is right and 32 is incorrect because " consider" must be followed by "+ing" form.
And, you're also right in saying we also use #3. And you ask what the difference is between #2 and #3.
The difference is that #2 does not use the " consider it necessary" construction, which must be followed by the infinitive (to do ) form.
As you no doubt know, there's a long list of other verbs that can be followed directly by infinitives rather than an -ing form, e.g., agree, arrange, ask , hope, learn, etc. The verb "consider" is not in that list, and must instead be follwed by an -ing form. However, the " it is necessary +to do " pattern only takes the infinitive.