Erdős-primes: Difference between revisions
→{{header|C}}: Updated in line with Wren example of which it is a translation.
(→{{header|Go}}: Updated in line with Wren example of which it is a translation.) |
(→{{header|C}}: Updated in line with Wren example of which it is a translation.) |
||
Line 418:
#define LIMIT 1000000
#define LOWER_LIMIT 2500
bool
d += 2;▼
d += 4;▼
return true;▼
limit++;
// True denotes composite, false denotes prime.
Line 452 ⟶ 438:
}
}
if (!c[i]) ++pc;▼
for (i = 0, j = 0; i < limit; ++i) {▼
if (!c[i]) primes[j++] = i;▼
}
int main() {
int i, j, fact
bool found;
int
for (i =
j = 1;
fact = 1;
found = true;
while (fact <
if (
found = false;
break;
fact *= j;▼
}
▲ ++j;
▲ fact *= j;
▲ lc = i;
▲ break;
}
}
setlocale(LC_NUMERIC, "");
printf("The %'d Erdős primes under %'d are:\n",
for (i = 0; i <
printf("%6d ", erdos[i]);
if (!((i+1)%10)) printf("\n");
}
printf("\n\nThe %'dth Erdős prime is %'d.\n",
free(
return 0;
}</syntaxhighlight>
|