# Questions tagged [math]

The challenge involves mathematics in some central way. Also consider using more specific tags, listed in the tag wiki info.

1,652 questions
Filter by
Sorted by
Tagged with
128 views

### Sample space of n consecutive coin flips [duplicate]

Taking a positive integer n as input, print the sample space of n consecutive coin flips. The coin is fair, with two sides ...
• 301
726 views

### Equalizing fractions

When I was in grade 3, we were taught how to solve a very simple math problem. It was equaling the denominators of two or more fractions. Let's take two proper fractions:- $$\frac{1}{2},\frac{2}{3}$$...
• 12k
542 views

### Sticky polyhexes

Background A polyhex of size $n$ is a contiguous shape made from joining $n$ unit regular hexagons side-by-side. As an example, the following image (from Wikipedia) contains all 7 distinct ...
• 64.8k
1k views

### Check B-powersmoothness

from Wikipedia, a number is called B-powersmooth if all prime powers $p^v$ that divide the number satisfy $p^v \leq B$. B-powersmoothness is important, for example, for Pollard's p-1 factorization ...
• 4,237
352 views

### Average impact of multiple conversion errors

Imagine four people stand in a line. The first looks at a thermometer, and tells the temperature to the person on their right. This continues down the line, until the last person writes the ...
• 17.6k
2k views

### Calculate the probability of getting to the target first (exactly)

Consider the following probability puzzle. We start with a string of bits all set to 0. At each step we choose a bit uniformly and independently at random and flip it. The value your code has to ...
1k views

### Convert a decimal to a fraction, approximately

Take the decimal number $0.70710678$. As a fraction, it'd be $\frac{70710678}{100000000}$, which simplifies to $\frac{35355339}{50000000}$. If you were to make the denominator $1$, the closest ...
• 17.6k
683 views

### Finding Distant Primes

Let us call a prime $p$ an $(m,k)$-distant prime $(m \ge 0, k \ge 1, m,k \in\mathbb{Z})$ if there exists a power of $k$, say $k^x (x \ge 0, x \in\mathbb{Z})$, such that $|k^x-p| = m.$ For ...
• 4,920
215 views

### Network wide reputation survey

Given a PPCG user's user ID, calculate how much times is their Each SE site reputation is from average reputation in the Stack exchange sites they have made accounts. Let me explain, If someone's ...
• 12k
356 views

973 views

• 9,486
5k views

### Infinitely many ℕ

Background: A sequence of infinite naturals is a sequence that contains every natural number infinitely many times. To clarify, every number must be printed multiple times! The Challenge: Output a ...
• 503
2k views

### Find distance between the closest 3D points

Your task is to take $n \ge 2$ points in 3D space, represented as 3 floating point values, and output the Euclidean distance between the two closest points. For example A = (0, 0, 0) \\ B = (1, 1, ...
• 387
1k views

### All-inclusive semi-primes

$723 = 3 \times 241$ is a semi-prime (the product of two primes) whose prime factors include all digits from $1$ to $n$, where $n$ is the total number of digits between them. Another way to ...
132 views

### Dobble Double Challenge [closed]

I have a problem, which I haven't found a solution for. Solutions to the first part are well documented, but I have yet to find anyone who has solved the second part. I call this the "Dobble"...
• 121
A narcissistic number is a natural number which is equal to the sum of its digits when each digit is taken to the power of the number digits. For example $8208 = 8^4 + 2^4 + 0^4 + 8^4$, so is ...