# Questions tagged [primes]

For challenges about identifying and manipulating prime numbers

265 questions
Filter by
Sorted by
Tagged with
3k views

### Generate Sexy Primes

Sexy Primes are pairs of numbers (n, m) such as n and m both are prime, and ...
32k views

### List of first n prime numbers most efficiently and in shortest code [closed]

Rules are simple: First n primes (not primes below n), should be printed to standard output separated by newlines (primes should be generated within the code) primes cannot be generated by an inbuilt ...
11k views

### List of primes under a million

This is my first code golf question, and a very simple one at that, so I apologise in advance if I may have broken any community guidelines. The task is to print out, in ascending order, all of the ...
1k views

### Sum of (at most) 5 primes

Terence Tao recently proved a weak form of Goldbach's conjecture! Let's exploit it! Given an odd integer n > 1, write n as ...
1k views

### Return the first N primes

With a twist; your algorithm has to be less complex than O(X2) where X is the Nth prime. Your solution post should include the character count and the theoretical complexity in terms of X (or N, which ...
2k views

### Finding Not-Quite-Prime Numbers

Your challenge, should you chose to accept it, is to code-golf a function that returns true or false (or some similar meaningful representation of yes and no) if a number meets the following criteria: ...
1k views

### Show Ulam's spiral

Similar to this but in this one you need to write spiral starting from the center where: space means composite number .(dot) means prime number. Size of the ...
2k views

### Find 10 large prime numbers with n digits

You are given n (200 ≤ n < 250) as a command line argument. Print 10 prime numbers with n digits. Your program should run under 1s and must be shorter than 5000 bytes (excluding). Sum the ...
561 views

### The Prime Grid Game

I had fun solving this, so I offer this golf challenge. The objective of this golf is to find the largest prime number that can be constructed using the given instructions. You should accept 3x3 ...
2k views

### Code-Challenge:The Nearest Prime

Challenge In this task you would be given an integer N you have to output the nearest prime to the integer. If the number is prime itself output the number. The input N is given in a single ...
3k views

### Find the prime factors

In this task, you have to write a program, that computes the prime factors of a number. The input is a natural number 1 < n < 2^32. The output is a list of the prime factors of the number in the ...
2k views

### What is the average of n, the closest prime to n, the square of n and the closest Fibonacci number to n?

This is a math problem which takes quite many things into question, making it rather challenging, and as you might have guessed, it's a code golf, so it should be as short as possible as well. The ...
1k views

### Find prime factors [duplicate]

A whole program to find the prime factors of a given number. The number will be given on standard input.