1.
public static boolean sumoffactor(int n)
{
// Check sumoffactor
}
b. public static void perfect(int n) // 6 sum of factor is equal to input
c. public static void abundant() // n= 12 sum of factor is more than input
d. public static void deficient (int n) s // sum of factor is less than to input
2. public static int sumoffactor(int n)
{
// Check sum of factor
}
3. Public static void amicablepairs (int n ) // print the amicable pair 220, 284
4. public static boolean isprime(int n)
{
// Check prime
}
5. public static void twinprime (int n) // 3 , 5 , 11, 13 are N, n+2 is a prime number
6. Public static void coprime(int n): 13 : prime 31 is also prime
7. Public static void primepalindrome (int n) // 11
8. public static void isprime(int n)
{
// Check prime
}
9. public static int reverse( int n)
{
// reverse
}
10. public static void palindrome ( int n)
{
// palindrome
}
11. public static int sumofcubes( int n)
{
// sum of cubes
}
12. public static void armstrong( int n) // 370, 153, 371 …
{
// sum of cubes equal to input
}
13. public static int factorial( int n)
{
// product of natural numbers
}
14. public static void factorial( int n)
{
// product of natural numbers
}
15. public static void productofnaturalnumbers( int n)
{
// product of natural numbers
}
16. public static void strong( int n)
{
// sum of factorial (145 = (1+ (1x2x3x4)+ (1x2x3x4x5 ) = 145 )
}
17. public static int square(int n) {
:Returns sum of square of digits of a number. Eg.81=82+12=65.
18. public static boolean ishappy(int n) // 10, 100, 1000 ,,, sum of square is equal to 1
{ : A happy number is a number in which the eventual sum of square of digits of the number is equal to 1. }
19. public static int countofdigit(int n)
20. public static int sumofdigit (int n)
21. public static void sumofdigit (int n)
[Link] static void magic (int n) // 127 - sod(1+2+7)= 10 (sod(1+0))= 1 ..
23. public static void automorphic (int n) { n = 25 = square = 625 input on the right or second half after square }
24. public static void trimorphic (int n) { n = 49 = cube= 1,17,649 input on the right or second half after cube}
25. public static void kaprekar (int n)
{
Examples are 9 (92 = 81 , 8 + 1 = 9) ,45 (45 2
=2025, 20 + 25 =45)
}
26. Public static void techno(int n){
// n = 3025 split into two equal half , sum the two halves and square the number it is equal to input
}
27. Public static void unique (int n)// no duplicate
[Link] static void characterfrequency( int n) // each digit appears how many times
29. Public static void wordfrequency (String sentence)
[Link] static void charactersort ( String s)// sort characters in your names without array
[Link] static void numbersort( int n)// sort digits in your input without array
[Link] static void fibonoccciseries () // 0, 1, 1, 2, 3, 5, 8, 13, 21
[Link] static void tribonicseries () // 0, 1, 1, 2, 4, 7, 13
[Link] static void lucasseries() //. 2, 1, 3, 4, 7, 11, 18, 29
[Link] static void neonnumber () // n = 9 --> square the number----> 81 ---> sum of digit it is equal to the input
[Link] static void ducknumber( int n) // no zero’s in the input
[Link] static void discarisum (int n) // 135 = sum of digit is raised to the power of respective position to
{
11+ 32+ 53 = 135
}
[Link] static void niven (int n ):n the given number is divisible by sum of digit // n= 24, 21
[Link] static void specialnumber( int n) // sum of digit + product of digit == input n= 29,39,49
[Link] static void spynumber( int n)// n = 1124 sum of digit = product of digit
41. public static void Adam number : The square of a number and the square of its reverse are reverse to each other.
Example: If n = 13 and reverse of ‘n’ = 31, then, (13)2 = 169 (31)2 = 961 which is reverse of 169 thus 13, is an Adam
number.
42. public static void swap the two values (a, b) without using third variable
43. public static void evil number (n)// is that has an even number of 1's in its binary equivalent
44. public static void highestcommonfactor (int a, int b)
44. public static void leastcommonfactor (int a, int b)
45. public static void cyclonenumber (int n) // add the first and the last digit is same
46. public static void Munchhausennumber(int n) // 3435 = 33 + 44 + 33 + 55
47. public static void ISBNnumber ( int n ) // The International Standard Book Number (ISBN) is a unique numeric book
identifier which is printed on every book. The ISBN is based upon a 10-digit code.
The ISBN is legal if:
1 × digit1 + 2 × digit2 + 3 × digit3 + 4 × digit4 + 5 × digit5 + 6 × digit6 + 7 × digit7 + 8 × digit8 + 9 × digit9 + 10 × digit10 is
divisible by 11.
Example:
For an ISBN 1401601499
Sum = 1 × 1 + 2 × 4 + 3 × 0 + 4 × 1 + 5 × 6 + 6 × 0 + 7 × 1 + 8 × 4 + 9 × 9 + 10 × 9 = 253 which is divisible by 11.
48. public static void Zuckerman Numbers (int n ) // divisible by the product of its digits n= 115
49. public static void keithnumber (int n) Input : x = 197
Output : Yes
197 has 3 digits, so n = 3 special sequence that has first three terms as 1, 9, 7 and
remaining terms evaluated using sum of previous 3 terms.
1, 9, 7, 17, 33, 57, 107, 197, ....
50. public static void vampirenumber( int n) // eg 1260, 1435 split into two have the first half is reversed to product with
second half.
51