CODING ★ AMSTRAD ACTION DISCOURSE - DRAIM'S ALGORITHM TO FIND A PRIME FACTOR OF A NUMBER|Amstrad Action) ★

Amstrad Action Discourse - Draim's Algorithm to Find a Prime Factor of a Number
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

More Greek with JAMES WILSON, who proves that after all there's not very much new under the sun. (Erastosthenes, for example, calculated the circuinference of the earth almost exactly - and that was 2,000 years ago!)

Ptolemy III, named Eurgetes (247-222 BC), continued the tradition of his grandfather in fostering the Great Alexandrian Library and encouraged the librarian Erastosthenes (276-194 BC) who is often considered to be the most learned man of antiquity.

Erastosthenes measured the earth by measuring the difference in the length of Che shadows cast by the sun's rays at Alexandria and Syene, which was known to be 50,000 stadia due south.

He arrived at a figure of 250,000 stadia, about 25,000 miles - just 100 miles Dver the actual equatorial circumference!
The 'Sieve of Erastosthenes1

Like all the sages of his era, Erastosthenes spent some time studying numbers. He is probably best remembered for the 'Sieve of Erastosthenes.'

This method for finding the Prime Numbers operates thus -

Write down the integers (whole numbers;. Circle tlie two, then strike out every second integer. Put a circle around 3 then strike out every third integer. The next un-struck integer is 5, so circle it and strike out every fifth integer. Proceed thus and the only unstruck integers will be circled and are the Prime Numbers.

Navy moves

In 1952 an interesting Prime Factor algorithm was published after its discovery by Captain N.A. Draim of the US Navy. In effect, this algorithm operates by sieving out the primes as possible factors of a number.

However for simplicity, the form of the algorithm that sieves out the odd numbers generally will be propounded here. It is left to the amusement of the reader to make it more efficient.

To explain and show how tlie algorithm proceeds an example and its algebraic equivalent axe given in parallel in the box below. There then follows a Basic Program which corresponds exactly to the algebra.

As in all the Discourse programs, change the value of a, the window parameter, if you want to re-direct the output to a printer.

In order to make the algorithm use less data memory, only the results from the current iteration and the one before are retained line 130 effects the switch as each iteration is completed.

AA

★ YEAR: 1989
★ AUTHOR: James Wilson
 

Page précédente : Amstrad Action Discourse - Fermat's Algorithm to Find a Prime Factor of a Number
★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» Draim  s  Algorithm  to  Find  a  Prime  Factor  of  a  Number    (Amstrad  Action)    ENGLISHDATE: 2021-02-06
DL: 146
TYPE: ZIP
SiZE: 4Ko
NOTE: 40 Cyls
.HFE: Χ

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding Src's » MOD Constant multiplication (CPC Amstrad International)
» Coding Src's » Multiplication 16 et 8 bits
» Coding » Amstrad Action Discourse - Euclid's Algorith to Calculate the H.C.F of Two Numbers
» Coding » Clefs1 26 Les Vecteurs d'appel des Routines Mathématiques
» Coding Src's » Truly Random RND (CPC Computing)
» Coding Src's » Division 16 bits
Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce programme ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 158 millisecondes et consultée 718 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.