# All Questions

14,045 questions
Filter by
Sorted by
Tagged with
2k views

### Print all legal chess moves

The game of chess has moves. Lots of moves. But how many, exactly? In this challenge, you must print all possible chess moves for a single player (black or white — you choose). Moves are distinguished ...
• 13.6k
1k views

### Output a 1-2-3-5-7... sequence

Follow-up of my previous challenge, inspired by @emanresu A's question, and proven possible by @att (Mathematica solution linked) For the purposes of this challenge, a 1-2-3-5-7... sequence is an ...
• 1,805
2k views
+200

### Output a 1-2-3 sequence

For the purposes of this challenge, a 1-2-3 sequence is an infinite sequence of increasing positive integers such that for any positive integer $n$, exactly one of $n, 2n,$ and $3n$ appears in ...
• 1,805
1k views

### Maximum number of trailing zeros

Input Positive integers a and b defining an interval of integers [a .. b]. Output The maximum number of trailing zeros in the binary expansion of any integer in the interval [a .. b]. Examples Input: [...
• 169
5k views

### FizzFizzFizzBuzz!

Given a positive integer n, output the "FizzFizzFizzBuzz" sequence for that number: print the decimal representations of the numbers 1 through ...
1k views

### Fixed Repeating Output

Fixed Repeating Output is a challenge originally invented by Esolang user AnotherUser05 which shows that a language supports loops and I/O. Challenge A program that solves the challenge has to do ...
• 375
3k views

### Should the banker hit?

Baccarat is a casino game where gamblers bet on whether one of two hands, the player or the banker, will have a sum closer to 9 (mod 10) or whether they will tie. It is played with four to eight ...
• 1,637
543 views

### Construct the point with two segments

Given a rational point P, return four integral points A, B, C, and D, such that the line segments AB and CD intersect only at P. To make it a bit more interesting, segment AB doesn't include A and B. ...
• 23.9k
2k views

### Draw a Fibonacci Swoosh

Title courtesy of Greg Martin For this challenge, I'll define an arc of size $k$ as a single piece of a sine wave with a length of $k$ units and an height of $\frac{k}{4}$ units: And I'll ...
• 37.8k
239 views

### Fewest Instructions for Mihály Quine

https://mihaly.barasz.com/compressed-loop/game.html You have a simple, line-oriented “compression” language. The language works as follows: The document must start with the ...
• 193
1k views

### Adding two numbers in Tally marks

Given two positive integers, add them. Both inputs and output are in Tally marks form, which can be expressed as:  T(n) := \begin{cases} n,&& n\le 5\\ 5 || T(n-5),&& n>5 \end{...
• 23.9k
1k views

### Emulate Jelly's tie-scan

The golfing language Jelly has a built-in ƭ called "tie", that cycles through a list of functions every time it's called. For example, ...
• 37.8k
188 views

### Construct the Irish possessive

In this challenge you will take an Irish word and a personal pronoun and create the possessive pronoun construction combining the two. For example , ...
• 98.5k
206 views

### Create the characters you can write on a MacOS US English Keyboard (as another OS will read them)

Introduction This is a small challenge I came up with while trying to make some compact code for my younger brother to use. I don't think it's particularly interesting, but I believe it presents some ...
• 9
2k views

### Odds for second smallest prime factor

Given a prime number $p$ output the asymptotic density of the set of positive integers which have $p$ as their second-smallest distinct prime factor Input/Output Input: one of the following ...
• 10.6k
565 views

### Remove filler words from a string

I always stutter and use filler words when speaking to a lot of people at a time. So I need something to remove all my filler words. So here is the challenge. Your program should take input as a ...
3k views

### How many cacti can I plant here?

Given a Minecraft terrain as a 2-dimensional array of integers or similar datastructure, determine the maximum number of cacti that can be planted on it. The integers represent the height (y) of the ...
• 479
731 views

### Rockstar Poetic Number Literals!

The Rockstar programming language has "poetic number literals", allowing you to assign nonnegative, finite (at least one Rockstar interpreter supports infinity) numbers to variables without ...
1k views

### Map key with value as standard [closed]

Given a non-empty string containing only printable ASCII (codepoints 0x20 to 0x7E), write the shortest program or function that map the key to its value. Inside the string the key will always have a ...
• 277
739 views

### Swifty Argument Labels

For the purpose of this challenge, arguments are things you pass to a function at the call site, while parameters are what the function uses in its implementation. Or, more succinctly: arguments = ...
710 views

### Implement a 2-player version of 1D Chess

The game is played on a 1x8 board with the following setup: KNR..rnk White's pieces are on the left, while black's pieces are on the right. The king (K) can move 1 ...
• 399
2k views

### Break an integer into even- and odd-indexed bits

Objective Given an integer $n$ interpreted as two's complement binary, output two integers, namely the integer consisting of $n$'s bits at places of $2^0, 2^2, 2^4, \cdots$, and the integer ...
• 5,941
2k views

### Can I Clear The Grid?

I recently found this game and have been enjoying it. Basically, there is a grid of colored tiles and you act by clicking on empty spaces. When you click an empty space, the first tile (if any) in ...
• 42.4k
931 views

### Next cyclic suffix

We will say a string $x$ is cyclic maximal if there is no way to cycle its elements to get a lexicographically larger string. In other words there is no $a$ and $b$ such that $a \oplus b = x$ ...
• 98.5k
2k views

### nimi ale lon toki pona! (Every word in Toki Pona!)

"nimi ale lon toki pona" is a song by YouTuber jan Misali which lists 137 common words in the constructed language Toki Pona. This challenge is not a duplicate of "How high can you ...
3k views

### Create a cactus from words

Introduction: A typical cartoonish cactus usually looks like this: One big stem in the middle, with some L-shaped branches sticking out. We'll use this general shape for this challenge. Challenge: ...
• 126k
2k views

### Avoiding Loops!

Given a collection of coloured laces, what would be the probability, $P$, that Alice won't create any loops if, until impossible, they tie two uniformly chosen, free lace ends of differing colours ...
• 106k
908 views

### Argument of a complex number (Robbers)

V1.1: Added criterion to help with tiebreakers, a bit overkill but still.V1.2: It's April 15th! Task: Crack the scrambled code for calculating the argument of a complex number $z=x+iy$ given two ...
• 361
2k views

### Argument of a complex number (Cops)

This is the cop's thread, where one should post the scrambled code. Here is the robbers' thread where the cracked source should be posted and linked to the cop's answer. NB: I am currently writing up ...
• 361
509 views

### Situations when recursion helps [closed]

Recursion is actually quite powerful, sometimes its doesn't look like that child problem of itself exist, but recursion is just helpful. One case per answer.
• 23.9k
741 views

### Evaluate Ternary Logic

Objective Given an expression involving ternary values, evaluate it into a ternary value. Ternary Values The three truth values in question are the values of Haskell's ...
• 5,941
188 views

### Rank poker High Card hands [closed]

In the poker game there are 1277 unique 'High Card' ranks. It's 1287 (13 over 5) if we include all straights. The challenge is to write a function which returns an integer value corresponding to the ...
• 123
2k views

### How quickly can you type this unary string?

If I want to type the string aaa, the least keystrokes I can type it in is 3: a a a. But if I want to type the string ...
• 37.8k
1k views

### Scan input for numbers and add thousands separators

Challenge Given ASCII-encoded text input of any size, detect numbers between -1,000,000,000,000,000,000 and 1,000,000,000,000,000,000 exclusive and rewrite them with thousands separators. Use commas ...
• 391
246 views

### Convert maximum values to bit widths

Background The newest version of the C standard, C23, adds preprocessor macros like INT_WIDTH, ULONG_WIDTH, and ...
906 views

### Magical BF: BF code that works in two ways

Challenge In this challenge, we will use a language that is very similar to Brainfuck but slightly different. This variant of BF does not have any input and output commands; instead, it simply takes ...
• 76k
1 vote
111 views

### Interlaced array [duplicate]

You are given an array A of length N and an array B of length ...
1k views

### Lattice points visible from the origin

Challenge Create a program that outputs a square grid showing visible and non-visible points $(x, y)$ from the origin based on their greatest common divisor (GCD). A point $(x, y)$ is considered ...
• 2,163
941 views

### Manipulate integers to zero

Objective Given a nonempty unordered list of positive integers, decide whether they can be added, negated, or multiplied to yield a single zero. Each given number must be used exactly once. There is a ...
• 5,941
1k views

### Pretty Palintiples

Imagine you have a positive integer number $n$. Let $m$ be the number obtained by reversing $n$'s digits. If $m$ is a whole multiple of $n$, then $n$ is said to be a reverse divisible ...
• 487
1k views

### Give two points with the most similar distances to the origin

Consider an $(n+1) \times (n+1)$ grid of points places at non-negative integer coordinates. Given two points in the grid at $(a, b)$ and $(c, d)$, we know that the distance of the first point ...
• 2,896
124 views

### Shortest Float32Array to Int32Array conversion for audio processing

I'm currently converting a Float32Array to an Int32Array for input to a real-time audio raw PCM to MP3 recording application. <...
• 209
110 views

### Electra "Hello World!" [duplicate]

This will be a bit of a different challenge. Back in 2023, I developed a 2D esolang called Electra, and looking back at my hello world program, (which is 582 bytes by the way) I see a lot of room for ...
4k views

### One-Dimensional Pinball

Consider a finite, one-dimensional grid where each cell is marked with one of two symbols (I will use the symbols < and >, ...
• 10.6k
2k views

### Can I follow this recipe?

You work in a kitchen which has a peculiar rule. When you mix something into a pot you must always add at least one new ingredient. So you can add pasta, oil, salt then pesto, but not pasta, pesto, ...
• 98.5k
1k views

### Reconstruct a list of strings from its prefixes

emanresu A posted a challenge to reconstruct an ordered list of integers from its unordered set of unordered prefixes. Many users (beginning with xnor's answer) noticed that summing each unordered ...
• 15.7k
1k views

### Reconstruct a list from its prefixes

A list $[a_1,a_2,a_3 \cdots a_n]$ can be uniquely represented as an unordered list of its prefixes - $[[a_1],[a_1, a_2], [a_1,a_2,a_3] \cdots [a_1,a_2,a_3 \cdots a_n]]$. This can be in any order ...
• 37.8k
398 views

### µUnitDC: A unit-aware RPN calculator

Background This challenge is based on a personal project I did, UnitDC. This challenge is a super-miniaturized version of UnitDC. Challenge Please write a simple unit-aware calculator that evaluates a ...
2k views

### Find the odd one out

Challenge The goal of this challenge is to generate and output a $16 \times 32$ (height $\times$ width) grid where all cells contain a decoy character, except for a random single cell that ...
• 2,163