Q:

Prime and Factorial in C

I've written a program in c and it gives me wrong output. 
The task is to print every prime number<=10000000 which is equal to another factorial of another number plus or minus 1. 
Here is my code:
#include <stdio.h>
#include <stdlib.h> 
#include <math.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int prime( int k) 
{ 
    int i ; 
    for (i=2; i<=sqrt(k)+1 ; i++) 
    { 
        if (  (k%i) ==0 )   
        { 
            return 0 ; 
        }      
    } 
    return 1 ; 
} 

int paragontiko( int k) 
{ 
    int s;
    int i ; 
    s=1;

    for (i=2; i<=k ; i++) 
    { 
        s=s*i;
    } 
    return s;
}

int main(int argc, char *argv[]) 
{
    int k;
    int i;
    for (i=2;i<=10000000;i++)
    {
        if (prime(i))
        {
            for (k=2;paragontiko(k)<=i;k++)
            {
                if (paragontiko(k)+1==i) printf("%d\n",i);
                if (paragontiko(k)-1==i) printf("%d\n",i);
            }
        }
    }
    return 0;
}

When I run it, it prints only the numbers 3(equal to 2!+1) and 7(equal to 3!+1).  But what about 5(equal to 3!-1)?  etc. 
Thanks in advance

A:

It's this condition :
    for (k=2;paragontiko(k)<=i;k++)

If i = 5, paragontiko(3) = 6 so you don't go into the loop. 
The condition should be :
    for (k=2;paragontiko(k) - 1 <=i;k++) 

