Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
6 votes
3 answers
895 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 ...
Nadav Nevo's user avatar
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 ...
Amir Motefaker's user avatar
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 ...
Amir Motefaker's user avatar
3 votes
1 answer
1k views

Python code to find greatest common divisor of multiple numbers

Hmm, I know this has been implemented countless times, and Python 3.9.5 math standard library has a built-in gcd() method that ...
Ξένη Γήινος's user avatar
5 votes
1 answer
88 views

Finding all factors and prime factors of a number

I am working on the Project Euler, number 3 project (finding the largest prime factor of 600851475143), but I wanted to take it a step further and write something that will list all factors and prime ...
Zach Frost's user avatar
6 votes
2 answers
694 views

Euler 12: counting divisors of a triangle number

This is the question: The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: ...
Chezhiiyan Sabapathy's user avatar
2 votes
1 answer
361 views

Project Euler #47: find four consecutive integers, each with four distinct prime factors

Project Euler Problem 47 Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers? This is my solution for problem 47 on Project Euler. ...
EugeneProut's user avatar
  • 1,005
6 votes
3 answers
300 views

Project Euler 21: Sum of amicable numbers optimisation

Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b ...
J. Cricks's user avatar
  • 199
2 votes
2 answers
353 views

Finding the nth ugly number

I'm trying to optimize my solution to this LeetCode problem: Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the ...
nz_21's user avatar
  • 1,051
5 votes
2 answers
107 views

Project Euler - Problem 3

The description of the problem is: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Here is my solution: ...
Omri Shneor's user avatar
1 vote
1 answer
285 views

Project Euler # 21 amicable numbers Python

Let \$d(n)\$ be defined as the sum of proper divisors of \$n\$ (numbers less than \$n\$ which divide evenly into \$n\$). If \$d(a) = b\$ and \$d(b) = a\$, where \$a ≠ b\$, then \$a\$ and \$b\$ are an ...
user avatar
1 vote
2 answers
205 views

Project Euler problem # 3 is this the most efficient approach in Python or can I do better?

The problem statement: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? This code takes 9 seconds!, is there a better way? ...
user avatar
2 votes
2 answers
915 views

Project Euler #3 with Python

I tried to solve some Euler's problems, this is the solution I found for problem #3 with Python. The problem asks: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of ...
Roberta Belladonna's user avatar
4 votes
1 answer
145 views

Project Euler problem #3

My code works but would take 160 days to run lol. ...
tazaja's user avatar
  • 41
2 votes
2 answers
338 views

Work out largest prime factor of a number

I am trying to get better at problem solving, so I am going through challenges on Project Euler. Problem: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the ...
Newbie101's user avatar
  • 123

15 30 50 per page