# Questions tagged [expression-building]

For challenges about rearranging a set of mathematical operators or numbers to fulfill a certain expression.

31 questions
Filter by
Sorted by
Tagged with
212 views

### Golfing Expressions

We can write mathematical expressions using the standard math operators (,),+,...
145 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 (...
648 views

### Represent n as an expression containing all the digits

Related Challenge: Single Digit Representations of Natural Numbers Task Write a program/function that when given a non-negative integer $n \le 100000$ outputs an expression which uses all the ...
433 views

### Build the smallest number

Given a non-empty list of digits 0 though 9, output the smallest number that can be produced by an expression formed by reordering these digits and introducing exponentiation signs ...
304 views

### 2D interpolation

Given required values for an expression with 2 variables, output a short expression which fulfill these values Input You may take the input in any reasonable format, e.g. ...
2k views

### Single Digit Representations of Natural Numbers

Task Write a program/function that when given a positive integer $n$ and a digit $d$ which is not 0 outputs a way to represent $n$ using only addition, subtraction, multiplication, ...
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 ...
422 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 ...
2k views

### Make Zero From First 'n' Numbers

Challenge The challenge is to write a code that takes a positive integer 'n' as an input and displays all the possible ways in which the numbers from 1 - n can be written, with either positive or ...
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 ...
955 views

### Mathematical Expression Showdown!

You are given 6 numbers: 5 digits [0-9] and a target number. Your goal is to intersperse operators between the digits to get as close as you can to the target. You have to use each digit exactly once, ...
4k views

### Operator precedence: How wrong can I be?

Say I have an expression: 9 * 8 + 1 - 4 This expression can be interpreted in six different ways, depending on operator precedence: ...
2k views

### Fewest operations to 100

Overview Given a list of digits, find the fewest operations to make 100 Input A string of digits, which may or may not be in numerical order. The order of the digits cannot be changed, however plus ...
352 views

### Roots and operators

I used to play a game while I was in the car, it consisted in taking the n-1 first numbers of another car plate and use operators and roots on them to get the ...
410 views

### Make mathematics with minimal matchsticks

Meta-background This was set as a question on Puzzling, and the instant reaction was "well, someone will just solve that by computer". There was a debate about just how complex a program to solve ...
3k views

### Solve an equation with (almost) any numbers you like

Given a string of the characters +=- where there is at least one =, insert positive integers between all the symbols and at the ...
739 views

### Find operations required to get result

So task is simple, given array of numbers and result, you need to find what operations you need to use on numbers from array , to obtain requested result. Let's make it simple for start, and allow ...
909 views

### Express a number with only 0-9 and the four operations

Explanation Befunge is a two-dimensional program that uses stacks. That means, to do 5 + 6, you write 56+, meaning: ...
2k views

### Official Dyalog APL 2016 Year Game

If you think this could be fun, but too much work, consider participating in this much smaller challenge. A bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". ...
3k views

### 10 9 8 7 6 5 4 3 2 1… Print 2016

As a spin-off to my challenge over at Puzzling, your goal is to output 2016. Rules: You must include the numbers ...
1k views

### Make a math equation from the date

In my Economics class, my friends and I like to come up with ways to rearrange the digits in the date (in MM/DD/YY) format to create a valid mathematical equation. For the most part, we are allowed to ...
804 views

### Arithmetic… tock… tick… tock

This question brought to you by a game I like to play when stuck in long phone meetings. Given any two times from a 24 hour clock (from 00:00 to 23:59), how many valid mathematical equations can be ...
597 views

### Express a number - a modern “Des Chiffres et des Lettres”

Express a number Back in the 60s, the French invented the TV game show "Des Chiffres et des Lettres" (Digits & Letters). The goal of the Digits-part of the show was to come as close as you can to ...
1k views

### Two-zero-one-five puzzle

Background This puzzle is a variation on the four fours puzzle (itself the topic of a past question). Like that puzzle, the aim is to find mathematical expressions for different whole numbers, using ...
2k views

### It’s time to do the math

Introduction This is one of my favorite math puzzles. Given a digit (say 3) and the number of times to use that digit (say 5), generate 10 expressions which result to 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 ...
880 views

### Longest mathematical expression in a grid

Given a grid which contains these signs: 0..9, x, =, write the fastest code that outputs the longest string of connected (horizontally, vertically, and diagonally adjacent), distinct cells which is a ...
2k views

### Generate all possible integers

Input: you are given 2 integers, n and k. n is a positive (>= 1) integer, and ...
3k views

### Four fours puzzle

The Four fours puzzle is a popular recreational mathematical puzzle that involves using exactly four 4s (and no other number) and a defined set of operations to reach every number from 0 to a given ...
2k views

### Generate a number by using a given list of numbers and arithmetic operators

You are given a list of numbers L = [17, 5, 9, 17, 59, 14], a bag of operators O = {+:7, -:3, *:5, /:1} and a number ...