Posts

Showing posts from August, 2020

Twin Prime Number Using Function in JAVA

Image
Twin Prime Number using Function in JAVA Twin Prime Number : A Twin Prime is a prime number that is either 2 less or 2 more than another prime number— For example, ( 41 , 43 ) are twin pairs. In other words, a twin prime is a prime that has a prime gap of two . Algorithm to check whether two numbers are Twin prime or not :- Input two numbers Check both the numbers are prime or not Check if the difference between the numbers is equal to 2 or not If both the numbers are prime and difference is equal to 2 Print "Numbers are Twin Prime" Else print "Numbers are not Twin Prime"

Fibonacci Prime Series in JAVA

Image
Fibonacci Prime Series Fibonacci Series : A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 0, 1, 1, 2, 3, 5, 8, etc.   Fibonacci Prime Series : A Fibonacci prime is a Fibonacci number that is prime, a type of integer sequence prime.   The first few terms of the sequence are :-   2, 3, 5, 13, 89, 233, 1597, 28657, 514229, 433494437, 2971215073, ....

Tribonacci Series in JAVA

Image
Tribonacci Series Tribonacci Series : A Tribonacci sequence is a sequence of numbers such that each term from the fourth onward is the sum of the previous three terms. It is similar to Fibonacci Series   The first few terms of the sequence are :-   0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927

Lucas Series in JAVA

Image
Lucas Series Lucas Series : A series of numbers in which each number (Lucas Number) is the sum of the two preceding numbers. It starts from 2 and 1. It is similar to Fibonacci Series   The first few terms of the sequence are :-   2    1    3    4    7    11    18    29    47    76    

Pell Series in JAVA

Image
Pell Series Pell Series : A series of numbers in which each number (Pell Number) is the sum of the twice the previous Pell number and the Pell number before that. It starts from 0 and 1.   The first few terms of the sequence are :-   0   1    2    5    12    29    70    169    408    985     

Co-Prime Number in JAVA

Image
Co-Prime Number in JAVA Co-Prime Number : A Co-prime number is a set of numbers or integers which have only 1 as their common factor i.e. their highest common factor ( HCF ) will be 1   Co-prime numbers are also known as relatively prime or mutually prime numbers.   Example :- For 21 and 22 The factors of 21 are 1, 3, 7, and 21. The factors of 22 are 1, 2, 11, and 22.   For 21 and 27: The factors of 21 are 1, 3, 7, and 21. The factors of 27 are 1, 3, 9, and 27.

Pascal's Triangle in Java

Image
 Pascal's Triangle Program in Java

Twin Prime Number in JAVA

Image
Twin Prime Number in JAVA Twin Prime Number : A Twin Prime is a prime number that is either 2 less or 2 more than another prime number— For example, ( 41 , 43 ) are twin pairs. In other words, a twin prime is a prime that has a prime gap of two . Algorithm to check whether two numbers are Twin prime or not :- Input two numbers Check both the numbers are prime or not Check if the difference between the numbers is equal to 2 or not If both the numbers are prime and difference is equal to 2 Print "Numbers are Twin Prime" Else print "Numbers are not Twin Prime"