{"id":16650,"date":"2021-08-12T09:25:13","date_gmt":"2021-08-12T03:55:13","guid":{"rendered":"https:\/\/python-programs.com\/?p=16650"},"modified":"2021-11-22T18:38:32","modified_gmt":"2021-11-22T13:08:32","slug":"python-program-to-get-sum-of-all-the-factors-of-a-number","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-get-sum-of-all-the-factors-of-a-number\/","title":{"rendered":"Python Program to Get Sum of all the Factors of a Number"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Find Product of Values of elements in a Dictionary<\/a>
\nGiven a number, and the task is to get the sum of all the factors of a given number.<\/p>\n

Factors are numbers or algebraic expressions that divide another number by themselves and leave no remainder.<\/p>\n

Example: let the given number = 24<\/p>\n

# The factors of 24 are : 1, 2, 3, 4, 6, 8, 12, 24<\/p>\n

The sum of all the factors of 24 = 1+2+ 3+4+6+ 8+12+24 = 60<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 24<\/pre>\n

Output:<\/strong><\/p>\n

The Sum of all the factors of { 24 } is =  60<\/pre>\n

Example 2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 140<\/pre>\n

Output:<\/strong><\/p>\n

The Sum of all the factors of { 140 } is =  336<\/pre>\n

Program to Get Sum of all the Factors of a Number<\/h2>\n

Below are the ways to get the sum of all the factors of a given number.<\/p>\n