Home » ALGORITHM

# Category Archives: ALGORITHM

## ALGORITHM FOR BASIC GATES

A logic gate is simply an electronic circuit which operates on one or more input singles and produces a output.

## TYPES OF LOGIC GATES

There are eight types of logic gates which can generate different outputs for the inputs. They can have any number of inputs lines but they have always a single output line. These eight logic gates as: (more…)

## ALGORITHM AND FLOWCHART FOR PRIME NUMBER

Every Prime number has two factors and these are 1 and the number itself. If N is Prime Number then its factors will be 1 and N. Thus a Prime Number is divisible by 1 and itself. Example of Prime Numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 and so on. The smallest Prime Number is 2 and it is an Even Number. Except 2 all Prime Numbers are Odd Numbers. (more…)

## ALGORITHM TO FIND GREATEST COMMON DIVISOR

The GCD or greatest common divisor of two or more positive numbers is the greatest number which divides each number completely (Leaving no remainder). For example 6 and 18 are divisible by 2, 3, and 6. But 6 is the greatest number among 2, 3 and 6. Thus 6 is the GCD of 6 and 18. Similarly GCD of 10, 15 and 35 is 5. GCD is also known as HCF or Highest Common Factor. (more…)

## ALGORITHM AND FLOWCHART FOR COPRIME NUMBER

A Coprime number comes in pair of integers. Thus they are defined as those paired numbers which can be divided by the common number 1 are called coprime numbers. Suppose a and b are two positive integers and they are divisible by only 1. Then a and b are co-prime number. For example 3 and 5 are only divisible by 1. Thus 3 and 5 are co-prime number. If a and b are divisible by some more numbers other than 1 then they are not co-prime number. For example 6 and 10 are not co-prime number. Because 6 and 10 are divisible 2 also other than 1. A coprime number is also known as relatively prime and mutually prime number. (more…)

## ALGORITHM AND FLOWCHART FOR COMPOSITE NUMBER

Those numbers which are divisible by other than itself and 1 are known as composite numbers. The number 4 can is divisible by 1, 2 and 4 therefore 4 is a composite number. But 7 is divisible by only 1 and 7 thus 7 is not a composite number. For example 8, 6, 9, 25, 102, 502 etc. The smallest composite number is 4. 1, 2 and 3 are not composite numbers. 2 and 3 are prime numbers. (more…)

## ALGORITHM TO CHECK EVEN AND ODD NUMBERS

A number is said to be even number if it leaves no remainder when divided by 2. There is an alternative definition of even number and it is as a number having any number from 0, 2, 4, 6 and 8 at its ones place is an even number. Examples of even numbers are 12, 66, 456, 9900 and 12342 etc. An odd number leaves a remainder when it is divided by 2. All those numbers having any one from 1, 3, 5, 7 and 9 at their ones places are also called odd numbers. (more…)

## PERFECT NUMBER ALGORITHM AND FLOWCHART

A number is said to be a perfect number if the sum of factors of the number (**excluding number itself as a factor**) is equal to the number itself. Example of perfect numbers are 6, 28, 496, 8128 and so on. The factors of a given number are those numbers which divide the given number completely. For example factors of 28 are 1, 2, 4, 7, 14 and 28. Now the sum 1 + 2 + 4 + 7 + 14 = 28. We can see that 28 is not included in the sum. (more…)