# Questions tagged [math]

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

1,823 questions
Filter by
Sorted by
Tagged with
1k views

### How many ways can you make change?

The "third type of Euler Transform" takes an integer sequence that gives the number of objects of a given weight and outputs a sequences that gives the number of multisets of objects that ...
• 8,811
1k views

### Calculate the sum of numbers in a rectangle

Aim Consider this infinite array of numbers: ...
595 views

### Sum-of-four-squares grid

Output a grid of characters visualizing the decomposition of a number into a sum of four perfect squares. Challenge Given a nonnegative integer $0 \le n \le 2^{30}$, output a $2^k \times 2^k$ ...
• 3,628
2k views

### Shift right by half a trit

Shift right by half a trit This is inspired by Shift right by half a bit, but it's a little different. Motivation I was wondering if there is a function f that maps ...
2k views

### Cubic Concatenation

Challenge Given three non-negative integers $a, b$ and $c$, decide if the sum of their cubes is equal to the concatenation of those numbers, aka: $$a^{3}+b^{3}+c^{3} = a^\frown b ^\frown c$$ ...
• 469
246 views

### Counterexample to Shapiro inequality

Input: A positive integer n such that n is even and greater than 12 or n is odd and greater than 23. Output: A list of non-negative integers that violates Shapiro inequality. More precisely, Let s be ...
565 views

### Rabinowitz-Wagon $\pi$ formula

In 1995, Stanley Rabinowitz and Stan Wagon found an interesting algorithm to generate the digits of $\pi$ one by one without storing the previous results. The algorithm is called the spigot ...
• 49.3k
748 views

• 6,299
2k views

### Reduce a string up to idempotency [closed]

Objective Given a string consisting of printable ASCII characters (!0x21 ― ~0x7E), treat it as an element in the free idempotent ...
• 6,299
626 views

### Compute Dickman

Input A floating point number $x$ between 1 and 8 inclusive. Output The Dickman function of $x$. The Dickman–de Bruijn function $\rho(u)$ is a continuous function that satisfies the delay ...
• 3,143
717 views

### Minimum number of select-all/copy/paste steps for a string containing n copies of the original

This challenge is based on this Mathematics answer. Write the shortest program or function that, when given some natural number $n$, outputs $S(n)$, which is the minimum number of steps for ...
• 10.4k
2k views

### Find 10 float64s that give the least accurate sum

Input Integer $n > 1$ Output Ten 64 bit floating point numbers between $-n$ and $n$, inclusive, whose sum is the least accurate. Details and examples. These examples are not claimed to be ...
• 3,143
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 ...
• 49.3k
351 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 ...
• 10.4k
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
485 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 ...
804 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 (...
• 78.2k
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,694
2k views

• 211
828 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,660
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 ...
• 78.2k
686 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 ...
414 views

• 2,279
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 ...
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,225
1k views

• 78.2k
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 ...
• 475
974 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
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,279
1k views

• 3,143
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. ...
• 4,215
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,279
1 vote
562 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,143
5k views

### Calculate 500 digits of e [duplicate]

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,143