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) = 83

19683= (1+9+6+8+3)3 = 273

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, please- Click Here.


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 of Dudeney Number
System.out.println (“Yes; A Dudeney Number”);
else
System.out.println (“Not a Dudeney Number”);
}
}


LIST OF DUDENEY NUMBERS

0
1
512
4913
5832
17576
19683


FUN FACT

There are only 6 Dudeney numbers. You might not find the validity of this statement. If interested to know the proof of the statement by using techniques like Bounding From Above, Limiting The Search Space, and Brute Force The Remaining Possibilities, please- Click Here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

Create your website with WordPress.com
Get started
%d bloggers like this: