int main()
{
long a=10000,b,c=2800,d,e,f[2801],g;
for(;b-c;) f[++b]=a/5;
for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)
for(b=c;d+=f*a,f=d%--g, d/=g--,--b;d*=b);
}
Should be fairly easy to port to even a 4bit microcontroller as long as it has enough memory/flash