1. Greek mathematicians took a special interest in numbers that are equal to the sum of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Greek mathematicians took a special interest in numbers that are equal to the sum of their proper divisors (a proper divisor of n is any divisor less than n itself). They called such numbers perfect numbers. For example, 6 is a perfect number because it is the sum of 1, 2, and 3, which are the integers less than 6 that divide evenly into 6. Similarly, 28 is a perfect number because it is the sum of 1, 2, 4, 7, and 14. Write a function sum_divisors that takes an integer n and returns the sum of all the proper divisors of that number (here you will want to use the remainder operator, %). Use this function in writing a program to check for perfect numbers in the range 1 to 9999 by testing each number in turn. When a perfect number is found, your program should display it on the screen. The first two lines of output should be 6 and 28. Your program should find two other perfect numbers in the range as well. 2. Write a program to check if the given number is a palindrome number. A palindrome number is a number that is same after reverse. For example 545, is a palindrome number. Two sample outputs would be: Enter a positive integer, 0 to exit: 121 Yes. given number is palindrome number Enter a positive integer, 0 to exit: 125 No. given number is not palindrome number 1. Greek mathematicians took a special interest in numbers that are equal to the sum of their proper divisors (a proper divisor of n is any divisor less than n itself). They called such numbers perfect numbers. For example, 6 is a perfect number because it is the sum of 1, 2, and 3, which are the integers less than 6 that divide evenly into 6. Similarly, 28 is a perfect number because it is the sum of 1, 2, 4, 7, and 14. Write a function sum_divisors that takes an integer n and returns the sum of all the proper divisors of that number (here you will want to use the remainder operator, %). Use this function in writing a program to check for perfect numbers in the range 1 to 9999 by testing each number in turn. When a perfect number is found, your program should display it on the screen. The first two lines of output should be 6 and 28. Your program should find two other perfect numbers in the range as well. 2. Write a program to check if the given number is a palindrome number. A palindrome number is a number that is same after reverse. For example 545, is a palindrome number. Two sample outputs would be: Enter a positive integer, 0 to exit: 121 Yes. given number is palindrome number Enter a positive integer, 0 to exit: 125 No. given number is not palindrome number
Expert Answer:
Answer rating: 100% (QA)
1 Perfect Numbers Python def sumdivisorsn Returns the sum of all proper divisors of a number divisor... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Abundant numbers are positive integers (greater than 0), that are less than the sum of their proper divisors. A proper divisor is a positive integer into which that number can be divided with no...
-
Need help in this homework In this problem, you will learn how to perform an impressivemagic trick. As all tricks, once you understand it, it becomes lessimpressive. But then you can impress other...
-
Match the following ratios with the appropriate formula. Ratio or Rate Formula a. Income from operations Interest expense Acid-test Total liabilities Stockholders' equity Current b. Net income-...
-
Performance-based logistics. Refer to the Journal of Business Logistics (Vol. 36, 2015) study of the factors that lead to successful performance-based logistics (PBL) projects , Exercise 1.15 (p....
-
Suppose you had to invest all of your money in just one of these stocks (excluding Intel). Which one seems most attractive and why? Which stock seems least attractive?
-
Social Jetlag Social jetlag refers to the difference between circadian and social clocks, and is measured as the difference in sleep and wake times between work days and free days. For example, if...
-
A more intensive, and extensive, monitoring system is needed in project management than in a functional organization. Why?
-
The wholesale price for a chair is 1 0 3 . A certain furniture store and mark up the wholesale price by 1 7 % . Find the price of the chair in the furniture store. Round your answer to the nearest...
-
Using Lemon Spa & Herbal Products financial statements below, you are to identify Pro Forma Statements of Year 20x4E. Assumptions for Pro Forma are as follows: A company will grow by 30.00% in...
-
Garner Stores, Inc. is a multiple-store chain retailer of women's clothing. You are provided with the following budgeted income statement for the coming year. GARNER STORES, INC. Budgeted Income...
-
Can policymakers exploit the Phillips curve relationship by trading more inflation for less unemployment in the short run? In the long run? Explain both the classical and Keynesian points of view.
-
What are the two components of a theory of business cycles?
-
Why does the Federal Reserve work hard to establish its credibility? What benefits might the public gain if the Federal Reserve has a great deal of credibility?
-
What is the Phillips curve? Does the Phillips curve relationship hold for U.S. data? Explain.
-
Why is the real exchange rate important in macroeconomic analysis? How does it affect net exports? Explain and give an example.
-
If 3 men with 4 boys can earn Rs. 2100 in 7 days, and 11 men with 13 boys can earn Rs. 8300 in 8 days, in what time will 7 men with 9 boys earn Rs. 11000? 1. 8 days 2. 12 days 3. 16 days 4. 18 Days...
-
Explain the buyers position in a typical negotiation for a business. Explain the sellers position. What tips would you offer a buyer about to begin negotiating the purchase of a business?
-
For each of the following cases, indicate the filing status for the taxpayer(s) for 2012 using the following legend: A - Single B - Married, filing a joint return C - Married, filing separate returns...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1 and 2. On September 1, Irene opened a retail store that specializes in sports car...
-
In 2012, Lou has a salary of $54,000 from her job. She also has interest income of $1,700. Lou is single and has no dependents. During the year, Lou sold silver coins held as an investment for a...
-
A probability experiment consists of rolling a single fair die. (a) Identify the outcomes of the probability experiment. (b) Determine the sample space. (c) Define the event E = roll an even number....
-
Sophia has three tickets to a concert, but Yolanda, Michael, Kevin, and Marissa all want to go to the concert with her. To be fair, Sophia randomly selects the two people who can go with her. (a)...
-
A pair of fair dice is rolled. Fair die are die where each outcome is equally likely. (a) Compute the probability of rolling a seven. (b) Compute the probability of rolling snake eyes; that is,...
Study smarter with the SolutionInn App