Given a number n, We need to check whether n is aspiring number or not. The number n is called an aspiring number if its aliquot sequence< terminates in a perfect number, and it is not a perfect number itself. First few aspiring numbers are : 25, 95, 119, 143, 417, 445, 565, 608, 650, 652….
Input : 25 Output : Yes. Explanation : Terminating number of aliquot sequence of 25 is 6 which is perfect number. Input : 24 Output : No. Explanation : Terminating number of aliquot sequence of 24 is 0 which is not a perfect number.
Approach : First we find the terminating number of aliquot sequence of given input and then check if it is perfect number or not (as per definition). Given below is implementation for checking aspiring number.
Time Complexity: O(n)
- Count number of trailing zeros in Binary representation of a number using Bitset
- Count number of triplets with product equal to given number with duplicates allowed
- Find minimum number to be divided to make a number a perfect square
- Given number of matches played, find number of teams in tournament
- Number of times the largest perfect square number can be subtracted from N
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Super Ugly Number (Number whose prime factors are in given set)
- Minimum number of given powers of 2 required to represent a number
- Program to calculate the number of odd days in given number of years
- Find the number of jumps to reach X in the number line from zero
- Queries on sum of odd number digit sums of all the factors of a number
- Count the number of operations required to reduce the given number
- Find the number of ways to divide number into four parts such that a = c and b = d
- Build Lowest Number by Removing n digits from a given number
- Count number of ways to divide a number in 4 parts
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.