# Tagged Questions

Primes or prime numbers are numbers which are divisible only by themselves and one, starting with 2, 3, 5, 7, 11.... They are commonly used in encryption and hashing algorithms.

40 views

### C++ Prime Number Library

This prime number library is one of my first programming projects I've done in c++. My goal is to create useful functions that deal with prime numbers in an efficient way.Note: (Most of the functions ...
73 views

### C the sum of primes

The challenge is to calculate the sum of the first 1000 primes. The code applies a sieve thanks to past answer, here, and works but I wonder about the flexibility of this solution. ...
72 views

### Prime number checker in Python 3 - follow-up

I have updated my code from the last time it got reviewed. If anyone has some more suggestions on how I can improve this and/or make it faster it would be appreciated! ...
814 views

### Largest Prime Factor (PE3) using OOP

I want to learn some C# syntax/paradigms (I'm more used to Java), and have been wanting to get a bit better at math as well, so I solved ProjectEuler3: Largest prime factor with the following small ...
60 views

### Prime number calculator in Python 3.4.1

I have only been coding for a short time and I have written these two functions and am looking to optimise them. If anyone could point out things that could be done better it would be much appreciated....
89 views

### Shortest prime number generator we could come up with?

I worked with a friend on the following prime number generator. Our goal was to make it as short and as fast as possible. This is what we came up with: ...
23 views

### Java: Prime Number Search [closed]

I am very new to java and I was trying to create a simple program that finds the amount of prime numbers less than or equal to a certain integer that is inputted by the user. this is the code ...
569 views

### Project Euler 10: find the sum of all the primes below two million

This is question #10 from Project Euler: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. I just started programming and read that a Sieve ...
50 views

### Check if a number is prime

I'm looking for feedback on the following code which checks if a number is prime using Swift 2. ...
71 views

### Project Euler #50 Consecutive prime sum

I'm having trouble optimising the project euler #50 exercise, it runs for around 30-35 seconds, which is terrible performance. The prime 41, can be written as the sum of six consecutive primes: ...
103 views

### Finding the prime factors of a positive number

I have an assignment to write on the standard output the prime factors of a positive number displayed in ascending order and separated by '*'. My code works, but I need help reviewing it before I ...
79 views

### Project Euler #49 Prime permutations

Today I solved problem #49 from project euler .net which reads : The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the ...
91 views

...
72 views

### Prime Number Generator

The purpose of this program is to run an infinite prime generator that won't stop unless I tell the console to stop. This is not a sieve of Eratosthenes; it stores prime numbers in an array and ...
146 views

### Calculate the sum of all primes less than 2,000,000 in Swift

This is a Swift program I wrote to calculate the sum of primes below 2 million, but it is tediously slow. I am curious about what makes it so slow. My theory is that copying the filtered array is ...
29 views

### Multiple rusty Sieves of Eratosthenes

To get more familiar with the multi-threading aspects in the Rust language I decided to multi-thread my earlier implementation of The rusty Sieve of Eratosthenes. I have to say that it is probably in ...
63 views

### Symmetry analysis for atom arrangements in a crystal

For a while now I've been meaning to post some of my Haskell code here so that someone can tell me what parts of the language/base library I've been completely overlooking. This is the first thing I'...
119 views

### Number of divisors of a factorial

I was solving the DIVFACT problem from Sphere Online Judge: Given a number, find the total number of divisors of the factorial of the number. Since the answer can be very large, print the answer ...
79 views

### SICP exercise 1.28 - miller-rabin primality test

From SICP Exercise 1.28: One variant of the Fermat test that cannot be fooled is called the Miller-Rabin test (Miller 1976; Rabin 1980). This starts from an alternate form of Fermat’s Little ...
64 views

### Fast nth prime in Python using trial division

I'm trying to speed this code up for larger values of N. Any suggestions? I'd like to stick to this implementation and not move on to something more complex like numpy or sieves. Is there any low ...
110 views

### The rusty Sieve of Eratosthenes

To get familiar with the Rust language I've decided to implement the method of Sieve of Eratosthenes to find primes up to a number N. I have created the following code that both prints the prime ...
252 views

### Printing all prime factors of a number input by the user

I just started teaching myself to code a few days ago using the Euler problems. I finished a variant of problem 3: print the prime factors of a number input by the user. I just want feedback and code ...
111 views

### Primes & Squares

Codeforces #230B Question Whether a number has exactly three factors. (i.e. 1, itself and its square root, thus squares of primes) [Time limit is 2 sec, Memory 256 MB] Input Number of testcases, n ...
94 views

### Counting the number of primes in C and C++11

I found this old piece of code that I wrote while I was learning C a while back: ...
37 views

### Writing a Rustic segmented prime number sieve

I wrote a prime number sieve in Ruby last year as part of a coding challenge, but lately I wanted to port it to Rust. I finally got around to it, but it's still intensely Rubinic. Before I take the ...
69 views

51 views

### Segmented Sieve of Eratosthenes in Scala

I'm trying to solve PRIME1 in SPOJ with the following Scala snippet: Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between ...
116 views

### Lazy prime number generator

There are multiple Project Euler problems (e.g. 7, 10) that deal with prime numbers. I decided make a reusable solution that could be used for most of them. I wrote a method to generate an infinite* ...
118 views

### Prime multiplication table

I am new to Ruby (1 year as hobby project on weekends) and solved a code challenge and it was not as good as they wanted. I want to know how i could make it better and how to make the structure better....
123 views

### Counting primes less than n

The following code was written to be a submission to this challenge on PPCG. It uses this algorithm, the Meissal-Lehmer method. I follow the Wikipedia entry pretty naively, except I tried to memoize ...
858 views

### Fast Number Factorization in Python

Here's my implementation to factorize a positive integer: ...
435 views

### Prime factorization of a natural number greater than 1

I am a math student who just started learning Java a week ago. I want to write a program in Java that return a prime factorization of any natural number greater than one. After spending some time ...
103 views

### Computing the divisor sum in bulk without division, multiplication or factorisation (SPOJ DIVSUM)

SPOJ problem #0074 DIVSUM - Divisor Summation requires computing the sums of proper divisors in bulk (200000 test cases, time limit 3 seconds): Given a natural number n (1 <= n <= 500000), ...
209 views

### Finding the 10001st prime in C#

In an effort to learn C# / improve my coding skills, I've started working on the Project Euler problems. I see that I may have been overthinking things a bit after finishing problem 7: By listing ...