100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Programming Practice £8.49   Add to cart

Other

Programming Practice

 6 views  0 purchase

These documents will help you learn how to code, assisting you with your course.

Preview 1 out of 1  pages

  • May 2, 2022
  • 1
  • 2021/2022
  • Other
  • Unknown
book image

Book Title:

Author(s):

  • Edition:
  • ISBN:
  • Edition:
All documents for this subject (91)
avatar-seller
cdfkmgkjnfjn
Unit 1 Programming
Tutorial 5: Software Design V
To be used in week 5, week beginning 8 October 2018.


Following from the previous pseudocode problems, supply code for the follow situation:


The Prime Problem
A prime number is an integer, greater than 1, which has no exact integer factor other than 1 and the number itself.
That is to say, there are no values, which, if you divide the number by them, give a remainder (or modulus) or zero.
Obviously, the only even prime is 2, and then the odd primes start 3, 5, 7, 11, 13, 17, ...
As well as underlying a lot of pure mathematics, they are of great importance in such computational tasks as the
(security-related) enciphering of information. Multiply your data by a prime and you can only recover the original
using the prime; if you start with a non-prime, the factors will allow a multitude of intermediate steps (each will usually
reveal some information, suggesting that this value be kept and used). There is no known limit to the magnitude of
primes, and no way of finding them apart from testing that they have no modulus == 0 factors.
Write an algorithm which takes an integer and states whether or not it is a prime. Note that you only need to test
whether the candidate prime can be exactly divided by other, smaller primes. For example, any factor of 6 must also
be a factor of 2 and 3, and any factor of 9 must also be a factor of 3.
Using stepwise refinement write down a suitable solution to this problem in pseudocode, NOT Java.




1

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller cdfkmgkjnfjn. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for £8.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73216 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy revision notes and other study material for 14 years now

Start selling
£8.49
  • (0)
  Add to cart