# Questions tagged [arithmetic]

Challenges related to elementary arithmetic.

458 questions
129 views

### Multiplicative persistence

Multiplicative Persistence Multiply all the digits in a number Repeat until you have a single digit left As explained by Numberphile: Numberphile "What's special about 277777788888899?" Numberphile ...
8k views

### Historical difference between / and ÷ in mathematical expressions

Introduction: Inspired by a discussion that is already going on for many years regarding the expression $6÷2(1+2)$. With the expression $6÷2(1+2)$, mathematicians will quickly see that ...
1k views

### Spot all (anti)diagonals with duplicated values

Challenge: Given a matrix input, determine the amount of diagonals and anti-diagonals with duplicated numbers. So if we have a matrix like this: ...
192 views

### Work out $x^y$ using only addition and subtraction [duplicate]

The challenge is to implement a function or program that takes two numbers, $x$ and $y$ and return the result of $x^y$. The program cannot use any other mathematical operation other than $+$ ...
121 views

### All the digisibles [duplicate]

A natural number (written in the decimal base) is qualified as digisible if and only if it fulfills the following 3 conditions: none of its digits is zero, all the digits that compose it are ...
1k views

### Standardize the Samples (Compute the z-Score)

Given a list of floating point numbers, standardize it. Details A list $x_1,x_2,\ldots,x_n$ is standardized if the mean of all values is 0, and the standard deviation is 1. One way to compute this ...
3k views

### How much candy can you eat?

Credit to Geobits in TNB for the idea A post without sufficient detail recently posited an interesting game: 2 children sit in front of an array of candy. Each piece of candy is numbered 1 to ...
143 views

### Measuring Mountains [duplicate]

Sum-It is a language I created (quite late) for the Language Design Contest in TNB, for which the theme was "Range". Naturally I interpreted this as "Mountain Range" and created a language about ...
2k views

413 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. ...
574 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 (...
1k 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: <...
320 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 ...
859 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 ...
440 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. ...
161 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 ...
362 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 ...
194 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 ...
335 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 ...
191 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 ...
1k views

### Simple Factorial Challenge [duplicate]

In light of today's date... A factorial of a number n, is the product of all the numbers from 1 to n inclusive. The Challenge Given an integer n where 0 <= n <= 420, find the sum of the ...
766 views

### Number of surjections

Task Given 2 positive integers n and k, where n > k, output the number of surjections ...
3k views

### Integer logarithms

Given integers N , P > 1 , find the largest integer M such that P ^ M ≤ N. I/O: Input ...
1k views

### Arithmetic Cycle

Input: Integer n which is >=0 or >=1 (f(0) is ...
4k views

### Sum of five cubes

Given an integer, output five perfect cubes whose sum is that integer. Note that cubes can be positive, negative, or zero. For example, ...
4k views

### Zero-sum counting

Write a program or function that given n ≥ 1 returns the number of solutions to ±1 ± 2 ± 3 ± ... ± n = 0. For n = 6 there are no solutions, so the answer is 0. For n = 4 there are ...
3k views

### Two steps forward and one step back

Let's say I'm ten steps away from my destination. I walk there following the old saying, "Two steps forward and one step back". I take two steps forward, one back, until I'm standing exactly on my ...
2k views

### Ten-pin bowling score - World Bowling edition

World Bowling scoring Many people have gone to their local bowling center to play a few games of bowling, and many people continue to struggle to calculate their scores. World Bowling has introduced ...
1k views

### Golf A Free Lunch

Find a maximally profitable sequence of exchanges given an exchange rate table. As an example consider the currencies Ariary (your home currency), Baht, Cedi, and Denar where the rate from one to ...
1k views

### Given a number, print out its “collective sum”

Given a number as input, print out its collective sum What is a collective sum? Consider the number 13214, the input Looping through each of the digits starting ...
873 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) ...
2k views

### Diluted Integer Sums

A positive integer can be diluted by inserting a 0 between two bits in its binary expansion. This means that an n-bit number has ...
2k views

### Find number of ones to get a number using + and *

Introduction Your goal is to find the least number of ones you need to add or multiply together to get the input value, this is A005245. Input One positive integer N. Output The smallest number ...
2k views

### Olympic Rings Sequence

Challenge: Given an index integer n, either output the n'th item in this sequence, or output the sequence up to and including ...
285 views

### Accumulate some L.s.d

Prior to the decimalisation of Sterling in February 1971, a pound (£ - from Roman libra) comprised 20 shillings (s - solidus), each of 12 pennies (d - denarius). Additionally, until 1960, each penny ...
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 ...