0% found this document useful (0 votes)
6 views3 pages

Number Classification and Patterns Guide

java iteration statement programs

Uploaded by

m.agrawal1811
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Number Classification and Patterns Guide

java iteration statement programs

Uploaded by

m.agrawal1811
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Iteration Statement Programs

1. Adam Number is a number whose square of the number and square of it’s reverse are reverse to each other.
Example 1: 12. Here 122 = 144 and 212 = 441. We observe that the square of 12 and the square of it’s reverse
i.e. 21 are reverse of each other. Thus 12 is an Adam Number.

2. Armstrong Number is a number whose sum of the power of digits is equal to the original number where
power is number of digits in the number.
Example 1: 153. 13+53+33 = 1+125+27 = 153.

3. Given a number the task is to find the frequency of all digits present in that number.
Example: Consider a number 256225. Here 2 is present three times, 5 is present two times and 6 is present
one time.

4. Evon Number is a number whose all digits is even digits.


Example 1: 2462 has four digits and four even digits. Hence it is an Evon Number.

5. Given a number the task is to find the maximum digit present in that number.
Example: Consider a number 4612. The program should output maximum digit ‘6’ against this number

6. Neon Number is a number whose sum of digits of it’s square is equal to the original number.
Example 1: 9. 92 = 81. 8+1=9. We observe that the sum of digits of the square of original number is equal to
the original number. Hence it is a Neon Number.

7. Niven Number is a number which is divisible by sum of it’s digits.


Example 1: 18. 1+8 = 9. We observe that 18 is divisible by sum of it’s digits 9. Hence it is a Niven Number.

8. Palindrome Number is a number which is equal to reverse of itself.


Example 1: 131 if reversed is also 131. Hence it is a Palindrome Number.

9. Perfect Number is a number which is equal to sum of it’s proper divisors.


Example 1: 6 has proper divisors 1,2,3. 1+2+3 = 6. Hence it is a Perfect Number.

10. Prime Number is a number which is only divisible by 1 and the number itself i.e., it has no factors other than
1 and itself.
Example 1: 7 is only divisible by 1 and itself only. Hence it is a Prime Number.

11. Pronic Number is a number which is product of two consecutive numbers.


Example 1: 20. 4 x 5 = 20. We observe 4 and 5 are consecutive whose product is 20. hence it is a Pronic
Number.

12. Spy Number is a number whose sum of digits and product of digits are equal.
Example 1: 22. 2+2 = 2*2 = 4. Hence it is a Spy Number.

13. Xylem Number is a number whose sum of extreme (last and first) digits is equal to sum of it’s mean (all other
digits except last and first) digits. Phloem Number is a number which does not hold the above condition.
Example 1: 21201. 2+1 = 1+2+0. We observer sum of extremes and means are equal. Hence it is a Xylem
Number.

14. Given a number the task is to find the difference between sum of even and odd digits of the number.
Example 1: Let us take a number 3471. Here sum of even digits is 4 and sum of odd digits is 11. Hence their
difference is 11-4 = 7.

15. Given a number the task is to reverse or flip the number.


Example 1: Let us take a number 1234. When reversed it is 4321.
16. Abundant Number is a number whose sum of proper factors is greater than the number itself.
Example 1: 18. Sum of proper factors = 1+2+3+6+9 = 21>18. Hence it is an Abundant Number.

17. Automorphic Number is a number whose last digits of square of the number is equal to the original number.
Example 1: 25. 252 = 625. We observe that the last two digits of 625 is 25 which is equal to the original
number. Hence it is an Automorphic Number.

18. Given a Binary value the task is to convert it into Decimal value.
To convert Binary value to Decimal value we multiple each bit from right to left with 2 raised to the power
starting from 0 and increasing towards left and then sum all the values.
Example 1: Consider a Binary value 111001. 1*25+1*24+1*23+0*22+0*21+1*20 = 32+16+8+0+0+1 = 57.

19. Deficient Number is a number whose sum of proper factors is less than the number itself.
Example 1: 15. Sum of proper factors = 1+3+5 = 9<15. Hence it is a Deficient Number.

20. Dudeney Number is a natural number which is a perfect cube and cube root is equal to the sum of its digits.
Example 1: 19683. 273 = 19683. Also 1+9+6+8+3 = 27. Hence it is a Dudeney Number.

21. Given two numbers the task is to find the Greatest Common Factor or Highest Common Factor.
Example: 36 and 60 have a GCD of 12 since it is the only maximum number by which 36 and 60 both are
divisible.

22. Happy Number is a number whose eventual sum of square of it’s digits is equal to 1.
Example 1: 19. 12+92 = 82. 82+22 = 68. 62+82 = 100. 12+02+02 = 1. Hence it is a Happy Number.

23. Lead Number is a number whose sum of even digits is equal to the sum of odd digits.
Example 1: 143. Sum of even digits = 4 = 1+3 = Sum of odd digits. Hence it is a Lead Number.

24. Given two numbers the task is to find the Least Common Multiple or Lowest Common Multiple.
Example: 6 and 15 have LCM of 30.
Here instead of Prime Factorization method we first calculate the GCD of 6 and 15 and then use formula LCM
= (x*y)÷GCD. Where ‘x’ and ‘y’ are two numbers.

25. Magic Number is a number whose eventual sum of digits is equal to 1.


Example 1: 19. 1+9 = 10. 1+0 = 1. Hence it is a Magic Number.

26. Peterson Number is a number whose sum of factorial to it’s digits are equal to the original number.
Example 1: 145. 1!+4!+5! = 1+24+120 = 145. Hence it is a Peterson Number.

27. Prime Palindrome Number is a number which is a Prime Number as well as Palindrome Number.
Example 1: 131 if reversed is also 131. Also it is a Prime Number. Hence it is a Prime Palindrome Number.

28. Sunny Number is a number whose succeeding number is a perfect square.


Example 1: 15. Succeeding number is 16. 16 = 42 is a perfect square. Hence it is a Sunny Number.

29. Tech Number is an even digit number which when divided into two equal parts and then square of the sum
of those two parts are equal to the original number.
Example 1: 2025. 20+25 = 45. 452 = 2025. Hence it is a Tech Number.

30. Twin Prime Numbers are numbers who have a difference of two and both of the numbers are Prime
Numbers.
Example 1: 3 and 5. 5-3 = 2. Also 3 and 5 both are Prime Numbers. Hence they are Twin Prime Numbers.

31. Twisted Prime Number is a number which itself is a Prime Number and it’s reverse is also a Prime Number.
Example 1: 13. When reversed it is 31. Both of them are Prime Number. Hence it is a Twisted Prime Number.
32. Write a program to print below pattern using nested loop.

33. Write a program to print sum of the series S = (1/a) + (2/a2) + (3/a3) + ....... to n terms.
34. Write a program to print sum of the series S = a2 + a2 / 2 + a2 / 3 + ...... + a2 / 10.
35. Write a program to print sum of the series S = x/2 + x/5 + x/8 + x/11 + ...... + x/20.
36. Write a program to print sum of the series S = 1 + (1*2) + (1*2*3) + ....... + (1*2*3* ....... * n)
37. Write a program to print sum of the series S = 1 + (1+2) + (1+2+3) + ....... + (1+2+3+ ....... + n)
38. Write a program to print the series: 1, 12, 123, 1234,...
39. Write a program to print Fibonacci series.
40. Write a program to find and display the sum of the series given below:
S = x1 - x2 + x3 - x4 + x5 - ………… - x20; where x = 2

You might also like