hello,everyone,i just saw a program in c that computes all carmichael numbers to a MAXNUMB defined constant.The whole program up on computing the carmichael numbers is based on Korselt's criterion(see link above in wiki).Even though i understand the general philosophy of the algorithm i still have some questions about it..I want someone to explain me the red code actually if possible..It's where this temp confuses me a bit..It's maybe obvious or ridiculous to explain but at this time at night i thought i will give it a try and post it here.Thanks in advance!

Code:

#include <stdio.h>
#include <math.h>
#define MAXNUMB 1000000
main()
{
int N,d,a,b,temp;
for (N=561;N<=MAXNUMB;N+=2) {
a=0;
b=0;
for (d=3;d<=sqrt(N);d+=2)
if (N%(d*d)==0)
a=1;
if (a==0){
temp=N;
for (d=3;d<=(temp);d+=2) {
if (temp%d==0){
if ((N-1)%(d-1)!=0)
a=1;
else{
temp/=d;
b++;
}
}
}
}
if ((a==0)&&(b>1)){
temp=N;
printf("%d is a Carmichael number: ", N);
for (d=3; d<=(temp);d+=2){
if (temp%d==0){
printf("%d ", d);
temp/=d;
}
}
printf("\n");
}
}
printf("Done!");