2022 Developer Survey is open! Take survey.

# Questions tagged [arithmetic]

Challenges related to elementary arithmetic.

526 questions
Filter by
Sorted by
Tagged with
2k views

### Palindromic Powers

Powers We define an important power as a number that can be represented as $x^y$ where $x ≥ 2$ and $y ≥ 2$. Palindrome We define an ...
2k views

### Random Point from a 2D Donut Distribution

A donut distribution (for lack of a better term) is a random distribution of points in a 2-dimensional plane, forming a donut-like shape. The distribution is defined by two parameters: the radius <...
264 views

### No parentheses shall be omitted

This expression actually has an omitted pair of parentheses. 1 + 2 * 3 To make things clear, it should be, 1 + (2 * 3) Even ...
3k views

### Make S + S + ... + S as Large as Possible!

Let $S \subset \mathbb N_{\geq0}$ be a subset of the nonnegative integers, and let $$S^{(k)} = \underbrace{S + S + \dots + S}_{k\ \textrm{times}} = \{ a_1 + a_2 + \dots + a_k : a_i \in S\}.$$ For ...
576 views

### Khinchin's constant bad estimate [closed]

Inspired by How to write down numbers having an infinity of decimals? Link 🇫🇷 Background From Wikipedia: for almost all real numbers $x$, coefficients $a_i$ ...
2k views

### Hunt for discount

Story My local pizza delivery introduced new discount. You get 50% discount from every second item on your order. But being greedy capitalists, they forgot to mention that they will rearrange items ...
2k views

705 views

### Next to the middle

Given an array of integers, find "the next to the middle". The next to the middle is the smallest integer greater than the smallest among mean, median and mode of the given numbers, that is ...
153 views

### 8 out of 10 programmers like countdown [duplicate]

Edit (Jan 24/2021): The original specification for the challenge had a few problems. Underneath the original text, I have added alternate conditions that were suggested by @caird-coinheringaahing (...
159 views

### increment a binary number without arithmetic manipulations [closed]

Input: binary string Output: binary string that represents the binary input + 1 Example: Given 10111 as an input, output 11000 ...
2k views

### Ken Iverson’s Favourite APL Expression?

Ken Iverson, 1920–2020 Let's implement his favourite expression: Given a row of Pascal's triangle, compute the next row. This can for example be computed by taking the input padded with a zero on the ...
4k views

2k views

### Slowing Down Sped Up Videos

Summary Videos which are sped up every time a particular word is said exist for everything from the Bee Movie to the classic Rick Roll. The goal for this challenge is to figure out how much you'd have ...
3k views

### Sum the array times n, except the last

I've been posting relatively hard challenges recently, so here goes an easy one. Task Given an array $A$ and a number $n$, calculate the sum of all numbers of $A$ multiplied by $n$, except the ...
4k views

### Compute xkcd's Wrong Times Table

The 2020-05-29 xkcd comic showed us the numbers that Randall Munroe feels would be most likely to result from multiplication, other than the correct answers. The table does seem to have some sort of ...
3k views

### Check if an array (or equivalent) has the same number of odd and even numbers - Code Golf Edition!

Inspired by this code review question, I am curious to see what happens if we turn that into a code-golf challenge! The description is easy, the input is an array or any similar data structure with ...
665 views

### Perfect scores in Martian rules football

Story Martians have been observing Aussie rules football matches from space with great curiosity. Having totally fallen in love with the game, they have been inspired to start their very own football ...
89 views

### How to find the original value based on modulus/reminder and some other information [closed]

This might be a very basic question in terms of math, x % constant = x_modulus (x + some_number) % constant = y_modulus Given the value of ...
314 views

### Multiplication algorithm on a 4004

So I was playing around with this emulator of the Intel 4004 and decided I wanted to set a challenge for myself. The first use for the 4004 was in a calculator, so I decided that I would try to code ...
2k views

### Generate A065825

(This is A065825.) The sequence defaults apply, so you can pick another format other than this one. Given an input integer n, find the smallest number ... 2k views

### Euler's Geometry Puzzle

Today (or tomorrow, depending on your timezone, by the time of posting) is the birthday of the great mathematician and physicist Leonhard Euler. To celebrate his birthday, this challenge is about one ...
836 views

### Boil eggs using hourglasses

These are the classical puzzles: You need to boil eggs for exactly 9 minutes, or else the visiting Duchess will complain, and you will lose your job as head chef. But you have only 2 Hourglasses, one ...
1k views

### (RGS 4/5) Inverting matrices modulo m

Task Given an integer matrix M and a modulus m, find an inverse of M modulo ...
3k views

### (RGS 1/5) Binary multiples

A binary multiple of a positive integer k is a positive integer n such that n is written ... 