zad2
This commit is contained in:
parent
af8beab822
commit
6bce1cda35
|
@ -3,7 +3,7 @@
|
|||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
#define N 100
|
||||
#define N (1 << 10) - 1
|
||||
|
||||
struct bool_store {
|
||||
int v : 1;
|
||||
|
@ -41,6 +41,20 @@ void doSE()
|
|||
}
|
||||
}
|
||||
|
||||
void do_and_print_mersenne()
|
||||
{
|
||||
int p, m, j;
|
||||
for (p = 2; p <= 20; p++) {
|
||||
if (!A_bf2_get(p))
|
||||
continue;
|
||||
m = (1 << p) - 1;
|
||||
for (j = 2; j <= sqrt(m); j++)
|
||||
if (m % j == 0)
|
||||
continue;
|
||||
printf(" 2 ^ %2d - 1 = %6d \n", p, m);
|
||||
}
|
||||
}
|
||||
|
||||
#define FILL_CHAR '-'
|
||||
|
||||
void do_and_print_eratostenes()
|
||||
|
@ -52,8 +66,12 @@ void do_and_print_eratostenes()
|
|||
putchar('\n');
|
||||
putchar(' ');
|
||||
if (A_bf2_get(i))
|
||||
printf(" %2d", i);
|
||||
printf("%4d", i);
|
||||
else {
|
||||
if (i >= 1000)
|
||||
putchar(FILL_CHAR);
|
||||
else
|
||||
putchar(' ');
|
||||
if (i >= 100)
|
||||
putchar(FILL_CHAR);
|
||||
else
|
||||
|
@ -68,10 +86,6 @@ void do_and_print_eratostenes()
|
|||
putchar('\n');
|
||||
}
|
||||
|
||||
void do_and_print_mersenne()
|
||||
{
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
do_and_print_eratostenes();
|
||||
|
|
Loading…
Reference in New Issue