100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

Programming Practice

Rating
-
Sold
-
Pages
1
Uploaded on
02-05-2022
Written in
2021/2022

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

Institution
Module








Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Study Level
Examinator
Subject
Unit

Document information

Uploaded on
May 2, 2022
Number of pages
1
Written in
2021/2022
Type
Other
Person
Unknown

Subjects

Content preview

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
$11.70
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
cdfkmgkjnfjn

Also available in package deal

Get to know the seller

Seller avatar
cdfkmgkjnfjn Abacus College, Oxford
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
3 year
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions