News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ComSoft6128

Locomotive BASIC - Sieve Of Eratosthenes by Simon Benge

Started by ComSoft6128, 07:13, 04 March 22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ComSoft6128

Type in from the December 1988 issue of 'CPC Computing' magazine.
The program is Listed at the end of the video.
Info from the magazine (With thanks to CPCRulez):
"Prime numbers have fascinated mathematicians for thousands of years, and several methods have been devised for calculating them. Even as you read this, super computers in American universities are working flat out to find the next highest prime number, which is probably too big to be of any use.
One popular way of finding primes is to use the sieve method discovered by the ancient Greek Eratosthenes. This involves writing a list of numbers from one to any limit, for instance:

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
When this process is complete, we'll be left with the prime numbers:

1 2 3 5 7 11 13 17 19
Simon's version will handle a maximum list of 4000 numbers, and takes a little over two minutes to find them all. This limit of 4000 is set by the memory available on the CPC464.

We now simply remove every second number after two, every third number after three, and so on."


Links:
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
https://cpcrulez.fr/applications_util-sieve_of_eratosthenes_CCTG.htm
https://www.cpc-power.com/index.php?page=detail&num=17626

Not emulated - original hardware and software.
Please note that the aspect ratio for this YouTube video is 16:9 but the CPC monitor
has an aspect ratio of 4:3 so you may wish to adjust your viewing device accordingly.


Powered by SMFPacks Menu Editor Mod