Question
Written in assembly using MARS-ARM. Can you please help me write this in assembly? This ARM assembly program is to determine the number of prime
Written in assembly using MARS-ARM. Can you please help me write this in assembly?
This ARM assembly program is to determine the number of prime numbers in a given range of values using the simple, ancient algorithm proposed by the Greek mathematician, Eratosthenes around 200 B.C.
The algorithm is described in a questionable source as follows:
A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself.
To find all the prime numbers less than or equal to a given integer n by Eratosthenes' method:
Create a list of consecutive integers from two to n: (2, 3, 4, ..., n), Initially, let p equal 2, the first prime number, While enumerating all multiples of p starting from p2, strike them off from the original list, Find the first number remaining on the list after p (it's the next prime); let p equal this number, Repeat steps 3 and 4 until p2 is greater than n. All the remaining numbers in the list are prime.
Use your assembly program to determine the number of prime numbers in the range from 0 to a value entered by the user. Make sure that you inform the user of the limits of your programs ability.
Example Run
Please enter the maximum value to be tested for prime numbers: 15000
In the range of 1-15000, the number of primes is: 1754
Program terminated.
Thanks!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started