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 triplets with product equal to given number with duplicates allowed
- Find minimum number to be divided to make a number a perfect square
- Count number of trailing zeros in Binary representation of a number using Bitset
- Given number of matches played, find number of teams in tournament
- Number of times the largest perfect square number can be subtracted from N
- Find maximum number that can be formed using digits of a given number
- Count the number of operations required to reduce the given number
- Find the number of jumps to reach X in the number line from zero
- Find the number of integers x in range (1,N) for which x and x+1 have same number of divisors
- Count number of digits after decimal on dividing a number
- Program to Convert Octal Number to Binary Number
- Querying maximum number of divisors that a number in a given range has
- Count number of ways to divide a number in 4 parts
- Super Ugly Number (Number whose prime factors are in given set)
- Represent a number as a sum of maximum possible number of Prime Numbers
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.