Questions tagged [factors]
For code working with the factors (divisors) of a number
130 questions
6 votes
3 answers
925 views
Project Euler 127 - abc-hits
Problem (Rephrased from here): The radical of \$n\$, \$rad(n)\$, is the product of distinct prime factors of \$n\$. For example, \$504 = 2^3 × 3^2 × 7\$, so \$rad(504) = 2 × 3 × 7 = 42\$. We shall ...
3 votes
1 answer
119 views
Find perfect and amicable numbers
I've been playing with perfect, amicable and social numbers lately, and created a class for investigating these. At present, it has functions to return the perfect and amicable numbers in a specified ...
3 votes
1 answer
250 views
Find factor pairs of an integer in Rust
I'm trying to efficiently generate all pairs of factors of a number n. For example, when n=27, the factor pairs are (1, 27), (3, 9), (9, 3), (27, 1) The order in which the pairs are found is not ...
8 votes
3 answers
2k views
A Simple C Program to Find Factors of any Integer
I have written a simple CLI app that finds factors in 3 different forms. I would like the code to be reviewed. Here's the code: ...
1 vote
3 answers
282 views
Find numbers whose factors, when squared, sum to a perfect square
I need help optimizing my Python code for CodeWars Integers: Recreation One Kata. We are given a range of numbers and we have to return the number and the sum of the divisors squared that is a square ...
0 votes
1 answer
226 views
Find factors of a Mersenne number
On RosettaCode I found this C++ version of modPow (compute 2ᵖ mod n) to find the factors of a Mersenne number. ...
5 votes
2 answers
1k views
Calculate the first largest factor of 600851475143
ٍProblem description: The prime factors of 13195 are 5, 7, 13 and 29. Largest prime factor 13195 is 29. What is the largest prime factor of the number 600851475143 ? Prime Factor: any of the prime ...
3 votes
2 answers
177 views
Factor 999999 numbers as fast as possible
My code finds the prime factorization of numbers, ordering the prime numbers from least to greatest. It prints a list of 999999 prime factorizations (which can be changed if you edit the function call ...