# Questions tagged [math]

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

1,293 questions
Filter by
Sorted by
Tagged with
15answers
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 ...
14answers
758 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 ...
1answer
187 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. ...
0answers
159 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 ...
2answers
278 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 ...
14answers
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 <...
5answers
629 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 ...
1answer
254 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 ...
8answers
2k views

### Calculate the Hafnian as quickly as possible

The challenge is to write the fastest code possible for computing the Hafnian of a matrix. The Hafnian of a symmetric 2n-by-2n ...
13answers
2k views

### Codegolf the Hafnian

The challenge is to write codegolf for the Hafnian of a matrix. The Hafnian of an 2n-by-2n symmetric matrix ...
19answers
3k views

### Hermitian matrix?

Note that this challenge requires no handling or understanding of complex numbers. Given a non-empty square matrix where every element is a two-element (Re,Im) integer list, determine (giving any ...
10answers
1k views

### Find the dot product of Rationals

I was at a friend's house for dinner and they suggested the idea of a "Prime-factor vector space". In this space the positive integers are expressed as a vector such that the nth element in the ...
4answers
290 views

### Continued Fraction of Digit-wise Sum of Square Roots

Introduction Your task is to generate the first 1000 terms in the continued fraction representation of digit-wise sum of square root of 2 and square root of 3. In other words, produce exactly the ...
2answers
1k views

### Integer Linear Programming

Introduction Write a solver for integer linear programming. Challenge Your task is write a solver for integer linear programming (ILP). In ILP, linear inequalities of a set of unknowns (all of ...
45answers
883 views

### Quartic Summation

Guidelines Task Given two non-negative integers, find the sum of both numbers... to the power of 4. Examples 2, 3 -> 97 (2^4 + 3^4 = 97) ...
0answers
54 views

### Print Pascal's Triangle [duplicate]

Overview Pascal's triangle is the series of rows of numbers, starting with 1, where each cell is formed by summing the two above it. Here's an example. Challenge and Scoring The challenge is simple:...
3answers
634 views

### Wanna See a Card Trick? (Part I)

Amazingly, this is the easier of the three card tricks I know off the top of my head... The aim of this is to have your compiler perform a specific card trick. There's no slight of hand, and the ...
23answers
1k views

### Infer geometric sequences

Haskell has this neat(-looking) feature where you can give it three numbers and it can infer an arithmetic sequence from them. For example, [1, 3..27] is equivalent ...
0answers
66 views

### How many logs can you fit into a number? [duplicate]

Challenge Given a real number as input, calculate the number of times which the natural logarithm function ln can be applied to it before the resulting number ...
5answers
466 views

### Get Two from One

As we saw in this question complex logical statements can be expressed in terms of the simple connectives of generalized Minesweeper. However Generalized minesweeper still has redundancies. In order ...
20answers
4k views

### I want my book to be away from this table

Story So I have a book that I want to separate from my table with nothing but other books. I want to know how many books do I need to achieve this with $n$ book lengths. Here's a visualization ...
27answers
2k views

### Generalized matrix trace

Inspiration. Given (by any means): A two-argument (or single argument consisting of a two-element list) black box function, f: ℤ+ × ℤ+ → ℤ+ (input and output are ...
50answers
4k views

### The first n numbers without consecutive equal binary digits

The sequence contains the decimal representation of the binary numbers of the form: 10101..., where the n-th term has n bits. The sequence is probably easiest to ...
29answers
2k views

### Rotation summation

Take a square matrix containing positive integers as input, and calculate the "rotated sum" of the matrix. Rotated sum: Take the sum of the original matrix and the same matrix rotated 90, 180 and ...
22answers
3k views

### Converting ISBN-13 to ISBN-10

Introduction In this challenge your task is to generate the ISBN-10 code for books given its ISBN-13 code, assuming that such a code exists. Such an ISBN-13 code consists of several parts separated ...
5answers
861 views

### Factoring factorials

Today in my statistics class, I found that some factorials can be simplified when multiplied together! For example: 5! * 3! = 5! *3*2 = 5! *6 = 6! Your job: Given ...
4answers
229 views

### Compute number of matrices with appropriate sums

When multiplying monomials in the Milnor basis for the Steenrod algebra, part of the algorithm involves enumerating certain "allowable matrices". Given two lists of nonnegative integers r1, ... ,rm ...
16answers
872 views

### Mod 2 Multinomial coefficients

quintopia has posted here a challenge to compute multinomial coefficients (some of the text here is copied from there). There is a fun algorithm to compute multinomial coefficients mod 2. Given a ...
25answers
795 views

### Are the numbers amicable?

Two numbers are considered amicable if the proper divisor sum of the first is the same as the second number, the second number's proper divisor sum is equal to the first number, and the first and ...
62answers
3k views

### The Non-Zero Digital Product Challenge

Originally the Multiplicative digital root Challenge Basically do what the title says Method Given a positive integer 1 <= N <= 100000000 through one of our standard input methods, multiply ...
12answers
2k views

### Write numbers as a difference of Nth powers

Challenge There are many numbers which can be expressed as the difference of two squares, or as the difference of two cubes, or maybe even higher powers. Talking about squares, there are various ways ...
8answers
340 views

### Collection from a sequence that constitute a perfect square

Given the sequence OEIS A033581, which is the infinite sequence, the n'th term (0-indexing) is given by the closed form formula 6 × n2 . Your task is to write code, which outputs all the subsets of ...
20answers
1k views

### Prime numbers between n and 2n [duplicate]

Bertrand's postulate states that there is always at least 1 prime number between n and 2n for all n greater than 1. Challenge Your task is to take a positive integer n greater than 1 and find all of ...
16answers
2k views

### Recursive Collatz Conjecture

The Collatz conjecture postulates that if you take any positive integer, then repeat the following algorithm enough times: ...
37answers
2k views

### Find the largest number of distinct integers that sum to n

The Task Given an input positive integer n (from 1 to your language's limit, inclusively), return or output the maximum number of distinct positive integers that ...
1answer
532 views

### Write it into number theory style

Write a mathematical statement, using the symbols: There exists at least one non-negative integer (written as E, existential ...
16answers
2k views

### Factor-poor numbers

If a positive integer $N > 2$ has (strictly) less prime factors (without counting multiplicities) than its successor and its predecessor, we will call it a factor-poor number. In other words, \\$...
1answer
287 views

### Counting Moufang Loops

A loop is a pretty simple algebraic structure. It is a tuple (G,+) where G is a set and + is a binary operator G × G → G. That is + takes two elements from G and returns a new element. The operator ...
2answers
253 views

### Integer Division Loops

Challenge Given any positive integer supported by your language: Take the input and divide it into two halves. For all divisions in this program, if the input is odd, round one half up and one half ...
2answers
497 views

### Biggest square in a grid [closed]

Challenge Given a grid like this, ...
13answers
2k views

### Is it a Pascal Prime?

It is well known that odd primes will appear in Pascal's triangle exactly twice. However, not all numbers that appear exactly twice in Pascal's triangle are prime. We'll call these numbers Pascal ...
1answer
281 views

### Maximum Area of a Polygon with Vertices of a Polygon [closed]

Rules Given a list of integer coordinates, l, with a length of at least 4, and an integer n such that n is smaller than the length of l (but at least 3), return the largest area of an n-sided polygon ...
6answers
318 views

### Rhombus sequence

Imagine enumerating the elements of rhombi which grow ,[1,3,1],[1,3,5,3,1],… (only odd numbers such that they align nicely). This would look like as follows, ...
9answers
698 views

### Approximate definite integrals using Riemann sums

Left and right Riemann sums are approximations to definite integrals. Of course, in mathematics we need to be very accurate, so we aim to calculate them with a number of subdivisions that approaches ...
7answers
616 views

### Queue Our Decomposition

In this challenge I will ask you to find a QR decomposition of a square matrix. The QR decomposition of matrix A is two Matrices Q and R such that A = QR. In particular we are looking for Q to be an ...
7answers
2k views

### Hilbert's binary Hotel

In this challenge you will be asked to implement any function (or full program) that fulfills two properties. Those properties are: Your function must be an injective (reversible) function from the ...
3answers
249 views

### Loan “generous” amounts of money

Introduction You have a friend that keeps asking you for loans and you are getting tired of it. Today, he came for a loan again. Instead of turning down his offer, you get a great idea: troll your ...
3answers
233 views

### Form a list using prime numbers

You have been given N piles of coins. You have decided to divide each of those B1, B2, ..., BN piles among separate groups of people. The amount of people receiving coins has to be a prime number and ...
8answers
2k views

### Be as evil as possible

Introduction This is a follow-up of this challenge where you're taking the role of that person's evil twin. Being evil you don't want to maximize your share, but rather be as unfair as possible and ...
30answers
2k views

### What is the missing number (divisibility by 9)

Challenge Given a whole number divisible by 9 and one missing digit, find the missing digit. The missing digit may be represented by any character other than the digits 0-9 as long as it is ...