# Questions tagged [arithmetic]

Challenges related to elementary arithmetic.

526 questions
Filter by
Sorted by
Tagged with
8k views

### Shift right by half a bit

The challenge is to implement a program or function (subsequently referred to as "program") that takes a nonnegative integer $n$ as input and returns $n\over\sqrt{2}$ (the input divided by the ...
3k views

### Move my liquid to make me equal

You are given 4 positive integers: volume of the first container (v1), volume of the second container (v2), volume of the liquid ...
344 views

### Play flip--flop

Flip flop is a memory / arithmetic game that I played in high school. Some number of players stand in a circle. The players take turns. On the nth turn, the current ...
3k views

### Who's next to me in the queue?

Problem 4 in the 2019 BMO, Round 1 describes the following setup: There are $2019$ penguins waddling towards their favourite restaurant. As the penguins arrive, they are handed tickets numbered ...
4k views

### Average Two Letters

Introduction Every letter in the English alphabet can be represented as an ASCII code. For example, a is 97, and ...
58 views

Spreadsheet Columns In most spreadsheet programs, columns go A, B, C, ... ...
3k views

### Find the percentage

We haven't had any nice, easy challenges in a while, so here we go. Given a list of integers each greater than $0$ and an index as input, output the percentage of the item at the given index of the ...
8k views

### Random point on a sphere

The Challenge Write a program or function that takes no input and outputs a 3-dimensional vector of length $1$ in a theoretically uniform random direction. This is equivalent to a random point on ...
2k views

### Calculate Landau's function

Landau's function $g(n)$ (OEIS A000793) gives the maximum order of an element of the symmetric group $S_n$. Here, the order of a permutation $\pi$ is the smallest positive integer $k$ such ...
493 views

### Compute height of Bowl Pile

Bowl Pile Height The goal of this puzzle is to compute the height of a stack of bowls. A bowl is defined to be a radially symmetric device without thickness. Its silhouette shape is an even ...
2k views

### Start from ones

Given a strictly positive integer n, follow these steps: Create an array A with n 1s. If A only has one element, terminate. Otherwise, starting from the first element, replace each pair of A with its ...
6k views

### Look mom! I made my own (Base 10) numeral system! [closed]

We've all done it, well, maybe not, but making your own alien language and numbering system is a staple of especially fantasy writing, but is mostly just a fun activity. The task is simple, take two ...
917 views

1k views

### Dirichlet Convolution

The Dirichlet convolution is a special kind of convolution that appears as a very useful tool in number theory. It operates on the set of arithmetic functions. Challenge Given two arithmetic ...
4k views

Challenge Calculate the strange sum of two natural numbers (also known as lunar addition): Given $A=...a_2 a_1 a_0$ and $B=... b_2 b_1 b_0$ two natural numbers written in the decimal base, the ...
2k views

### The Written Digits Sequence

Here's a reasonably trivial sequence which is not in the Online Encyclopedia of Integer Sequences. Start with an empty sequence then define each term as the number of characters required to write out,...
847 views

### Validate a barcode [duplicate]

A barcode of EAN-13 symbology consists of 13 digits (0-9). The last digit of this barcode is its check digit. It is calculated by the following means (the barcode ...
695 views

### Whose neighbours are hostile?

Introduction For the purposes of this challenge, we will define the neighbours of an element $E$ in a square matrix $A$ (such that $E=A_{i,j}$) as all the entries of $A$ that are immediately ...
611 views

### Extract and Divide

Challenge For a given positive integer $n$: Repeat the following until $n < 10$ (until $n$ contains one digit). Extract the last digit. If the extracted digit is even (including 0) multiply ...
2k views

### Missing numbers in arithmetic sum

Challenge Giving a valid arithmetic sum with some missing numbers, output the full expression. Example: ...
2k views

### Custom Number Base Converter

The powers that be want to be able to quickly convert any number they have into their own number base using any format they would like. Input Your program must accept 3 parameters. Number: The ...
2k views

### Divide the work [duplicate]

There is a job which can be decomposed into x equally-sized smaller tasks. You have a team of size y <= x, where every member ...
972 views

### Calculate power series result [duplicate]

Related: Calculate Power Series Coefficients Given a positive integer $X$ and a max exponent (Also a positive integer too) $N$ calculate the result of a power series. Example: X^0+X^1+X^2+\...
472 views

### Subset Sum Orderings

A set of n positive numbers has 2^n subsets. We'll call a set "nice" if none of those subsets have the same sum. ...
670 views

### Double a number's continued fraction

Your task is, given x, output 2*x. Easy right!? But there's a catch: x will be given as a (...
2k views

### Recover the power from the prime power

It seems that many people would like to have this, so it's now a sequel to this challenge! Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n ...
2k views

### Recover the prime from the prime power

Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n is a natural number. Task: Given a prime power pn > 1, return the prime p. Testcases: <...
346 views

### Pair and sort from two integer lists

You are given two arbitrary integer lists, e.g. [-10, 99, -6, 43], [100, 32, 44]. You are to pick one integer from each list and ...
904 views

### Insulate the Window Glass and Foil of your house

Introduction: The best options for the glass of your house will: 1. Let through as little heat as possible in both directions (insulation-value Ug). (2. Let ...
604 views

### Interpreted arithmetic

A little known fact is that if you turn on enough language extensions (ghc) Haskell becomes a dynamically typed interpreted language! For example the following program implements addition. ...
164 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 ...
439 views

### Not just a four fours puzzle

In this variant of the Four fours puzzle your should use up to x x's (and no other number) and a defined set of operations to ...
223 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 ...
483 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 ...
230 views

### Minimal Triangles

Make an upside down triangle of positive integers. Every number in the triangle must be distinct. Each number is the summation of its two parents (similar to how Pascal's triangle is constructed, but ...