Disarium Number In Java

Exploring Disarium Numbers: A Special Numerical Phenomenon

If you've ever delved into the fascinating world of number theory, you might have come across the term "Disarium number." In this blog, we unravel the mystery behind Disarium numbers, explore their unique properties, and provide a Java program to identify these intriguing numerical phenomena.

Understanding Disarium Numbers

A Disarium number (also known as an "n-digit Disarium number") is a number that is equal to the sum of its digits each raised to the power of its respective position. Mathematically, a number "n" is a Disarium number if it satisfies the following equation:

Disarium Equation
n = d11 + d22 + d33 + ... + dkk

- "n" is the number itself.
- "di" represents the digits of the number (e.g., d1, d2, d3, ...).
- "k" is the number of digits in the number.

For example, let's take the number 89:

Example: 89 is a Disarium Number
81 + 92 = 8 + 81 = 89

As shown, 89 is a Disarium number because the sum of its digits, each raised to the power of its position, equals the number itself.

Identifying Disarium Numbers in Java

Now, let's create a Java program to identify Disarium numbers within a given range. We'll define a function that checks each number in the range and determines if it meets the Disarium criteria:
import java.util.ArrayList;
import java.util.List;

public class DisariumNumbers {
    public static void main(String[] args) {
        int startRange = 1;
        int endRange = 10000;

        List<Integer> disariumNumbers = findDisariumNumbers(startRange, endRange);

        System.out.println("Disarium numbers between " + startRange + " and " + endRange + ":");
        for (int num : disariumNumbers) {
            System.out.print(num + " ");

    public static List<Integer> findDisariumNumbers(int start, int end) {
        List<Integer> disariumNumbers = new ArrayList<>();

        for (int num = start; num <= end; num++) {
            if (isDisarium(num)) {

        return disariumNumbers;

    public static boolean isDisarium(int num) {
        int sum = 0;
        int originalNum = num;
        int numDigits = (int) Math.log10(num) + 1;

        while (num > 0) {
            int digit = num % 10;
            sum += Math.pow(digit, numDigits);
            num /= 10;

        return sum == originalNum;

This Java program defines a function "isDisarium" that checks if a given number is a Disarium number by calculating the sum of its digits raised to their respective positions. The "findDisariumNumbers" function finds Disarium numbers within a specified range.


Disarium numbers are a captivating mathematical phenomenon that offers a unique perspective on numerical patterns. They provide an exciting avenue for exploration in the world of number theory and can be identified using simple programming techniques, as demonstrated in our Java program. By understanding and identifying Disarium numbers, you gain insight into the intriguing relationships between digits and their positions in numerical sequences.