problem in understanding prime quine

hello friends,recently a problem in the codezip named “PRIME-QUINE”.what is the logic behind it i came to know that file handling will not going to work thats okay what could be the second method/approach…

#define q(x)b=#x;x
q(v;main(i){for(scanf("d",&v);v++i;);v=!printf(i-v?"#define q(x)b=#x;x\nq(%s)":“YES”,b);})

here is the code i got from one submitted solution

http://www.madore.org/~david/computers/quine.html

I think this link will explain your doubts…