10 questions linked to/from Sieve of Eratosthenes - Python
1k views

### Count distinct primes, discarding palindromes, in under 2 seconds

Problem Statement Generate as many distinct primes P such that reverse (P) is also prime and is not equal to P. Output: Print per line one integer( ≤ 1015 ). Don't print more than 106 ...
1k views

### Optimise Sieve of Eratosthenes

I have written the following code for finding out the prime numbers less than or equal to n. When I enter the input n = 10^7, my ...
953 views

### Wheel based unbounded sieve of Eratosthenes in Python

Answering this SO question recently, I've developed the following code (based on a well-known Active Code recipe, as discussed here): ...
2k views

### Project Euler 50 in Python

Project Euler, problem #50: The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime ...
2k views

### Sieve of Eratosthenes: making it quicker

I was thinking about doing problem 23 of Project Euler. It includes the difficulty where you have to factorize primes. I had already done that in problems I solved earlier, but it was only necessary ...
466 views

### Find good numbers in a given range

This is the Good Numbers problem at Code Chef: A number is called a square-free number if there does not exist a number greater than 1, whose square divides the number. For example, 8 is not a ...
842 views

### Prime number generator in Python

I have made a Python program that can perform some prime number functions. For example, it can produce an endless output of sequential primes. I am looking for ways to make it faster and cleaner. When ...
480 views

### Sum of prime factors of binomial coefficients over 9000!${}$

The problem I have lately been working Project Euler: 231: The prime factorisation of binomial coefficients The binomial coefficient $^{10}C_3 = 120$. \\$ 120 = 2^3 × 3 × 5 = 2 × 2 ×...