For any given number we would need to return the number in reverse, with the starting place to the end place. For example, for an input of 1423 we would need to return 3241 which is its exact reverse. To achieve this, we would use the same principle we use for splitting the number; the Divisibility by 10 rule.
Factorial of a number is calculated by multiplying all the numbers from 1 till the number itself. For any given input number, we are required to calculate factorial, using recursion. Recursion is a technique in which a method calls itself in a loop until some breaking statement is met. This technique makes programming significantly simple and is used in complex computations to save memory.
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.
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 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.