/* Sub- and main programs, fields class nr = 2, d = 0 mod 4, T J Dekker, 2007. */ /* Draws pictures of prime numbers (red) and prime non-principal ideals (green) */ /* obtained by dividing by non-principal ideal of norm 2. */ /* main program moreover uses subprograms from files quadchar.c and sievquad.c. */ /* DrawUnit.c defines 'Initialize' and, by inclusion, drawing subprograms used. */ /* radicands < 100, class nr == 2, bynorm 2 is not norm of principal ideal int bynorm = 2; int radicand[]= { -58, -37, -22, -13, -10, -6, -5, 10, 15, 26, 30, 35, 39, 42, 55, 58, 70, 74, 78, 87, 91, 95, 0 }; /* radicands < 100, class nr == 2, bynorm 3 is not norm of principal ideal */ int bynorm = 3; int radicand[]= {34, 51, 66, 102, 0 }; void showitem() { char it[30]; RGBForeColor(&blue); sprintf(it, " prime numbers "); drawstring(it); RGBForeColor(&green); sprintf(it, " units "); drawstring(it); RGBForeColor(&red); sprintf(it, " prime ideals by norm %d ", bynorm); drawstring(it); RGBForeColor(&black); } /* end showitem */ void drawitem(int x, int y, int norm) /* draws prime and unit of field for discriminant discr % 4 == 0 */ { if (norm >= maxnorm) drawprim(x, y, &black); /* too large */ else if (norm == bynorm) drawprim(x, y, &black); /* reject bynorm */ else if (inset(norm, prinorm)) drawprim(x, y, &blue); /* primes blue */ else if (norm == 1) drawprim(x, y, &green); /* draw unit green */ else /* draw non-principal ideals in red color */ if (norm % bynorm == 0 && inset(norm/bynorm, prinorm)) drawprim(x, y, &red); } /* end drawitem */