Coders Packet

Check given number for Dasrium Number, Smith Numbers, Harshad Numbers using Java.

By Supriya Bauddh

In this Java tutorial, we are going to check for various types of numbers in Java like Dasrium Number, Smith Numbers, Harshad Numbers, etc.

There are various types of numbers like Smith, Harshad, etc.

The following are the numbers that I have added to my project -

 

  1. Dasrium Number -

A Disarium number is a number defined by the following process: Sum of its

digits powered with their respective position is equal to the original number.

Some other DISARIUM are 89, 175, 518, etc.

 

  1. Harshad Number -

A Harshad number (or Niven number) in a given number base is an integer that is divisible by the sum of its digits when written in that base.

Example - 12 where 1 + 2 = 3 and 12 is divisible by 3.

 

  1. Perfect Cube -

A perfect cube is a number that is equal to the number, multiplied by itself, three times. If x is a perfect cube of y, then x = y3. Therefore, if we take out the cube root of a perfect cube, we get a natural number and not a fraction. Hence, 3√x = y. For example, 8 is a perfect cube because 3√8 = 2.

 

  1. Smith Number -

A Smith number is a composite number, the sum of whose digits equals the sum of the digits of all its prime factors. The smallest Smith number is 4 = 2×2. The sum of the digits of 4 is 4, and The sum of digits of its prime factors is 2 + 2 = 4.

 

  1. Combination Consecutive Number -

The number can be represented by the sum of some consecutive digits.

Example - 6 = 1 + 2 + 3 or 11 = 5 + 6

 

IMPLEMENTATION -

 

In this, the program takes multiple parameters as inputs and performs the operations on them.

 

Following are the functionalities of the project -

  1. Dasrium Number
  2. Harshad Number
  3. Perfect Cube
  4. Smith Number
  5. Combination Consecutive Number

 

To build this program switch case and while loop is used.

Download project

Reviews Report

Submitted by Supriya Bauddh (SupriyaBauddh)

Download packets of source code on Coders Packet