Skip to main content

# Questions tagged [math]

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

1,811 questions
Filter by
Sorted by
Tagged with
13 votes
9 answers
1k views

### Sum of square roots (as an algebraic number)

An algebraic number is a number that is a root of a non-zero polynomial with integer coefficients. It is well-known that the sum of two algebraic numbers is algebraic. In particular, the sum of a list ...
• 48.6k
3 votes
7 answers
310 views

### Find the most isolated point

Given two non-empty sets of points $P,T = \{(x,y)\ |\ x,y \in \mathbb{Z} \}$, find the point $p \in P$ such that it is the "most isolated" from all points in $T$. The "most ...
• 9,796
13 votes
13 answers
2k views

### Compute the degree of a string

The input is a string made of the letters a,b,c only. The output is an integer representing the degree of the sequence. The degree of a sequence is computed as follows: Assume that each of the ...
• 1,993
8 votes
4 answers
458 views

### How far are you?

Write a program that gets coordinates of two objects on Earth, and calculates how far they are from each other directly in space (a straight line through Earth) and on the surface (through the ...
13 votes
11 answers
788 views

### *Trivial* near-repdigit perfect powers

Task Output the sequence that precisely consists of the following integers in increasing order: the 2nd and higher powers of 10 ($10^i$ where $i \ge 2$), the squares of powers of 10 times 2 or 3 (...
• 77k
16 votes
19 answers
1k views

### Infer pluses and minuses

The problem Consider an equation such as      "3 ± 2 ± 4 ± 1 = 4"      and determine if there exists a sequence of pluses and minuses that makes it arithmetically correct. If it exists, ...
• 3,685
25 votes
14 answers
2k views

• 211
15 votes
12 answers
826 views

### Sum up snail number neighbours

Input: You are given two numbers n and m. Create the snail: Given an n >= 3, fill an <...
• 2,580
14 votes
13 answers
1k views

### Counting rankings

There is a competition with $n$ participants in total. Alice is one of the participants. The outcome of the competition is given as a ranking per participant with a possibility of ties; e.g. there ...
• 77k
3 votes
4 answers
674 views

### Fastest count of certain hypercubes with labeled vertices

CHALLENGE This is a fastest-code challenge. Count how many n-dimensional hypercubes with n=1,2,3,4 exist, with vertices labeled with either 1 or 0, such that there does not exist any rectangle formed ...
4 votes
5 answers
402 views

• 2,213
-2 votes
8 answers
1k views

### Number of cigarettes that can be made from a given number of butts

Assumption A cigarette can be made by combining four cigarette butts. Cigarette butts last infinitely until smoked. Explanation Say you have 31 butts. That means, you can make 7 cigarettes from 28 ...
13 votes
20 answers
1k views

### Modular Equivalence

Given two numbers $x,y > 2, x≠y$ output all integers $m$ such that $$x + y \equiv x \cdot y \pmod m$$ $$x \cdot y > m > 2$$ Input Two integers Output A list of integers Test cases <...
• 4,135
13 votes
19 answers
1k views

• 77k
13 votes
20 answers
2k views

### Complete a Mystery Sequence

Given a sequence of three integers, determine if the sequence is arithmetic (of the form [a, a+d, a+2*d]) or geometric (of the form ...
• 313
7 votes
10 answers
964 views

### Make 1's and 2's composite

Input An integer k composed of 1 and 2, with at least 3 digits and at most 200 digits. ...
• 439
4 votes
25 answers
2k views

### Consecutive Composite Numbers

Challenge Generate $n-1$ consecutive composite numbers using this prime gap formula $$n!+2,n!+3,...,n!+n$$ Input An integer $n$ such that $3 \leq n \leq 50$. Output Sequence of $n-1$ ...
• 2,213
17 votes
19 answers
1k views

• 3,084
17 votes
21 answers
2k views

### Divmod continuously until the remainder is 1 or 0, then get the remainder

The task is simple, divide, get the quotient and the remainder, and if the remainder isn't 1 or 0, do the same thing (quotient divmod remainder) until the remainder is 1 or 0, then get the remainder. ...
• 3,867
10 votes
12 answers
1k views

### Counting Collinear Points

Given two points $(x_1, y_1)$ and $(x_2, y_2)$ with integer coordinates, calculate the number of integer points (excluding the given points) that lie on the straight line segment joining these two ...
• 2,213
1 vote
1 answer
546 views

### Where to put a circle?

Consider an $n \times n$ grid of integers which is part of an infinite grid. The top left coordinate of the $n \times n$ grid of integers is $(0, 0)$. The task is to find a circle which when ...
• 3,084
11 votes
20 answers
5k views

### Calculate 500 digits of e

Write a program to calculate the first 500 digits of the mathematical constant e, meeting the rules below: It cannot include "e", "math.e" or similar e constants, nor may it call ...
• 3,084
9 votes
3 answers
477 views

### Coin sequence probability

Given two strings containing only 0 and 1, decide the probability that first appears earlier as a consecutive substring in an ...
• 24.5k
16 votes
2 answers
590 views

### Construct this point

Given a constructible point $(x, y) \in \mathbb R^2$, output the steps required to construct $(x, y)$ Constructing a point Consider the following "construction" of a point \\$(\alpha, \...
19 votes
9 answers
985 views

### Output an infinitely proportional sequence

In this challenge, an infinitely proportional sequence is defined as a infinite sequence of positive integers such that: All positive integers are contained infinitely many times within the sequence. ...
• 38.8k
7 votes
3 answers
209 views

### Inscribe a maximal regular polygon into a square image

You want to draw a regular polygon but you have limited space! In this challenge, you should draw a polygon with n sides which is as big as possible for a given square container image. I found ...
• 13.7k
18 votes
24 answers
2k views

### Test whether a sequence is bitonic

You know what a monotonic sequence is: each element is bigger than its predecessor (monotonically rising) or as its successor (monotonically falling). Bitonic means you have two arms of the sequence, ...
• 2,580
13 votes
7 answers
2k views

### Auto-golf an esolang

The lack of a social life drove a poor nerd into inventing another superfluous esolang called !+~%. For no good reason it initializes the accumulator with ...
• 2,580
-2 votes
11 answers
611 views

### Print 100 digits of Champernowne's Constant

Inspired by this and this question Challenge Your challenge is to print any 100 consecutive digits of Champernowne's Constant. You must give the index at which that subsequence appears. The 0 at the ...
• 411
14 votes
17 answers
3k views

### What's the character limit of this text field? [duplicate]

Someone I know has no coding experience, but has proposed an algorithm* to determine the character limit of text fields they find online. They copy a string containing the numbers from 1 to 1,000 ...
• 653
10 votes
7 answers
1k views

### Night hike partitioning

We want to go on a night hike with the youth group, but of course not everyone has their torch, even though we told them we planned to split up. What options are there for group formation if n teens ...
• 2,580
16 votes
16 answers
4k views

### Which skill to train?

Story (skip, if you prefer the naked task): You need five skills for an imaginary sport: Speed, strength, endurance, accuracy and tactics. If you achieve a score in each of these disciplines, you can ...
• 2,580
4 votes
1 answer
220 views

### Convert real numbers between factoradic and positive integer bases

This prompt asked you to convert back and forth to factoradic, but is very limited in scope (only decimal integers from 0 to 10!-1). Your task in this challenge is to reach just a bit further and ...
• 643
1 vote
0 answers
158 views

### Produce a secure block cipher round function (1 bit round key; 7 bit message) [closed]

We need to produce a block cipher round function with a 1 bit round key size and a 7 bit message size with the highest level of cryptographic security according to our measure of security. ...
9 votes
8 answers
686 views

### Produce the shortest suffix for an (almost) arbitrary string

I encountered some silly code from a game and I figured this would actually turn into a fun golfing problem, so: Given any ASCII string in the limited char range specified below. Append as few ...
• 199