# Questions tagged [math]

The challenge involves mathematics. Also consider using more specific tags: [number] [number-theory] [arithmetic] [combinatorics] [graph-theory] [geometry] [abstract-algebra].

1,283 questions
163 views

### Make Three from One [duplicate]

Given a single digit integer and a three digit integer, output a mathematical formula that uses only the single digit and a given list of operators to equal the three digit integer. Input: A one ...
204 views

### Find the longest uninterrupted arc in N dimensions

See similar question for 2D case: Find the longest uninterrupted arc The challenge here is to find the longest uninterruped great circle arc around a unit hypersphere in N dimensions, with a random ...
340 views

### Find the longest uninterrupted arc

The challenge here is to find the longest uninterruped arc around a unit circle with a random amount of points distributed in random positions around it. Here is a diagram to assist my explanation: ...
1k views

### Golfing out the haters

The setup: A social network reports the number of votes a post has in two ways: the number of net upvotes (total upvotes - total downvotes), and the % of votes that were upvotes, rounded to the ...
2k views

### Sign-Swapping Sums

Given a nonempty list of positive integers $(x, y, z, \dots)$, your job is to determine the number of unique values of $\pm x \pm y \pm z \pm \dots$ For example, consider the list $(1, 2, 2)$. ...
1k views

### Nim Multiplication

Background If you do much code golfing, you're likely aware of the bitwise XOR operation. Given two integers, it gives another integer with 1s in the bits where ...
3k views

### Bringing a pair of integers to equality

This was inspired by a math problem I saw somewhere on the internet but do not remember where (UPDATE: The original problem was found on the math riddles subreddit with a proof provided that it is ...
611 views

### What's in my pasta sauce?

Background In France, and probably in the rest of the European Union, any food available for sale must list the ingredients that compose it on its packaging, in weight percentage descending order. ...
2k views

### Prime or highest factor

Challenge: Given an array of non-negative whole numbers numbers in the range of 0 to Infinity, Check whether all of them are primes or not. (You can take input as ...
2k views

### Is this a staircase number?

Challenge : Check if the given number forms a number staircase or not Input : A integer (greater than 0 and not decimal). NOTE : You can take input as string , ...
815 views

### Return the highest possible placement value based on the input

Introduction The challenge itself was something I came across and had to try and figure out for a personal of project of mine. I ended up branching out and asking family members if they could provide ...
2k views

### Triangular Lattice Points close to the Origin

Background A triangular grid is a grid formed by tiling the plane regularly with equilateral triangles of side length 1. The picture below is an example of a triangular grid. A triangular lattice ...
1k views

### Golf me the Schlosberg Numbers

Schlosberg Numbers In issue 5 of Mathematical Reflections, Dorin Andrica proposed the problem of characterising the positive integers n such that is an even integer. Eight people submitted ...
331 views

### Sum power of digits

Challenge : Given two non-negative integers (X and Y > 1) calculate the sum of digits of their powers . i.e : sum of digits of ...
1k views

### Am I a Pillai prime?

A Pillai prime is a prime number $p$ for which there exists some positive $m$ such that $(m! + 1) \equiv 0 \:(\text{mod } p)$ and $p \not\equiv 1\:(\text{mod }m)$. In other words, an ...
2k views

### Simple golfing interpreter

Challenge: Your job is to create a simple interpreter for a simple golfing language. Input: Input will be in the form of string separated by spaces. You can replace space separation with what you ...
5k views

### Detect heat waves

Background The Royal Netherlands Meteorological Institute defines a heat wave* as a series of at least 5 consecutive days of ≥25°C weather (“summery weather”), such that at least 3 of ...
1k views

### Simple Factorial Challenge [duplicate]

In light of today's date... A factorial of a number n, is the product of all the numbers from 1 to n inclusive. The Challenge Given an integer n where 0 <= n <= 420, find the sum of the ...
2k views

### Conway's Prime Game

Specifically, Conway's PRIMEGAME. This is an algorithm devised by John H. Conway to generate primes using a sequence of 14 rational numbers: ...
3k views

### Integer logarithms

Given integers N , P > 1 , find the largest integer M such that P ^ M ≤ N. I/O: Input ...
427 views

### Polynomial -> Integrate

Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1, variables, and definite integrals. For example, -...
842 views

### Solve for N from input string

Challenge : Your job is to find the given number N. Input : You will be given a string in the following form: dN ± Y = X ...
1k views

### Rotational Average

Given an input integer n >= 10, output the average of all deduplicated rotations of the integer. For example, for input 123, ...
1k views

### Circle intersection area

Description : Given x and y positions of two circles along with their radii, output the ...
70 views

### Generate lowest degree polynomial from sequence [duplicate]

Introduction A sequence of numbers is passed in as the input. The program has to generate the lowest degree polynomial possible. This was my first programming project in college and it would be ...
2k views

### Generate a Walsh Matrix

A Walsh matrix is a special kind of square matrix with applications in quantum computing (and probably elsewhere, but I only care about quantum computing). Properties of Walsh matrices The ...
587 views

### XOR reduction bools

Description : Given a string of space separated binary digits or space separated booleans or an array of binary digits or array of booleans . Your job is to find the xor of each until you end up with ...
333 views

### Conway's game of life [duplicate]

Description : Given an array of strings representing a grid of cells With the key : 0 = 'dead cell' 1 = 'live cell' write a function that returns the next ...
150 views

### Return closest to zero [duplicate]

Description : You are given a string of numbers (positive and negative but not decimals) along with the number of entries like so. Like so 8 '1 2 5 0 7 -9 12 -8'...
3k views

### Distance between the Sun and the nth planet

Challenge Predict the distance between the Sun and the nth planet when using any formula that gives the same result as the Titius–Bode law: d=(3*2^n+4)/10. BUT ...
2k views

### Distance between two points on the Moon

Given latitude/longitude of two points on the Moon (lat1, lon1) and (lat2, lon2), compute the distance between the two points in ...
4k views

### Zero-sum counting

Write a program or function that given n ≥ 1 returns the number of solutions to ±1 ± 2 ± 3 ± ... ± n = 0. For n = 6 there are no solutions, so the answer is 0. For n = 4 there are ...
2k views

### 1, 2, 3, 14… or is it 15?

A well known song by the Irish rock band U2 starts with the singer Bono saying "1, 2, 3, 14" in Spanish ("uno, dos, tres, catorce"). There are various theories as to the significance of those numbers....
459 views

### Output numbers, more or less

The Challenge Given an input string (or array) consisting of < and >, output a sequence (array or string) of integers ...
317 views

### Permutations such that no k+2 points fall on any polynomial of degree k

Description Let a permutation of the integers {1, 2, ..., n} be called minimally interpolable if no set of k+2 points (together ...
243 views

### Work out root(x, n)

Given integers 0<x<10106 and 0<n<106, work out x(1/n) under 15 seconds(TIO or your computer), 1GB memory. You can assume the result is integer smaller than 50000. Shortest code in bytes ...
3k views

### Two steps forward and one step back

Let's say I'm ten steps away from my destination. I walk there following the old saying, "Two steps forward and one step back". I take two steps forward, one back, until I'm standing exactly on my ...
436 views

### Minimize Least Used Binary Bits in Fractions

Introduction For a given rational number r, find a pair of integers p,q so that p/q=r and ...
309 views

### Finite Field Multiplication

Overview Given the integer representation of three elements in GF(2^64), give the product of the first two elements over GF(2^64) with the reducing polynomial defined as the polynomial m such that m(...
5k views

### Am I a Self Number?

A self number (also called a Colombian or Devlali number) is a natural number, x, where the equation ...
2k views

### What is my exponential potential?

We'll define the N-exponential potential of a positive integer M as the count of prefixes of MN that are perfect N-powers. The prefixes of an integer are all the contiguous subsequences of digits ...
757 views

### Euler-Poincaré-Characteristic of Polyhedra

Given a triangulation of the surface of a polyhedron p, calculate its Euler-Poincaré-Characteristic χ(p) = V-E+F, where ...
185 views

### Print the positive non-zero integer n-tuple(s) that solve an inequality within a bound

Suppose I have a linear inequality like x0A0 + x1A1 + ... + xnAn <= C with xi a non-zero positive integer and Ai and C a positive non-zero multiple of 0.01. ...
156 views

### Calculate the Peirce quincuncial projection of the Earth [closed]

The Peirce quincuncial projection is pretty neat. It actually tessellates the whole plane: Your job is to generate this map projection. To simplify things, you will only need to generate the ...
275 views

### Decompose Polynomials

Given an integral polynomial of degree strictly greater than one, completely decompose it into a composition of integral polynomials of degree strictly greater than one. Details An integral ...
1k views

### Is this a truncated triangular number?

Related OEIS sequence: A008867 Truncated triangular number A common property of triangular numbers is that they can be arranged in a triangle. For instance, take 21 and arrange into a triangle of <...
626 views

### Sparse Protractor

Given some positive integer n, design a protractor with the fewest number of marks that lets you measure all angles that are an integral multiple of ...
248 views

### Stereographic projection of polyhedra

You will create a program that generates the stereographic projection of polyhedra. In particular, to keep things simple, we'll only focus on n-chamfered dodecahedron. Given a natural number ...