All Questions
46 questions
6
votes
3
answers
882
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
335
views
Project Euler 60: Prime Pair Sets
Project Euler Prime Pair Sets:
The primes 3, 7, 109, and 673 are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime.
For example, taking 7 ...
4
votes
2
answers
210
views
Project Euler #51: "Prime digit replacements" in Rust
Problem: https://projecteuler.net/problem=51
"Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime ...
1
vote
2
answers
155
views
Improving Project Euler code problem #10
So, I just finished Problem 10 on Project Euler, but it took about 3 to 4 minutes for my output to come out, due to bad coding, I guess, any suggestions on how could I optimize my code?
Question
The ...
1
vote
3
answers
219
views
Count prime numbers whose rotations are all prime
This code solves Project Euler problem 35:
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes ...
1
vote
3
answers
398
views
Find the 10001st prime number
Project Euler 7: What is the 10 001st prime number?
I currently have this code:
...
3
votes
3
answers
348
views
Project Euler 50: Consecutive prime sum
I just finished solving Project Euler's 50th problem, but it's awfully slow. I'd like to hear your thoughts on my code's efficiency and practices.
Problem Statement
The prime 41, can be written as the ...
1
vote
2
answers
200
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?
...
3
votes
2
answers
1k
views
Sum of primes up to 2 million using the Sieve of Eratosthenes
I've solved question 10 on Project Euler using the Sieve of Eratosthenes, what can I do to optimize my code?
...
7
votes
2
answers
2k
views
Arranging numbers in a circle such that the sums of neighbors and sums of diametric opposites are prime
I need to create a circle with numbers from 1 to n , however it is necessary to respect some rules:
All numbers from 1 to n are used in the circle only once.
The sum of two consecutive numbers ...
1
vote
2
answers
151
views
Segmented Sieve Spoj
I tried(trying...) to solve the SPOJ prime number problem PRIME1 so i learned and implemented Segmented Sieve correctly but this program works in time for 10^8 but getting Time limit exceeded (TLE) ...
4
votes
2
answers
259
views
Euler Problem 7 (finding the 10001st prime) in Powershell
I am having issue making this code more efficient. The problem to be solved is as follows:
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can
see that the 6th prime is 13.
...
2
votes
2
answers
1k
views
Project Euler Problem 37 in Python
Project Euler Problem 37 asks:
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, ...
2
votes
1
answer
165
views
Project Euler: Find 10.001st prime
I have just started learning C# and decided to do some problems from Project Euler. I wrote a code to find 10 001st prime and I thought it would be cool optimize it to make it as fast as possible. How ...
4
votes
2
answers
3k
views
CodeWars: Gap in Primes
I wrote JavaScript code for finding the first two consecutive prime numbers (that doesn't have divisors except one and itself) with a specific gap between them. It works well but take too much time to ...