Posts

Showing posts from 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"

Abundant Number in JAVA || BluejCode

Image
Abundant Number in JAVA Abundant Number : A number ‘n’ is said to be Abundant Number if sum of all the proper divisors of the number is greater than the number ‘n’ . The difference between Sum & Number is called the abundance . The abundant number can be called as an excessive number

Pattern Program #4 || Number Pattern in JAVA || BluejCode

Image
Pattern Program #4 Pattern 1 Pattern 2 Pattern 3

String Pattern #1 in JAVA || BluejCode

Image
String Pattern Program #1 String Pattern

Pattern Program #3 || Pattern Program in JAVA || BluejCode

Image
Pattern Program #3 Pattern

Count Words in a String in JAVA

Count No. of Words in a String To Count number of words in a string we have to count no of white spaces in the given string. No. of words = No. of White Spaces + 1. Example :- Welcome to BluejCode! Here : No. of white spaces are 2, So words are (No. of white spaces + 1) = 3 words

Pronic Number in JAVA

Pronic Number Pronic Number : A number is said to be Pronic number if the product of any two consecutive integer is equal to the number itself. Example: Input          : 6  : 2 X 3 = 6 Output       : It is a Pronic Number   Input          : 20  : 4 X 5 = 20 Output       : It is a Pronic Number   Input          : 8  : 2 X 4 = 8 Output      : It is not a Pronic Number   Some Pronic Numbers are :- 0, 2, 6, 12, 20, 30, 42, 56, 72, 90 etc. Algorithm and Program given below :-

ISBN Number in JAVA [Updated]

Program to Check ISBN Number ISBN Number :  ISBN stands for International Standard Book Number. It is a unique numeric book identifier which is printed on every book. The ISBN is based upon  10 Digit Code . The ISBN Number is valid if :- (10  X  Digit 1  +  9  X  Digit 2  +  8  X  Digit 3  +  7  X  Digit 4 + 6  X  Digit 5  +  5  X  Digit 6  +  4  X  Digit 7  +  3  X  Digit 8 + 2  X  Digit 9  +  1  X  Digit 10) is Divisible by  11. Example: ISBN   : 1401601499 Sum   : 10*1 + 9*4 + 8*0 + 7*1 + 6*6 + 5*0 + 4*1 + 3*4 + 2*9 + 1*9 = 132 132 is divisible by 11 Output : Correct ISBN number. Algorithm and Program given below  :-

ISBN Number in JAVA for ICSE/ISC

ICSE/ISC Program to Check ISBN Number ISBN Number : ISBN stands for International Standard Book Number. It is a unique numeric book identifier which is printed on every book. The ISBN is based upon 10 Digit Code . The ISBN Number is valid if :- (1 X Digit 1 + 2 X Digit 2 + 3 X Digit 3 + 4 X Digit 4 + 5 X Digit 5 + 6 X Digit 6 + 7 X Digit 7 + 8 X Digit 8 + 9 X Digit 9 + 10 X Digit 10) is Divisible by 11. Example: ISBN : 1401601499 Sum : 1*1 + 2*4 + 3*0 + 4*1 + 5*6 + 6*0 + 7*1 + 8*4 + 9*9 + 10*9 = 253 253 is divisible by 11 Output : Correct ISBN number. Algorithm and Program given below :-

Happy Number in JAVA

Image
Happy Number Happy Number : A Happy Number is defined as : Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1. Example :- Input                     : 49 Output                 : It is a Happy Number Input                     : 4 Output                 : It is not a Happy Number Algorithm, Program and Video Link given below :-

Tri-Automorphic Number in JAVA

Tri-Automorphic Number Tri-Automorphic Number : A number is called Tri-Automorphic number if the last digits of 3 times the square of the number is equal to the number itself. Or A number ‘n’ is called Tri-Automorphic if ‘3n 2 ’ ends in ‘n’. Example :- Input      : 5 Sqaure    : 3 X (5 X 5) = 75 Output    : It is a Tri-Automorphic Number Input      : 667 Sqaure    : 3 X 667 X 667 = 1334667 Output    : It is a Tri-Automorphic Number   Input      : 12 Square    : 3 X 12 X 12 = 432 Output    : It is not a Tri-Automorphic Number Algorithm and Program given below :-

Trimorphic Number in JAVA

Trimorphic Number Trimorphic Number : A number is called Trimorphic Number if and only if its cube ends in the same digits as the number itself.  Or  A number ‘n’ is called Trimorphic if ‘n^3’ ends in ‘n’  Example :- Input : 5  Cube : 5 X 5 X 5 = 625  Output : It is Trimorphic Number  Input : 49  Cube : 49 X 49 X 49 = 117649  Output : It is a Trimorphic Number  Input : 7  Cube : 7 X 7 X 7 = 343  Output : It is not a Trimorphic Number   Algorithm and Program given below :-

SuperPalindrome Number in JAVA

Super Palindrome Number Super Palindrome Number : A Super Palindrome Number is a Palindrome Number whose square is also Palindrome. Example: Input         : 11 Square      : 11 X 11 = 121 Output     : It is a Super Palindrome Number Input         : 22 Square      : 22 X 22 = 484 Output     : It is a Super Palindrome Number Input         : 44 Square      : 44 X 44 = 1936 Output     : It is not a Super Palindrome Number   Algorithm and Program given below :-

Tech Number in JAVA

Image
Tech Number Tech Number : A Tech Number has even number of digits. If the number is split into two equal halves. then the square of the sum of these halves is equal to the number itself. Example: Input                  : 3025 Total Digits       : 4 1 st Half              : 30 2 nd Half             : 25 Sum                   : 30 + 25 = 55 Square               : 55 X 55 = 3025 Output               : It is a Tech Number Input                  : 2025 Total Digits       : 4 1 st Half              : 20 2 nd Half             : 25 Sum                   : 20 + 25 = 45 Square               : 45 X 45 = 2025 Output               : It is a Tech Number Input                  : 104 Total Digits       : 3 Output               : It is not a Tech Number Algorithm and Program given below :- Algorithm : - Input number as a string Store the length of the string in a variable Convert the input number as Integer Check if the digit