This is a Java program for Magic number. However before starting let me tell you what is a magic number. A Magic number is a number whose sum of digits eventually leads to 1. Example#1: 19 ; 1+9 =10 ; 1+0 = 1. Hence a magic number. Example#2: 226; 2+2+6=10; 1+0 =1. Hence a magic number. Example#3: 874; 8+7+4=19; 1+9=10; 1+0=1. ...

Read More »## Java Program to find Mobius Function of number

Mobius Function Java Program: The MOBIUS function µ(n) for a natural number N is defined as follows: µ(n) = 1 if n is a square free positive integer with an even number of prime factors. µ(n) = 0 if n has a squared prime factor. µ(n) = -1 if n is a square free positive integer with an odd number of ...

Read More »## Program for Matrix Multiplication in JAVA

Matrix Multiplication:– Here is given a Java Program for Matrix Multiplication also call matrix product. In other words, Let the two matrix to be multiplied be A and B. Let A is an n × m order matrix and B is an m × p order matrix, their matrix product A*B is an n × p order matrix, in which the m ...

Read More »## JAVA program to check Anagram of a Words

Program in Java to Check if the word is a anagram of a given word: An anagram is a type of word play, the result of rearranging the letters of a word to produce a new word or we can say the possible string we make by rearranging the letter of word. Example: Anagram of the word ‘ABC’ are : ABC, ...

Read More »## Binary Search Program in Java

Binary search Program with Example:- A binary search locates an item in a sorted array by repeatedly dividing the search interval in half. Initially interval include the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise narrow it to the upper ...

Read More »## Ugly Numbers Algorithm – C and Java Program

C Program / Algorithm for Ugly Numbers: What is an Ugly Number Series? Ugly Numbers are the ones whose prime factors are 2,3 or 5 Only. We have also given a Java Source code in Method #4 So Ugly Number Series is 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, and so on… The reason why 1 is added is because ...

Read More »## Java program to print the magic number series

This is a Java program to print the Magic number series. However before starting let me tell you what is a magic number. A Magic number is a number whose sum of digits eventually leads to 1. Example#1: 19 ; 1+9 =10 ; 1+0 = 1. Hence a magic number. Example#2: 224; 2+2+4=10; 1+0 =1. Hence a magic number. Example#3: 874; ...

Read More »## 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 ...

Read More »## Java program to check for a happy number

This is a java program for happy number but before that 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 ...

Read More »## Java Program to check for a Kaprekar number

Here is given java program to check for a Kaprekar number. But before what exactly is a Kaprekar number and why it is called a kaprekar number? A Kaprekar number is a number whose square can be broken/partitioned in such a manner that the sum of the partitions adds up to bring the number itself. Example: 992 = 9801 : 98+01 ...

Read More »