# Questions tagged [primes]

For challenges about identifying and manipulating prime numbers

265 questions
Filter by
Sorted by
Tagged with
1k views

### A083569: Smallest m not occurring earlier such that m+n is prime

Define a 1-indexed sequence as follows: A083569(1) = 1 A083569(n) where n is an integer ...
1k views

### Prime containment numbers (speed edition)

This is sequence A054261 The $n$th prime containment number is the lowest number which contains the first $n$ prime numbers as substrings. For example, the number $235$ is the lowest number ...
1k views

### Approximate Brun's Constant

Brun's constant is the value to which the sum of the reciprocals of twin prime pairs (1/p and 1/(p+2) where ...
1k views

### Counting +1 primes

Define that the natural number p is a +1 prime of the natural number n if p is a prime number and the standard binary representation (i.e., without leading zeroes) of p can be obtained by adding (i.e.,...
2k views

### Concatenating Primes

Challenge: You are given a string containing only digits. Your task is to output the minimum number of primes which must be concatenated to form the string. If this is impossible, output ...
1k views

### Sum pyramid of primes

Given a number N, the challenge is to get the sum of the pyramid of N primes. To clarify things, here is an example: Input: 4 We will list the first ...
3k views

### Bertrand's Primes

Bertrand's Postulate states that for every integer n ≥ 1 there is at least one prime p such that n < p ≤ 2n. In order to verify this theorem for n < 4000 ...
2k views

### Climb a step to a prime

The title of Numberphile's newest video, 13532385396179, is a fixed point of the following function f on the positive integers: Let n be a positive integer. Write the prime factorization in the ...
6k views

### Can even numbers become prime?

The Sequence Everyone knows the only even prime number is 2. Ho-hum. But, there are certain even numbers n where, when ...
2k views

### Magnanimous numbers

Given an positive integer as input determine if it is a magnanimous number. A magnanimous number is a number such that any insertion of a + sign between any two ...
2k views

### The Solitude of Prime Numbers

Recently I read the novel "The Solitude of Prime Numbers" where the main characters are somewhat compared to twin prime numbers ("always together, but never touching"). A twin prime is a prime ...
901 views

### Can a neural network recognize primes?

Background Recognizing primality seems like a poor fit for (artificial) neural networks. However, the universal approximation theorem states that neural networks can approximate any continuous ...
3k views

### The Möbius Function

The Möbius Function The Möbius function is an important number theoretic function. Your submission should accept a positive integer n and return the value of the ...
2k views

### Find the Maximal Prime Powers

A prime power is a positive integer n that can be written in the form n = pk where p is a prime and k is a positive integer. For example, some prime powers are ...
2k views

### Primes with prime bit-counts

Task Find all the non-negative integers up to and including a given non-zero positive integer n, that are prime and the count of 1's and ...
4k views

### Do I have a prime twin?

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and ...
1k views

### Find the nth Fibohexaprime

The challenge this time is to find the nth Fibohexaprime. The definition of a Fibohexaprime is as following: We first observe a list with Fibonacci numbers: ...
3k views

### Reuse your code!

In this challenge we try to solve two important problems at once. They are: Given integers a and b, tell if ab-1 is a prime number. Given integers a and b, return nCr(a, b). Specifically, you must ...
2k views

### Prime Time Travel

Don't tell anyone, but I've nicked my uncle's time travel machine! My uncle is obsessed with prime numbers, though, and that shows in the machine — he has programmed it so that it can only go to dates ...
338 views

### It's factors all the way down!

This challenge is inspired by this fantastic animated diagram (thanks to flawr for posting it in chat). Given an input n, draw all of its prime factors as nested ...
9k views

### List Prime Numbers [duplicate]

Introduction Prime numbers are simple, right? Well, now you get your chance to find out! Challenge You must write a program or function that takes an input n and ...
2k views

### Is it a super-prime?

Background A super-prime is a prime number whose index in the list of all primes is also prime. The sequence looks like this: 3, 5, 11, 17, 31, 41, 59, 67, 83, 109, 127, 157, 179, 191, ... This ...
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

### Prime Wednesdays

Prime Wednesdays Your task is to count the number of Wednesdays that fall on a prime day of the month in a particular year. For instance, 7-13-16 is a prime ...
2k views

### Largest Prime Exponents

Given an integer n >= 2, output the largest exponent in its prime factorization. This is OEIS sequence A051903. Example Let ...
2k views

### Is this a consecutive-prime/constant-exponent number?

A while ago, I had a look at the prime factorization of 27000: 27000 = 23 × 33 × 53 There are two special things about that: consecutive-prime: The primes are consecutive: 2 is the ...
2k views

### Sort a number's divisors by prime factorization

Given an input of an integer ≥ 2, output a list of its divisors sorted by the exponents in their prime factorizations, in ascending order, ordering first by the largest prime, then by the second ...
2k views

### Triangular Ulam spiral

We've had a couple of challenges about the Ulam spiral. But that's not enough. In this challenge we will plot a triangular Ulam spiral (as opposed to the usual, square Ulam spiral). Here's a sketch ...
893 views

### Fastest Home Prime Generator

What is a home prime? For an example, take HP(4). First, find the prime factors. The prime factors of 4 (in numerical order from least to greatest, always) are 2, 2. Take those factors as a literal ...
2k views

### Factoring a 64-bit integer

Write a GOLF assembly program that reads an integer from stdin (followed by a trailing newline), and outputs its prime factors seperated by newlines, followed by a trailing newline on stdout. The ...
1k views

### A prime test that's LITERALLY prime

Write a program that will test the primality of a specified number, and give the output as a Boolean value (True is prime). Your prime test can (but doesn't have to) be valid for the number 1. Here'...
1k views

### Combinatorial products of unique primes

Statement of problem Given a set of unique, consecutive primes (not necessarily including 2), generate the products of all combinations of first powers of these primes — e.g., no repeats — and also 1....
2k views

### Get thee behind me Satan-Prime!

Satan-Primes who are they? they are Primes containing 666 these are Satan-Primes:...
2k views

### Prime containment numbers (golf edition)

This is sequence A054261. The $n$th prime containment number is the lowest number which contains the first $n$ prime numbers as substrings. For example, the number $235$ is the lowest number ...
1k views

### Prime factors buddies

Given an integer N > 1, output all other numbers which prime decompositions have the same digits as the prime decomposition of ...
3k views

### Find the largest fragile prime

Consider the function Remove(n, startIndex, count) that removes count digits from the number ...
3k views

### Finding prime numbers without using “prime characters”

Your task, if you choose to accept it, is to write a program/function that accepts an integer N as input. The program/function should output/return a list of the first N prime numbers. But here's the ...
768 views

### Is my number Unique

In this challenge we learned a way to encode every positive integer using factor trees. Here is how it works: The empty string has value of 1. (S) where ...
1k views

### Finding Lonely Primes

Lonely primes (as I call them) are primes, where given a number grid with width w ≥ 3, are primes which do not have any other primes adjacent to them orthogonally ...
Given a natural number $n$, return the $n$-th cuban prime. Cuban Primes A cuban prime is a prime number of the form $$p = \frac{x^3-y^3}{x-y}$$ where $y>0$ and $x = 1+y$ or $x = 2+y$ ...