Skip to main content

Questions tagged [primes]

For challenges about identifying and manipulating prime numbers

Filter by
Sorted by
Tagged with
8 votes
4 answers
667 views

Objective Given a prime number \$p\$ and an integer \$n \geq 2\$, find a degree-\$n\$ primitive polynomial modulo \$p\$. Mathematical explanation When we perform "modular arithmetic" over ...
Dannyu NDos's user avatar
  • 7,381
2 votes
13 answers
688 views

Task: Write a code golf program that, given two positive integers n and m, returns a list of the distances between consecutive prime numbers in the range [n, m] ...
JuanCa's user avatar
  • 361
13 votes
18 answers
2k views

A046386 is the sequence of all natural numbers that are the product of exactly 4 distinct primes. Write the shortest program, function, or code snippet, that, when given a natural number, outputs ...
bigyihsuan's user avatar
  • 11.5k
4 votes
4 answers
592 views

Your task is to find a boolean expression that uses AND (\$\land\$), OR (\$\lor\$), XOR (\$\oplus\$), and NOT (\$\lnot\$) operators and binary digit positions (\$d_1,d_2,d_3,d_4,d_5,d_6,d_7,d_8,d_9,d_{...
Fmbalbuena's user avatar
  • 5,105
8 votes
19 answers
4k views

Related, but not dupe (Asking about the n-th k-smooth number whereas I'm only asking if a certain number is 5-smooth.)Source: Partially inspired by Leetcode's 5-smooth Number problem, but partially ...
CrSb0001's user avatar
  • 867
17 votes
10 answers
2k views

This is the outline of this challenge: Every number greater than or equal to two has a prime factorization. A prime factorization can be represented as a bar graph. Every bar graph has a water ...
Sophia Antipolis's user avatar
11 votes
10 answers
2k views

Let p, q, and c := (p + q)"q (where " denotes concatenation) be positive integers such that p and c are primes and q is the smallest prime such that c is prime. Such a prime triple (p, q, (p ...
Sophia Antipolis's user avatar
15 votes
10 answers
1k views

Sylvester's sequence can be defined recursively S(n) = S(n-1)*(S(n-1) + 1) for n >= 1 starting S(0) = 1. Since S(n) and S(n) + 1 have no common divisors, it follows that S(n) has at least one more ...
Sophia Antipolis's user avatar
13 votes
8 answers
1k views

The challenge is simple: Reorder the first integers {0, 1, 2, ..., n} into an ordered list so that the following three conditions are met: If k is the last element in the list, then all of its prime ...
Carl's user avatar
  • 251
13 votes
12 answers
2k views

Given a prime number \$p\$ output the asymptotic density of the set of positive integers which have \$p\$ as their second-smallest distinct prime factor Input/Output Input: one of the following ...
Mukundan314's user avatar
  • 13.7k
10 votes
6 answers
1k views

Following the great advice (what do you mean it's not advice?!) on Adding unnecessary fluff we can devise the following task: Take a list of positive integers and a positive integer \$m\$ as input. ...
Command Master's user avatar
9 votes
21 answers
2k views

Problem You've stumbled upon a paradoxical mathematical phenomenon related to prime numbers. Consider the following scenario: You have an infinite list of prime numbers: $$2, 3, 5, 7, 11, 13, 17, 19, ....
3.14's user avatar
  • 403
8 votes
8 answers
483 views

This challenge was originally posted on codidact. Given a number \$n \geq 3\$ as input output the smallest number \$k\$ such that the modular residues of \$k\$ by the first \$n\$ primes is exactly \$\...
Wheat Wizard's user avatar
  • 103k
11 votes
12 answers
1k views

We've had powerful numbers, yes, but what about highly powerful numbers? Highly powerful numbers Let \$n\$ be a positive integer in the form $$n = p_1^{e_{p_1}(n)}p_2^{e_{p_2}(n)}\cdots p_k^{e_{p_k}(n)...
caird coinheringaahing's user avatar
6 votes
19 answers
2k views

Input An integer \$n\$ greater than or equal to 1. Output The number of bits in the binary representation of the integer that is the product of the first \$n\$ primes. Example The product of the first ...
Simd's user avatar
  • 3,167

15 30 50 per page
1
2 3 4 5
24