![]() | ![]() | |||
TAMS / Java / Hades / applets: contents | previous | next | ||||
Hades Applets contents visual index ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Mips R3051: prime numbers (1024 elements)
Circuit Description
This applet demonstrates yet another simple algorithm to calculate
prime numbers.
Detected prime numbers are stored in an array starting at
program address 0x00000400,
corresponding to memory component address 0x0100.
FIXME: This needs to be updated. Sorry. #include "initcode.h" void prim(int max, int startadr) { int prim, teiler, *adr, teilt; adr = (void*) startadr; *adr = 2; for (prim = 3; prim < max; prim += 2) { teiler = 3; teilt = 0; while (teiler * teiler <= prim) { if (prim % teiler == 0) { teilt = 1; teiler = prim; } else { teiler += 2; } } if (teilt == 0) { adr++; *adr = prim; } } } void waitloop( void ) { int i, *ptr; ptr = (void*) (0x0400 - 32); for( i=0;; i++ ) { *(ptr) = i; } } int main(void) { prim(0x400, 0x400); waitloop(); }
| |||
Print version | Run this demo in the Hades editor (via Java WebStart) | ||||
Usage | FAQ | About | License | Feedback | Tutorial (PDF) | Referenzkarte (PDF, in German) | ||||
Impressum | http://tams.informatik.uni-hamburg.de/applets/hades/webdemos/76-mips/65-prim/prim.html |