A Palindrome is defined as a phrase or a number which when reversed also gives the same phrase or number. For example, the word abcdcba is a palindrome because even when you read the string from end to the beginning you'll get the same string as the original. Some real words such as malayalam, madam, refer, reviver, noon, mom and such are all palindromes in general use.
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.
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.
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.
For any given number greater than 9, we would need to find the number of digits present in the number by pure logic. For this, we would use the standard divisibility rule of 10 in which when a number is divided by 10 the last digit of the number is returned as the remainder and the remaining digits are returned as the quotient.
For example : 6234 divided by 10 leaves 4 as remainder since 10 divides 6234 by 623 times.
We use this rule to strip the numbers and count them.
A Perfect square is a whole number which is produced by multiplying two equal integers. In other words, a number which has a square root as an integer is called a Perfect square.
Examples are 1, 4, 9, 25, .. and such.
For any given number, we would need to find if there is a number which multiplied by itself results in the same number.
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.
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,..
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.
Factors of a given number are the numbers from 1 till the number, for which the number is divisible. It means all these numbers divide the given number and give remainder 0.
Example: The factors of 24 are 1, 2, 3, 4, 6, 8, 12, 24