Skip to main content

Questions tagged [factors]

For code working with the factors (divisors) of a number

6 votes
3 answers
925 views

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 ...
Nadav Nevo's user avatar
3 votes
1 answer
119 views

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 ...
Toby Speight's user avatar
  • 88.5k
3 votes
1 answer
250 views

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 ...
Bram's user avatar
  • 93
8 votes
3 answers
2k views

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: ...
SHUBHAM KULKARNI's user avatar
1 vote
3 answers
282 views

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 ...
melike's user avatar
  • 57
0 votes
1 answer
226 views

On RosettaCode I found this C++ version of modPow (compute 2ᵖ mod n) to find the factors of a Mersenne number. ...
user140242's user avatar
5 votes
2 answers
1k views

ٍ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 ...
Amir Motefaker's user avatar
3 votes
2 answers
177 views

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 ...
Some Guy's user avatar
  • 131

15 30 50 per page
1
2 3 4 5
9