Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
150116_FactorialPrimo
//Title of this code //gcc 4.8.2 #include <stdio.h> #include <math.h> short esPrimoFactorial(long n); long factorial(long n); short esPrimo(long n); int main(void) { long n; for(n = 0 ; n < 20 ; n++) { if(esPrimoFactorial(n)) { printf("%3ld --> %20ld SÍ es PRIMO\n", n, factorial(n) - 1); } else { printf("%3ld --> %20ld NO es PRIMO\n", n, factorial(n) -1); } } return 0; } short esPrimoFactorial(long n) { return esPrimo(factorial(n) - 1); } long factorial(long n) { long F = 1; while(n) F *= n--; return F; } 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
finalpyramid
ayudantia 1 mod 4
bitmask shift
My first program
2.1.1 Prime numbers in different threads with thread ID
shrinken shraken shrank leave as no cold call acces program unles clownbtweak blue voda
faster posting list using skip pointers
FUNCTIONS Shape functions
Hello world!
18BCE2182 ASSESS_1 Q2-2