A number is perfect if is equal to the sum of its proper divisors i.e. the sum of its positive divisors excluding the number itself.
Input: L1 = 3 -> 6 -> 9
Proper divisor sum of 3 = 1
Proper divisor sum of 6 = 1 + 2 + 3 = 6
Proper divisor sum of 9 = 1 + 3 = 4
Input: L1 = 17 -> 6 -> 10 -> 6 -> 4
Approach: Initialise sum = 0 and for every node of the list, find the sum of its proper divisors say sumFactors. If cur_node = sumFactors then update the resultant sum as sum = sum + cur_node. Print the sum in the end.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Sum of all perfect numbers present in an array
- Sum of all Palindrome Numbers present in a Linked list
- Sum of distances between the two nearest perfect squares to all the nodes of the given linked list
- Count numbers upto N which are both perfect square and perfect cube
- Check if a number is a perfect square having all its digits as a perfect square
- Sum of all palindrome numbers present in an Array
- Sum of all mersenne numbers present in an array
- Sum of all the numbers present at given level in Pascal's triangle
- Sum of all the numbers present at given level in Modified Pascal’s triangle
- Check if elements of Linked List are present in pair
- Sum of all Perfect numbers lying in the range [L, R]
- Sum of all perfect square divisors of numbers from 1 to N
- Find smallest perfect square number A such that N + A is also a perfect square number
- XOR Linked List - A Memory Efficient Doubly Linked List | Set 1
- XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
- Merge a linked list into another linked list at alternate positions
- Check if a linked list is Circular Linked List
- Convert singly linked list into circular linked list
- Difference between Singly linked list and Doubly linked list
- Convert Singly Linked List to XOR Linked List
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.