🔢

Dudeney Number Demystified (With Simple Java Code)- For Beginners

INTRODUCTION

A Dudeney number is a positive integer for which the sum of its digits is equal to the the cube root of the number itself. The name derives from Henry Dudeney, who noted the existence of these numbers in one of his puzzles, Root Extraction, where a professor in retirement at Colney Hatch postulated this as a general method for root extraction.

For example:

512=(5+1+2)3=83512 = (5+1+2)^3 = 8^3
119683=(1+9+6+8+3)3=2739683= (1+9+6+8+3)^3 = 27^3

⚱️
Fun Fact: 0 and 1 are Trivial Dudeney numbers and all other Dudeney numbers are Nontrivial Dudeney numbers.

For in-depth Mathematical information regarding the nature of the Dudeney Number -

Dudeney number - Wikipedia
In number theory, a Dudeney number in a given number base is a natural number equal to the perfect cube of another natural number such that the digit sum of the first natural number is equal to the second.
https://en.wikipedia.org/wiki/Dudeney_number#Mathematical_definition


JAVA CODE

public class Dudeney
{
public static void main(int n)
{
int x = n;                        //Creating a copy of the number
int sum = 0;                     //Variable to calculate sum of digits
while(n != 0)
{
int a = n % 10;                //Extracting the Digit
sum = sum + a;                 //Calculating the sum of Digits
n = n/10;                      //Reducing the number of Digit by 1 (removing the units Digit)
}
if(x == (sum * sum * sum))                     //Condition for a Dudeney Number
System.out.println("Yes; A Dudeney Number");
else
System.out.println("Not a Dudeney Number");
}
}


LIST OF DUDENEY NUMBERS

👩🏼‍🎓
Fun Fact: There are only 6 Dudeney numbers. You might not find the validity of this statement.

If interested in knowing the proof of the statement by using techniques like Bounding From Above, Limiting The Search Space, and Brute Forcing The Remaining Possibilities ⬇️

Proving There are Only Six Dudeney Numbers
I came across an article in Wikipedia about Dudeney numbers.
http://blog.hostilefork.com/six-dudeney-numbers-proof/

If you would like to read more blogs written by me, SIGN UP here ⬇️ 📩

Mehul Rastogi - Contact
https://www.mehulrastogi.com/contact/