Factoriales

Time Limit:
1 Sec
Memory Limit:
128Mb
Enviados:
87
Resuelto:
37
Enviar IDE Estado

Descripción

Existen varios tipos de factoriales y ponemos sus definiciónes a continuación


 

  • Factorial: $n!=\prod_{k=1}^n k$
  • Doble factorial: $n!!=n(n-2)\ldots 4 \cdot 2 \text{ cuando n par }$ y $n!=n(n-2)\ldots 3 \cdot 1 \text{ cuando n impar }$
  • Primorial: $n\#=\prod_{p\leq n} p$ donde p es un numero primo
  • Super factorial=$sf(n)=\prod_{k=1}^n k!$
  • Hiper factorial=$Hf(n)=\prod_{k=1}^n k^{k}$


 

Ejemplo:

  • Doble factorial: $4!!=4 \cdot 2 =8$
  • Factorial: $4!=4\cdot 3 \cdot 2 \cdot 1=24$
  • Primorial: $4\#=3 \cdot 2=6$
  • Super factorial=$sf(4)=4!\cdot 3! \cdot 2! \cdot 1!=24\cdot 6 \cdot 2 \cdot 1=288$
  • Hiper factorial=$Hf(4)==4^{4}\cdot 3^{3} \cdot 2^{2}=256\cdot 27 \cdot 4=27648$


 

En la entrada se tiene un número n del cual hay que hallar todos los factoriales descritos, modulo 10007.

Para el ejemplo el resultado después de aplicar el modulo es 24 8 6 288 7634.

Entrada

 

 

La entrada consiste de varios casos de prueba. La primera linea indica cuantos casos de prueba hay. Cada caso de prueba consiste de un número ($1 \leq n \leq 10^5$).

 

 

Salida

 

 

En la salida escriba los factoriales en el orden descrito en una linea y separados por un espacio.

 

 

Ejemplo Entrada

Copy icon
3
4
7
10

Ejemplo Salida

Copy icon
24 8 6 288 7634
5040 105 210 1480 2203
6266 3840 210 8658 2305

Ayuda

2 2 2 2 4
6 3 6 12 108
24 8 6 288 7634
120 15 30 4539 9569
720 48 30 5798 8973
5040 105 210 1480 2203
292 384 210 1859 2803
2628 945 210 2036 4667
6266 3840 210 8658 2305
8884 388 2310 3870 7682
6538 6052 2310 4364 2296
4938 5044 9 4361 1963
9090 4672 9 3763 841
6259 5611 9 6146 3689
74 4703 9 4489 1022
1258 5324 153 3214 6084
2630 4598 153 6912 4377
9942 1086 2907 1035 3392
8707 1897 2907 5445 5747
2721 2792 2907 5485 6865
9827 1706 2907 3393 9275
5867 4174 6819 2808 3489
710 916 6819 2287 3512
7743 4280 6819 5858 3144
1178 3802 6819 5901 2898
1785 5483 6819 5921 6823
9952 6386 6819 4576 1877
8412 8902 7618 6390 4373
2185 1447 7618 2385 4094
7693 5773 5997 4974 1388
6008 6276 5997 2890 9684
8131 376 5997 2154 5754
6265 3237 5997 5374 6469
9128 3153 5997 9565 1741
8223 2684 4698 8046 1924
9866 7453 2716 6312 4602
9580 8483 2716 6666 2293
8003 8590 2716 681 4949
7808 4260 2716 3531 2041
796 968 2716 8716 5267
2046 2049 2716 462 4447
1522 6423 4417 2674 9515
1676 3808 4417 8495 9525
5665 9906 4417 512 1479
4208 2039 4417 2991 8587
9026 1624 6359 7887 1078
7659 1157 6359 4281 528
560 7949 6359 5687 1083
4318 5294 5431 5596 7703
7662 8311 5431 6564 1109
3348 2901 5431 900 9091
5383 8667 5431 1312 6485
409 4592 1215 4614 6425
7661 3848 1215 3130 4185
2229 6463 1904 1891 1637
7674 8305 1904 1384 4357
46 6491 7220 3622 6662
8924 43 7220 118 463
8969 4863 7220 7607 6925
6699 8428 7220 3649 6773
8920 9251 7665 4331 1381
1028 1640 7665 9160 5926
7034 3043 7665 6374 6900
456 3828 7665 4514 2348
1618 8120 8105 8549 9738
801 5972 7471 6365 5771
2974 8858 7471 6273 5325
4996 9393 7471 7991 1624
5781 8282 7471 3207 7905
3454 2011 3915 9236 1883
3733 3933 3915 3873 6464
8431 1829 3915 422 6686
41 2101 3915 7295 8877
6434 2918 8823 3200 2551
4662 4014 8823 7970 1770
7477 5135 8823 5 4202
8601 522 8823 2977 9159
3183 2963 7491 7028 6714
7692 9324 7491 1562 8206
1145 6445 7491 7244 7578
3037 5496 9776 8350 6136
7792 8377 9776 7693 3355
8933 6496 9776 3500 9940
2541 9475 4800 3897 6164
7205 9147 4800 8250 1013
4226 2067 7059 4394 5457
7876 889 5326 1646 1706
5910 3665 5326 1056 4588
7148 6585 5326 3010 2480
3566 8759 3930 9885 9006
3155 9210 2737 1373 8005
6130 3052 8203 5350 4371
1039 6017 8203 4765 1712
5977 8754 5331 483 3314
2953 8727 8214 1187 9380
928 6754 8214 766 5500
9478 556 3875 1492 649
2958 3209 673 249 6460
19 4503 673 4731 4664
8974 3551 673 6300 3818
7728 9857 673 2345 4954
317 2066 673 2847 9193
8089 1251 6751 288 9503
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
7701 3486 9186 9911 8857
0 0 0 0 0
0 0 0 0 0