#include <stdio.h>
void multi(int *p, int k, int *n);
int dat[101], res[100];
int main()
{
int i, j, n, cnt;
printf("Input N: ");
scanf("%d", &n);
for (i = 1; i <= n; i++) dat[i] = i;
for (res[0] = cnt = i = 1; i <= n; i++) {
if (dat[i] == 1) continue;
multi(res, dat[i], &cnt);
for (j = 2; j * i <= n; j++) dat[j*i] /= dat[i];
}
printf("%d", res[cnt-1]);
for (i = cnt-2; i >= 0; i--)
printf("%04d", res[i]);
return 0;
}
void multi(int *p, int k, int *n)
{
int i, c, tmp;
for (c = i = 0; i < *n; i++) {
tmp = p[i] * k;
p[i] = c + tmp % 10000;
c = tmp / 10000;
}
if (c > 0) p[(*n)++] = c;
}
int main()
{ int i, j, n, cnt; printf("Input N: "); scanf("%d", &n); for (i = 1; i <= n; i++) dat = i; for (res[0] = cnt = i = 1; i <= n; i++) { if (dat == 1) continue; multi(res, dat, &cnt); for (j = 2; j * i <= n; j++) dat[j*i] /= dat; } printf("%d", res[cnt-1]); for (i = cnt-2; i >= 0; i--) printf("%04d", res); return 0;
}
void multi(int *p, int k, int *n)
{ int i, c, tmp; for (c = i = 0; i < *n; i++) { tmp = p * k; p = c + tmp % 10000; c = tmp / 10000; } if (c > 0) p[(*n)++] = c;
}