The synthesis of pyrrolo[2, 3-d]pyrimidine derivatives was accomplished by the following two methods. One is the palladium-catalyzed reaction terminal acetylenes with N-(5-halo-4-pyrimidinyl)methanesulfonamides prepared by the nucleophilic substitution of 4-chloro-5-halopyrimidines with methanesulfonamide. The other is the photocyclization of 4-azidopyrimidines containing an olefinic function at the 5-position. The synthesis of 4-azidopyrimidine derivatives is also described.