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 ...
6 votes
0 answers
125 views
Optimizing SymPy Implementation of prime factorization in form of QUBO
I'm trying to reproduce a paper on Prime Factorization. This paper converts the problem into a QUBO form, which then we can map it to an Ising Minimizer. I've basically done everything and I've ...
3 votes
1 answer
120 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 ...
2 votes
2 answers
181 views
generate prime factors via wheel factorization
I want to factor random values of n that range from uint.MinValue to uint.MaxValue as ...
3 votes
1 answer
251 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 ...
4 votes
2 answers
214 views
Abundant number implementation
I have implementted a simple JavaScript function to find the list of abundant numbers and print them on the screen. an abundant number is a number for which the sum of its proper divisors is greater ...
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: ...
5 votes
1 answer
128 views
Möbius function using iterators for prime factors
While working on Project Euler, I have come across a few questions involving usage of the little omega function, big omega function, and Möbius function. My prior code wrote factors into an array and ...
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 ...
4 votes
1 answer
139 views
Finding Highly Composite Numbers in Swift
This code finds highly composite numbers (numbers with more factors than any smaller number) in Swift. I'm not too familiar with Swift, I did this in python but it was too slow so I decided to try it....
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. ...
2 votes
1 answer
4k views
The smallest positive number that is evenly divisible by all of the numbers from 1 to 20
Problem description: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of ...
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
1 answer
292 views
Highly divisible triangular number
Highly divisible triangular number, my solution My solution of challenge from Project Euler takes too much time to execute. Although on lower numbers it works fine. Anyone could look up to my code and ...
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 ...