Sha256: 43747af61126fcdf717883efdc271f0adaba537c7b02922b9857b733287ade66
Contents?: true
Size: 437 Bytes
Versions: 142
Compression:
Stored size: 437 Bytes
Contents
import java.util.ArrayList; import java.util.List; public class PrimeFactors { public static List<Long> getForNumber(long number) { List<Long> primes = new ArrayList<>(); long divisor = 2; while (number > 1) { while (number % divisor == 0) { primes.add(divisor); number /= divisor; } divisor++; } return primes; } }
Version data entries
142 entries across 142 versions & 1 rubygems