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
- Find minimum number to be divided to make a number a perfect square
- Count number of triplets with product equal to given number with duplicates allowed
- Number of ways to split a binary number such that every part is divisible by 2
- 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
- Find the number of positive integers less than or equal to N that have an odd number of digits
- Given number of matches played, find number of teams in tournament
- Count number of ways to divide a number in 4 parts
- Number of digits to be removed to make a number divisible by 3
- Check if a number is divisible by all prime divisors of another number
- Program to Convert Octal Number to Binary Number
- Querying maximum number of divisors that a number in a given range has
- Find the number of ways to divide number into four parts such that a = c and b = d
- Find the total number of composite factor for a given number
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.