Logical numbers
Following are logical numbers, which each and every programmer learned in academic, these are important numbers lets recap them all.
Armstrong number:
An Armstrong number is a number which is equal to the sum of digits raise to the power total number of digits in the number.
Some Armstrong numbers are: 0, 1, 2, 3, 153, 370, 407, 1634 etc.
i.e. 153 = 1³+5³+3³
Program:
Palindrome number:
A palindrome number is a number that is same after reverse.
i.e. 121, 48984
Program:
Fibonacci series:
The Fibonacci sequence is a series where the next term is the sum of pervious two terms. The first two terms of the Fibonacci sequence is 0 followed by 1.
Program:
Factorial number:
Factorial of n is the product of all positive descending integers.
The factorial of a negative number doesn’t exist. And, the factorial of 0 is 1,
0! = 1
Program:
Perfect number:
Perfect number is a number which is equal to sum of its divisor.
i.e. divisors of 6 are 1,2 and 3. The sum of these divisors is 6. So 6 is called as perfect number.
Program:
Prime number:
A prime number is a positive integer which is divisible only by 1 and itself.
i.e: 2, 3, 5, 7, 11, 13
Program:
Even number:
An even number is an integer that is exactly divisible by 2.
i.e. 0, 8, -24
Program:
Odd number:
An odd number is an integer that is not exactly divisible by 2.
i.e. 1, 7, -11, 15
Program: refer above program
Happy Coding!