Given an integer n, the task is to check if n is a Dudeney number or not. A Dudeney number is a positive integer that is a perfect cube such that the sum of its decimal digits is equal to the cube root of the number.
Input: N = 19683
19683 = 273 and 1 + 9 + 6 + 8 + 3 = 27
Input: N = 75742
- Check if n is a perfect cube, if not then it cannot be a Dudeney number.
- If n is a perfect cube then calculate the sum of its digits. If the sum of it’s digits is equal to its cube root then it is a Dudeney number else it is not.
Below is the implementation of the above approach:
- Permutation of numbers such that sum of two consecutive numbers is a perfect square
- Print N lines of 4 numbers such that every pair among 4 numbers has a GCD K
- Numbers less than N which are product of exactly two distinct prime numbers
- Numbers within a range that can be expressed as power of two numbers
- Rearrange numbers in an array such that no two adjacent numbers are same
- Count numbers which can be constructed using two numbers
- Maximum sum of distinct numbers such that LCM of these numbers is N
- Count numbers which are divisible by all the numbers from 2 to 10
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
- Add two numbers using ++ and/or --
- Sum of first n even numbers
- Sum of cubes of first n even numbers
- Decagonal 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 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.