# Questions tagged [math]

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

1,652 questions
Filter by
Sorted by
Tagged with
2k views

### Display the exponent from a binary floating point number as a decimal value

Had my software final exams recently, one of the last questions had me thinking for a while after the exam had finished. Background IEEE754 numbers are according to the below layout The exponent is ...
484 views

2k views

### A Portuguese sequence of integers

Context Consider the following sequence of integers: $$2, 10, 12, 16, 17, 18, 19, ...$$ Can you guess the next term? Well, it is $200$. What about the next? It is $201$... In case it hasn't become ...
1k views

### Find all integer pairs that produce a given Loeschian number

Inspired by and drawns from Is this number Loeschian? A positive integer $k$ is a Loeschian number if $k$ can be expressed as $i^2 + j^2 + i\times j$ for $i$, $j$ integers. For example, ...
2k views

### Three other numbers

Given three distinct numbers from $1$ to $7$, output three other distinct numbers from $1$ to $7$, that is having no numbers in common with the original numbers. Your code must produce a ...
5k views

### Is that number a Two Bit Number™?

Let's start by defining a Two Bit Number™: It is a positive integer When expressed as a binary string it has exactly 2 true bits OR When expressed as a decimal number, it has exactly 2 of the numeral ...
3k views

### Circumference of an ellipse

Challenge Unlike the circumference of a circle (which is as simple as $2\pi r$), the circumference of an ellipse is hard. Given the semi-major axis $a$ and semi-minor axis $b$ of an ellipse (see ...
2k views

### Plot a centered circle

Intro Given radius $r$, draw a circle in the center of the screen. Sandbox. The Challenge Here is a simple challenge. Plot a circle using the formula $x^2+y^2=r^2$, or any other formula that will ...
2k views

### Delicate primes

Inspired by Find the largest fragile prime. By removing at least 1 digit from a positive integer, we can get a different non-negative integer. Note that this is different to the ...
140 views

### The Perfect Polynomial [closed]

The coefficients of a perfect square polynomial can be calculated by the formula $(ax)^2 + 2abx + b^2$, where both a and b are integers. The objective of this challenge is to create a program that ...
540 views

647 views

### Prime Modified Z-Factorials

Let me explain one by one the above terms... We will call $\text{Z-Factorial}(n)$ of a positive integer $n$, $n!$ (i.e. $n$ factorial) without any trailing zeros. So, $\text{Z-Factorial}(30)$...
584 views

### Find the maximum flow

Given a directed network, with a single source and a single sink, it is possible to find the maximum flow through this network, from source to sink. For example, take the below network, $G$: Here, ...
1 vote
742 views

2k views

### Cleaning up decimal numbers

Background Sometimes in calculus you're expected to calculate the sum of an infinite series. Sometimes these series are very friendly, like a geometric series, but add anything else onto it and it can ...
2k views

### Complete the Magic Square

Background A magic square is an n×n matrix consisting of one of each of the integers from $1$ to $n^2$ where every row, column, and diagonal sum to the same ...
247 views

### Is it a uniform polyhedron?

Objective Given a vertex figure consisting of regular convex polygons, determine whether it represents a convex uniform polyhedron. What is a uniform polyhedron? A uniform polyhedron is a polyhedron ...
448 views

### Count The Genus

Objective Given a matrix of connected box drawing characters, count its genus, the number of plane sections it encloses. Valid input The box drawing characters are ...
191 views

### Solve the dress problem [closed]

Background Peter's Father, the Teacher of a dance-club, asks Peter a question: Given are two natural numbers ($\mathbb{N}$ $x$ and $y$). $x$ is the number of the garment types (e.g. shorts, ...
2k views

### Make a Ramanujan magic square

Background As you maybe know Ramanujan made this magic square by $4x4$ Matrix: This works like all magic squares. But the special thing in this square is that his birthdate is hidden in the first ...
975 views

### What is the Subspace Dimension?

Challenge Given the Cartesian coordinates of two or more distinct points in Euclidean n-space ($\mathbb{R}^n$), output the minimum dimension of a flat (affine) subspace that contains those points, ...
3k views

### Laguerre Polynomials

Laguerre polynomials are solutions to Laguerre's equation, a second-order linear differential equation: $xy''+(1-x)y'+ny=0$. For a given value of n, the solution, y, is named $L_n(x)$. The ...
2k views

### Music with pi and e

Because I forgot to celebrate Pi Day (14.3), let's celebrate with $\pi$, $e$ (Euler's number) and music! Challenge No, we don't have time to eat a pi-pizza, let's make a program. What you need is ...
3k views

### Find the perfect square!

Your task is to turn a square root like this: √12 into a form like this: 2√3 For our purpose, we only need to output the left ... 2k views

### Are they collinear?

Task Write a program/function that when given three 2d points in cartesian coordinates as input outputs a truthy value if they are collinear otherwise a falsey value Three points are said to be ...
268 views

### Is it a geometric sequence or not? [closed]

Well, last time I asked for an arithmetic sequence, now comes the geometric sequence Challenge In this challenge, the input will be an unordered set of numbers and the program should be able to tell ...
230 views

### Is it an Arithmetic Sequence or not? [closed]

Challenge In this challenge, the input will be an ordered set of numbers and the program should be able to tell if the set of numbers is an Arithmetic Sequence. Input The input will be a list ...
2k views

### Find the discrete logarithm

Task Write a program/function that when given 3 positive integers $a, b$ and $m$ as input outputs a positive integer $x$ such that $a^x\equiv b\ (\text{mod}\ m)$ or that no such $x$ exists. ...
1k views

### Is a statement of propositional logic always true?

The challenge is to golf a program that checks if a statement of propositional calculus/logic is a logical tautology (i.e. it is true for all possible values of the variables). Input Input formulas ...
196 views

### Create a text image by manual automation

Challenge Premise It's 2006, and Alice is trying to send Bob their her completed notes on their newly ended expeditions into the labyrinthine school library, which the two of them found suffers from a ...
1k views

### Scientific notation in Base-16

Input a scientific notation number (base 10), output scientific notation in base 16 (as defined below). Details In scientific notation, all non-zero numbers are written in the form $$m \times 10^n$$ ...
2k views

### Archimedes's cattle problem

Compute, O friend, the number of the cattle of the sun which once grazed upon the plains of Sicily, divided according to color into four herds, one milk-white, one black, one dappled and one yellow. ...
662 views

### LeetCode 552: Student Attendance Record II

I'm posting my code for a LeetCode problem copied here. If you have time and would like to golf for a short solution, please do so. Requirement It has to only pass the LeetCode's Online Judge, if the ...
Task Write a program/function that when given a positive integer $n$ splits the numbers from $1$ to $n$ into two sets, so that no integers $a, b, c$, satisfying $a^2 + b^2 = c^2$ are all in ...