Find if the given number is a Perfect Number

A Perfect Number is a positive integer for which the sum of all of its positive factors except the number results in the number itself. For example, 6 is a perfect number because the factors of 6 excluding itself are 1, 2, 3 and sum of them is itself - 6.

To achieve this, we shall make use of the factors logic and find the sum of all factors except the number itself and check if the sum is equal to the number or not.

Find if the given number is a Palindrome

A Palindrome is defined as a phrase or a number which when reversed also gives the same phrase or number. For example: 14341 when reversed results in 14341 which is same as the original number. Which is what we call a palindrome.

In order to achieve this, we extend our logic to reverse a given number to add a little condition at the end to check if the created number is equal to the input number or not. If equal it means that the input number was a palindrome, else not.

Find if the given number is an Armstrong Number

A number is called an Armstrong Number or Narcissistic number if the sum of its own digits raised to the power of the number of digits equals to the number.

For example, 371 = 3^3 + 7^3 + 1^3 = 27 + 343 + 1

By logic, all single digit numbers are Armstrong numbers since n^1 = n.

For a given number, we would need to find out if the given number is an Armstrong number or not.

Find all the Fibonacci numbers for a given limit

Fibonacci numbers are a series of numbers in which each number is formed by adding previous two numbers in the series. For example, we start by 1 and 2, and then repetitively add the add the numbers to result in the next number.

For a given max limit 10, we would want to find the first 10 Fibonacci numbers.

Series: 1,2,3,5,8,13,21,34,55,89

Check if a given number is Even or Odd

Any number which is divisible by 2 is called as an Even number, and any number which is not divisible by 2 is called an Odd number. Examples of Even numbers are all multiples of 2 such as 2,4,6,8,10 .. and Odd numbers are 1,3,5,7,9,..

Check if the given number is a prime number

Any number which cannot be divisible by any other number except one and itself is called a prime number. In other words, any number which doesn't have more than 2 factors (1 and itself) is called a prime number.

Examples: 2, 3, 11, 13, 19 and such

For a given number n, we shall find out the total factors for the number and decide whether the number is a prime or not.