Tuesday , December 6 2016
Home / Blue J / Java program to print happy numbers for a given range

Java program to print happy numbers for a given range

This is a Java program to print happy numbers for a given range. But what is a happy number?

A number whose sum of the square of digits is ultimatly equal to 1 is a happy number. By ultimately we mean that starting with any positive number we continue the addition of square of digits till we get a single digit number (0 ~ 9). But the on whose sum is ultimately 1 is a happy number.

Example #1: 13 ; 12 + 32 = 1 + 9 =10 ; 1 2 + 0 2 = 1 (Thus a happy number)
Example #2: 32; 3 2 + 2 2 = 9 + 4 = 13; and in Example#1 13 is already a happy number;
Some of the first happy numbers (upto 150) are: 1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97, 100, 103, 109, 129, 130.

ALSO CHECK : Java program to check for a happy number

OUTPUT:

Java program to print happy number series
Java program to print happy number series

Incoming terms: Java program to print happy numbers for a given range, program for happy number series

Also See:   Basic concepts of Java

Check Also

Program for Matrix Multiplication in JAVA

Matrix Multiplication:– Here is given a Java Program for Matrix Multiplication also call matrix product. In ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.