- 1 Greek Mathematicians Took A Special Interest In Numbers That Are Equal To The Sum Of Their Proper Divisors A Prope 1 (220.48 KiB) Viewed 102 times
> 1. Greek mathematicians took a special interest in numbers that are equal to the sum of their proper divisors (a prope
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
> 1. Greek mathematicians took a special interest in numbers that are equal to the sum of their proper divisors (a prope
> 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 given number is not palindrome number No.