Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSE294A Assignment #4: Prime Factors and Largest Prime Number of Composite Numbers, Assignments of Engineering

The requirements for assignment #4 in cse294a, where students are tasked with building on their previous assignment to determine prime factors and the largest prime number that divides a composite number evenly. Students must display these results, along with the largest integer factor set, and implement these tasks within separate functions.

Typology: Assignments

2009/2010

Uploaded on 03/28/2010

koofers-user-pcg
koofers-user-pcg 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE294A Assignment #4
Professor Miller
1/1
CSE294A Assignment #4
1.5% of course grade
Thisassignmentisgoingtogiveyouexperienceusingfunctionsandaddingsomelogicto
yourpreviousprogram.
Forthisproject,youwillbuildonyourAssignment#3,whichwastodeterminewhether
anumberwasprimeorcomposite.InAssignment#3,youalsoprintedoutthelargest
numberthatdividedacompositenumberevenly.Forthisassignment,youwilldisplay
someadditionalinformationforcompositenumberstotheuser.
Firstofall,youneedtodisplaynotonlythelargestintegerthatdividesacomposite
numberevenly,butyoualsoneedtodisplaythelargestprimenumberthatdividesthe
compositenumberevenly.
Second,youwilldisplaythesetofprimefactorsforacompositevalue.Everynumber
canbewrittenastheproductofaseriesofprimenumbers.Yourtaskhereistodisplay
thesetofprimenumbersthatcanbemultipliedtogethertoequalthecompositevalue
enteredbytheuser.
Third,therearemanysetsofvaluesthatwillmultiplytoequalacompositenumber.
Youwilldisplayoneofthesetsthatcontainthelargestintegerlessthanthecomposite
number.
AlloftherequirementsfromAssignment#3stillmustbemetforthisassignment.In
addition,eachofthethreetasksthatyouhaveinthisassignmentmustbecontained
withinseparatefunctions.Thatmeansthatyoumusthaveatleastthreeadditional
functionsinthisprogram.Ifyouwouldliketoaddmore,feelfree.
Notealsothatyoumustmakeyouroutputlookexactlythesameasmine.Imaginethis
isadocumentfromajob,andyoumustimplementtherequirementsexactlyas
documented.
Herearesomeexamples.
Please enter a positive integer: 10
COMPOSITE
Largest number that divides 10 evenly is 5
Largest prime number that divides 10 evenly is 5
Prime factors = 2 * 5
Largest integer factor set = 2 * 5
Please enter a positive integer: 7
PRIME
pf2

Partial preview of the text

Download CSE294A Assignment #4: Prime Factors and Largest Prime Number of Composite Numbers and more Assignments Engineering in PDF only on Docsity!

CSE294A Assignment # Professor Miller 1/

CSE294A Assignment # 1.5% of course grade

This assignment is going to give you experience using functions and adding some logic to your previous program.

For this project, you will build on your Assignment #3, which was to determine whether a number was prime or composite. In Assignment #3, you also printed out the largest

number that divided a composite number evenly. For this assignment, you will display

some additional information for composite numbers to the user.

First of all, you need to display not only the largest integer that divides a composite

number evenly, but you also need to display the largest prime number that divides the composite number evenly.

Second, you will display the set of prime factors for a composite value. Every number can be written as the product of a series of prime numbers. Your task here is to display

the set of prime numbers that can be multiplied together to equal the composite value

entered by the user.

Third, there are many sets of values that will multiply to equal a composite number. You will display one of the sets that contain the largest integer less than the composite

number.

All of the requirements from Assignment #3 still must be met for this assignment. In

addition, each of the three tasks that you have in this assignment must be contained

within separate functions. That means that you must have at least three additional functions in this program. If you would like to add more, feel free.

Note also that you must make your output look exactly the same as mine. Imagine this is a document from a job, and you must implement the requirements exactly as

documented.

Here are some examples.

Please enter a positive integer: 10 COMPOSITE Largest number that divides 10 evenly is 5 Largest prime number that divides 10 evenly is 5 Prime factors = 2 * 5 Largest integer factor set = 2 * 5

Please enter a positive integer: 7 PRIME

CSE294A Assignment # Professor Miller 2/

Please enter a positive integer: a a is not a positive integer.

Please enter a positive integer: 93 COMPOSITE Largest number that divides 93 evenly is 31 Largest prime number that divides 10 evenly is 31 Prime factors = 3 * 31 Largest integer factor set = 3 * 31

Please enter a positive integer: 101 PRIME

Please enter a positive integer: 90 COMPOSITE Largest number that divides 90 evenly is 45 Largest prime number that divides 90 evenly is 5 Prime factors = 2 * 3 * 3 * 5 Largest integer factor set = 2 * 45

Please enter a positive integer: q Thank you for using my program.

Grading Criteria 0.3% displaying largest prime number that divides composite value evenly 0.3% displaying prime factors of a composite value 0.3% displaying largest integer factor set of a composite value 0.6% using at least three additional functions