I also believe the OP may be a bit BIP incompliant.
I do not see an RPC command or a Field in getwork - getworkex or getblocktemplate that gives the current Nfactor.
I may be wrong and missed it, but withholding vital mining information from RPC is ,shall we say "dirty pool"
