program to find prime factors of a number in java

Solutions on MaxInterview for program to find prime factors of a number in java by the best coders in the world

showing results for - "program to find prime factors of a number in java"
Fia
31 Feb 2019
1import java.util.Scanner;
2
3public class PrimeFactors {
4   public static void main(String args[]){
5      int number;
6      Scanner sc = new Scanner(System.in);
7      System.out.println("Enter a number ::");
8      number = sc.nextInt();
9      
10      for(int i = 2; i< number; i++) {
11         while(number%i == 0) {
12            System.out.println(i+" ");
13            number = number/i;
14         }
15      }
16      if(number >2) {
17         System.out.println(number);
18      }
19   }
20}
Lotta
23 Aug 2016
1public static void main(String[] args) {
2   	int n=12;
3    for(int i=2; i<=n; i++){ 
4       while(n%i==0){
5         n=n/i;
6         System.out.println(i); //prints 2 2 3
7       }
8   }
9}
Cristina
11 Aug 2020
1public class Factors {
2
3    public static void main(String[] args) {
4
5        int number = 60;
6
7        System.out.print("Factors of " + number + " are: ");
8        for(int i = 1; i <= number; ++i) {
9            if (number % i == 0) {
10                System.out.print(i + " ");
11            }
12        }
13    }
14}
Victoria
28 Sep 2017
1import java.util.Scanner;
2
3public class PrimeFactors {
4   public static void main(String args[]){
5      int number;
6      Scanner sc = new Scanner(System.in);
7      System.out.println("Enter a number ::");
8      number = sc.nextInt();
9     
10      for(int i = 2; i< number; i++) {
11         while(number%i == 0) {
12            System.out.println(i+" ");
13            number = number/i;
14         }
15      }
16      if(number >2) {
17         System.out.println(number);
18      }
19   }
20}
queries leading to this page
to find the sum of prime factors javafind factot in javaprime factor decomposition java algorithm solutionfactors from list javasum of prime factors of a number in javaprime factors upto number in javaprime factors in javaprime factors of a bigger number in javaefficient way to find prime factor of number in javadisplay the prime factors of a given positive integer in javafactors of a number in javafind factors of a number in javamath factor javahow to find prime factors of a number in javafactors in javahow to ind factores of number javahow to use for loop to find number of factors of a number javajava get prime factors of numberfind the factors of a number in javahow to find the factors of a number in javajava program to find factors of a numbernumber of factors of a number javahow to find all the factors of a number in javafind factors in javahow to find prime factors javadisplay the prime factorization in java using integerfunctions classjava code for prime factorisationfinding all the prime factors of a number in javafind the factor of number in javaprogram to find the factors of a number in javacount the factors of the number javafind all factors of a number javajava method for prime factorizationfind number prime factors of a number in javahow to find prime factors in javaprime factor program in javaall primer factors javafind factor of a number in javajava program to calculate prime factor of a numberprime factorization javanumber of prime factor javaprime factor of a number code in javahow to get all the factors of a number javafind prime factors of a number in javajava prime factor checkerjava get prime factorsfind prime factorization java prowrite a java program to find the factors of a given numbermethod for factoring javcomputing prime factors in javafind prime factors of a number javafactors of a number program in javajava factors of a numberprime factors program in javanumber of factors of a given number are javajava class with prime factorizationprime factor java progrmhow to find no of factors of a number javaprime factors of a number javaprime number factorization javaprime factors of a numbe in javastore prime factors of a number in array in javajava prime factorprime factors of number in javano of factors of a number javahow to get all factors of a number in javafinding all the factors of a number in javafind factors of n javajava get factors of a numberprime factor algorithm javafastest way to find factors of a number javafactors of 24 in java programwhich no of factors of number java functionno of factors of a number in javafor statement to print factors of 10 javahow to find the prime factors of a number javafind all factors of a number jvahow to get all the factors of the given number javaprime factor decomposition javafinding factors of a number in javajava program for prime factorisationfind the factors of an element javafind prime factors of a number in java using stream methodprime factorisation in javajava get the factors of a numberprime factor a number javawrite a program to print factors of a number in javaprime factorization program in javajava prime factorization methodfind prime factor number javahow to find factors of number in javaprime factorisation program in javaprime factorization of a number in javahow to get factors of number javaprime and factorization javadescomposition prime factorial of a number in javaprime factorization method in javahow many factors does a number have javaprint the number of common factors of a and b in javajava get prime factor of numberall factors of a number javahow to find the factor of a number in javaprime factors javaprime factor in javaprime factors of a number code in javaprime factorizzation javajava program to get the prime factorization of a numberprime decomposition javahow to do prime factorization of a number java optimallyfind number of factors of a number javahow to find the factors of a number javajava compute the prime factors of a given natural numberprime factorization using javalist of prime factorization of a number javahow to find factors of a number javaprime factors of a number in javaget prime factors of a number javaget factors of number in javajava program for prime factorizationjava factoring of integerswhich no of factors of number javahow to find the prime factors of a number in javajava find prime factors of a numberprime factorization code javahow to print factors numbers of a number in javajava prime factors of a numbermethod to find the prime factor of a given number in javafind no of factors of a number in javajava fast prime factorization libraryhow to find prime factor of a number javaprime factorization java codeprogram to find prime factors of a number in java without using sqrtfactoring a number javaprime factors of n in javajava store factors of a numberfind factors of a number javajava math find factors how to get factors of a number in javajava print prime factorizationsystem out print the factor of 2bn arehow to get prime factors count of a number in javajava see a number 27s prime factorprint factors of a number in javahow many factors does a number javajava all factors of a numberfactors of a number after a number in javasign to dactorize in java 27java method to find prime factorsprimefactorization in javajava program to find factors of a given numberfactors of a number before a number in javajava find factors of a numberall factors java programprime factors using javajava program to find prime factorisationhow to measure prime factors in javajava print factors of a numberprint prime factors of a number javaunique prime factors of a number in javaprime and factorizing javahow to find factors of a number in javajava program to find the factors of a number in terms of prime numbersget all prime factor of number java codefind prime factors of a number in java in c 2b 2bfind the prime factors of a number in javaprime factorization in javahow to take out factors of a number in javafinding prime factorization of a number javaget factors of a number javaprogram to find prime factors of a number in javaprogram to find factors of a number in javaprime factors java codehow to find all factors of a number in javafind out factors of a number in javajava display factors of numberfactorise number in primes javabetsy teaches her daughter to find the factors of a given number when she provides a number to her daughter 2c she should tell the factors of that numbfind factor number javafind prime factor in javafind no of factors of a number javawrite a java program to find factors of a numberjava prime factorizationprime factorof a number in javafind all the factors of a number javajava code for prime factorisation dynamic pogrammingprimefactors in javafind number of prime factors javafactors of a number javafactor in javafind prime factors of number javawrite a program to compute factors of a number n using prime factorization method in javaget all factors of a number javafind all factors of number in javaprime factorization algorithm java 27number of factors for a given number is in javanumber of factors in javacalculating factors of a number in javajava fast prime factorizationfinding prime factors of a number in javaprime factor javahow to find prime factor in javaprime factors code in javacalculate prime factors of a number javajava finding factors of a numbercalculate prime factors of a number in javaprime factorizzation in javaprimal factor javaprime factors of a number java prgramjava prime factor generator classfactors javacondition for prime factor in javaprime factorization of a number javadisplay the prime factorization in javajava program to find prime factors of a numberprime factorization code in javajava prime factor generatorcalculate factors of a number in javafactors of number in javaprime factorization java programjava factorization numberprogram to find prime factors of a number in java with try catchhow to find factors of a number in javashow to get factors of a number javahow to get prime factors of a number java java program tfor prime factorizationnumber of prime factors of a number javaprogram to find prime factors of a number in java