# Questions tagged [math]

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

1,755 questions
Filter by
Sorted by
Tagged with
489 views

### Generate all possible equations with 10 characters

Nerdle is a Wordle variant, in which instead of words, the answers are equations. Each equation entered in the game must be a valid one. Examples: 13³-1=2196, ...
241 views

### Canonical form of a cubic Bézier curve

On Pomax's Primer on Bézier Curves this "fairly funky image" appears: This is related to the fact that every cubic Bézier curve can be put in a "canonical form" by an affine ...
187 views

### 4D rotation matrix to quaternions

It is well-known that a 3D rotation can always be represented by a quaternion. It is less well-known that a 4D rotation can always be represented by two quaternions, sending a point $p=(a,b,c,d)^T$ ...
608 views

1k views

### Ptolemy's table of chords

Ptolemy's Almagest contains a table of chords that effectively served as the world's only comprehensive trigonometric table for over a millennium. In modern form it looks like this: \begin{array}{|l|...
693 views

### Time to shortest permutation

Yesterday, as part of a IQ-style test, I got this interesting question: The time on a 24-hour clock is 11:43. What is the least number of minutes I should wait before the same digits are on the ...
3k views

### Sum of Consecutive Squares

Your task Given a integer input, $n$ (such that $n > 1$), decide whether it can be written as the sum of (at least 2) consecutive square numbers. Test cases Truthy: ...
2k views

### Capture the Flag... with a twist

Inspired by a challenge from the OUCC 2022 Seniors competition. Background Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing ...
657 views

### Intersection area of two rotated rectangles

Given two rectangles, which are possibly not in the orthogonal direction, find the area of their intersection. Input You may take the rectangles as input in one of the following ways: The ...
2k views

### Round to nicer numbers

The standard way to round numbers is to choose the nearest whole value, if the initial value is exactly halfway between two values, i.e. there is a tie, then you choose the larger one. However where I ...
893 views

### Maximum of outer product of integer vectors (in linear time)

Introduction Our goal is to efficiently find the maximum of a large amount of (redundant) data. We define the outer product of vectors $A$ and $B$ as a matrix containing the products of all ...
582 views

### RADD decomposition of an integer

Introduction The $RADD(n)$ operation is defined as the sum of $n + [$ the number whose decimal representation are the decimal digits of $n$ in reverse order $]$, see A004086. After reversal, ...
1k views

### Implement the Riemann R function

The Riemann R function is as follows: $$R (x)=\sum _{n=1}^{\infty } \frac{\mu (n) \text{li}\left(x^{1/n}\right)}{n}.$$ This uses the Möbius function as well as the logarithmic integral. From Wikipedia,...
429 views

### Normal Subgroups of $S_4$

Objective Given a permutation of 4 distinct items, classify the permutation by the normal subgroup(s) it belongs. Input/Output Format You gotta choose the followings as the hyperparameters for your ...
1k views

### Calculate my income tax

Background Here in the UK1, these are the income tax rules: You get a personal allowance (untaxed) of up to £12,570: If you earn less than £100,000, you get the full £12,570 as personal allowance ...
4k views

### Sum every second digit in a number

I have a number like this: n = 548915381 The output should be the sum of every second digit of that number. In this case 26: ...
2k views

### Write a number as a sum of Fibonacci numbers

In 2009, Hannah Alpert described the "far-difference" representation, a novel way of representing integers as sums and differences of Fibonacci numbers according to the following rules: ...
2k views

### Output the length of (the length plus a message) [duplicate]

The task is simple. You're given an arbitrary string message. Return that message prefixed with a number, such that the length of that number plus the message equals the number. In other words, the ...
454 views

### CGAC2022 Day 3: $n$-dimensional Chocolate Pyramid

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. I've got an infinite supply of $n$-dimensional chocolate for some positive integer $n$. The shape of the ...
2k views

### CGAC2022 Day 1: Let's build a chocolate pyramid!

Following last year's event, we're doing Code Golf Advent Calendar 2022! On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent ...
Given is a grid polygon by the list of its integer vertex coordinates arranged along the perimeter, in the form $(x_1,y_1), (x_2,y_2), \cdots , (x_n,y_n)$ with $n \ge 3$. The polygon is completed ...