Opening Hours :7AM to 9PM
import java.math.BigInteger; class KeithNumber { // utility function to compute the factorial of a number public BigInteger factorial(int n) { BigInteger f = BigInteger.ONE; for (int i = 2; i <= n; i++) { f = f.multiply(BigInteger.valueOf(i)); } return f; } } public class Main { public static void main(String[] args) { KeithNumber kn=new KeithNumber(); int n = 145; // number to be checked // compute the factorials of the digits of n BigInteger sum = BigInteger.ZERO; for (char c : String.valueOf(n).toCharArray()) { int d = Character.getNumericValue(c); BigInteger f = kn.factorial(d); sum = sum.add(f); } // check if n is equal to the sum of its factorial digits if (n == sum.intValue()) { System.out.println(n + " is a Keith number."); } else { System.out.println(n + " is not a Keith number."); } } }The program outputs "145 is a Keith number." because 145 is indeed a Keith number (1! + 4! + 5! = 145).