Skip to main content

Questions tagged [expression-building]

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

Filter by
Sorted by
Tagged with
16 votes
5 answers
501 views

Scientists have made contact with a parallel universe. Just one problem: They write math differently. Help the scientists make a program that can convert normal math expressions to their equivalent in ...
mousetail's user avatar
  • 14.4k
19 votes
9 answers
1k views

Given two non-negative integers e.g. 27, 96 their multiplication expression would be 27 x 96 = 2592. If now each digits is ...
Domenico's user avatar
  • 2,463
6 votes
1 answer
251 views

Fourward (Introduction) I have an unhealthy obsession with the number 4. I love it so much, in fact, that seeing any other digit is frustrating to me. I therefour wish to create a 'Fourier ...
Aos Sidhe's user avatar
  • 169
19 votes
1 answer
741 views

We can write mathematical expressions using the standard math operators (,),+,...
Jay's user avatar
  • 291
10 votes
0 answers
174 views

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 (...
Mahkoe's user avatar
  • 281
16 votes
6 answers
763 views

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 ...
Mukundan314's user avatar
  • 13.7k
7 votes
6 answers
538 views

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 ...
l4m2's user avatar
  • 32.6k
6 votes
2 answers
407 views

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. ...
Command Master's user avatar
27 votes
8 answers
3k views

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, ...
Mukundan314's user avatar
  • 13.7k
3 votes
0 answers
173 views

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 ...
Engineer Toast's user avatar
13 votes
1 answer
558 views

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 ...
user avatar
20 votes
24 answers
2k views

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 ...
Manish Kundu's user avatar
  • 5,350
28 votes
8 answers
2k views

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 ...
Spyrali Chyuu's user avatar
15 votes
2 answers
1k views

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, ...
geokavel's user avatar
  • 6,686
66 votes
13 answers
4k views

Say I have an expression: 9 * 8 + 1 - 4 This expression can be interpreted in six different ways, depending on operator precedence: ...
Esolanging Fruit's user avatar
16 votes
10 answers
2k views

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 ...
Foxocube's user avatar
  • 269
8 votes
1 answer
398 views

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 ...
user avatar
16 votes
2 answers
525 views

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 ...
user avatar
29 votes
10 answers
4k views

Given a string of the characters +=- where there is at least one =, insert positive integers between all the symbols and at the ...
Calvin's Hobbies's user avatar
10 votes
10 answers
1k views

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 ...
user902383's user avatar
  • 1,460
16 votes
8 answers
1k views

Explanation Befunge is a two-dimensional program that uses stacks. That means, to do 5 + 6, you write 56+, meaning: ...
Leaky Nun's user avatar
  • 50.6k
26 votes
11 answers
2k views

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". ...
Adám's user avatar
  • 31.8k
13 votes
23 answers
5k views

As a spin-off to my challenge over at Puzzling, your goal is to output 2016. Rules: You must include the numbers ...
rybo111's user avatar
  • 4,565
19 votes
1 answer
2k views

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 ...
Arcturus's user avatar
  • 7,405
15 votes
1 answer
865 views

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 ...
nobillygreen's user avatar
16 votes
2 answers
706 views

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 ...
agtoever's user avatar
  • 2,921
13 votes
1 answer
1k views

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 ...
Uri Granta's user avatar
  • 2,999
15 votes
4 answers
2k views

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 ...
Optimizer's user avatar
  • 26.6k
6 votes
2 answers
948 views

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 ...
user3585425's user avatar
8 votes
12 answers
2k views

Input: you are given 2 integers, n and k. n is a positive (>= 1) integer, and ...
Ryan Dougherty's user avatar
24 votes
4 answers
4k views

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 ...
Volatility's user avatar
  • 3,404
11 votes
1 answer
2k views

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 ...
Martin Thoma's user avatar
7 votes
4 answers
464 views

A twist on a recently asked question, you are given a list of operators and a result and you need to find integers which, when operated on by those operators, generate the result. Example 1 input <...
Keith Randall's user avatar
12 votes
2 answers
2k views

This is based on a game one of my math teachers used to play in middle school. He would write 5 random one-digit numbers on the board, and then a random two-digit number. We would try to create an ...
Sir_Lagsalot's user avatar
  • 4,998