Java program to print prime factorisation of an integer

preview_player
Показать описание
Given an integer n greater than 1, write a Java program to count distinct prime factors of an integer and print prime its factorisation.

Java program to print prime factorisation of an integer.
Java program to count distinct prime factors of an integer.

Example:
If n=600, n has 3 distinct prime factors : 2 3 5
Prime factorisation of n: 600 = 2 x 2 x 2 x 3 x 5 x 5

Solving this problem using two approaches:
- Brute force & then optimising it
- Using Sieve of Eratosthenes

Java practice program for beginners
Java practice program on loops.
Java practice program in integers.

0:00 Intro

0:24 Problem description

1:15 Brute force approach to print prime factors of an integer

3:07 Java function to check if an integer is a prime number or not

7:18 Dry run for brute force Java code to print prime factors of an integer

17:20 Using Sieve of Eratosthenes to print prime factors of an integer

26:35 Count number of distinct factors using brute force & optimised approach

27:54 Testing the Java code on an online judge to count number of distinct factors using optimised approach

29:50 Testing the Java code to print prime factorisation using Sieve of Eratosthenes

31:12 Testing the Java code on an online judge to print prime factorisation using Sieve of Eratosthenes

32:25 Print prime factorisation for some random numbers

#javaprogramming #javatutorial #javaforbeginners
Рекомендации по теме
visit shbcf.ru