Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
150115_PrimoDelFactorial
//Title of this code //gcc 4.8.2 #include <stdio.h> #include <math.h> long factorial(long n); short cumplePropiedad(long n); short esPrimo(long n); int main(void) { long n; for(n = 0 ; n < 20 ; n++) { if(cumplePropiedad(n)) { printf("%4ld --> [%25ld] SÍ es PRIMO.\n", n, factorial(n)); } else { printf("%4ld --> [%25ld] NO es PRIMO.\n", n, factorial(n)); } } return 0; } long factorial(long n) { return n ? n * factorial(n - 1) : 1; } short cumplePropiedad(long n) { return esPrimo(factorial(n) - 1); } short esPrimo(long n) { if(n <= 2) return 1; long d; for(d = 2 ; d <= sqrt(n) && n % d ; d++); return n % d; }
run
|
edit
|
history
|
help
0
BSEARCH() COMPLETE
qsort
1.3 Max threads
AC_setting_example
MatrixMul_shortxshort
14th Feb Programming Project v.01
---DISEÑO DE TECLADO---
Link List
CO Assignment 1 Question 4
HeapSort