Cint a=10000,b,c=2800,d,e,f[2801],g;main(){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[b]*a, f[b]=d%--g,d/=g--,--b;d*=b);}
C++ (Qt)//вывод на экран строкиvoid print_str(int x){static int Cx = 0;static AnsiString str; Cx++; if (x < 10) str += "0"; if (x < 100) str += "0"; if (x < 1000) str += "0"; str += IntToStr(x); // + " "; if (Cx % 20 == 0) { Form1 -> Memo1 -> Lines -> Add(str); str = ""; } return;} void __fastcall TForm1::Button1Click(TObject *Sender){ AnsiString str; unsigned int a = 10000;unsigned int b = 0;unsigned int c = 5600;unsigned int d = 0;unsigned int e = 0;unsigned int f[5601];unsigned int g = 0; Button1 -> Enabled = false; //заполняет массив значением а/5 = 2000 for (b = 0; b < c+1; b++) f[b] = a/5; //вычисление while(c) { d = 0; g = c * 2; for (b = c; b > 1; b--) { d += f[b] * a; g--; f[b] = d % g; d /= g; g--; d *= b; } //вывод строки на экран print_str(e + d/a); c -= 14; e = d % a; } return;}