title: Why not work with numbers greater than 10 digits?
body: <p>Hello community I have the following problem The following code does not converge to any solution for numbers exceeding 10 digits, and do not know where the problem can be as knowing that the number is prime would be met Fermat's little theorem in one call function.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  
  unsigned long exp_mod(unsigned long x, unsigned long y, unsigned long n)
  {
      unsigned long s,t,u;
      int i;
      s=1; t=x; u=y;
      while(u) {
          if (u&amp;1) s=(s*t)%n;
          u&gt;&gt;=1;
          t=(t*t)%n;
      }
      return s;
  }
  
  int main(){
      unsigned long number,a,b;
      int i;
      printf("introduce number to test\n");
      scanf("%lu",&amp;a);
      number=a;
      srand((unsigned int)time(0));
  
      while (1) {
          a=rand()%(number-1)+2;//0&lt;a&lt;number
          b=exp_mod(a,number-1,number);
          if ( b==1 ) {
              printf ("by Fermat:  %lu is prime\n",number);
              break;
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>Any suggestions? regards</p>