instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Introduction
A popular word puzzle is to convert one word into another via a series of steps which replace only one letter and which always result in a valid word. For example, BAG can be converted to DOG via a path of five steps:
BAG -> BAT -> CAT -> COT -> COG -> DOG
Shorter paths also exist in this case; for example... | stackexchange_codegolf |
Introduction
In many programming languages, within syntax exceptions, it is often pointed out to the programmer exactly which character or line is the culprit. This challenge will be a bit of a modification of that - specifically, using an arrow to point out any specific character of an input string.
The challenge
Your... | stackexchange_codegolf |
As the June 2021 Language of the Month is Red, what are some general tips for golfing in Red language?
Please suggest tips that are at least somewhat specific to Red (e.g. "remove comments" isn't a valid tip here).
Please one tip per answer!
| stackexchange_codegolf |
Back in 2018, there has been introduced new law in Poland to ban trading on sundays,
but certain exceptions have been made (listed below). The task today is to determine,
can one trade on the sunday provided by the user (according to these rules).
Rules
You can trade only if one of the following is satisfied:
The day ... | stackexchange_codegolf |
Most Android smartphones allow the user to use a swipe pattern to open their phone:
Certain patterns are legitimate, and others are impossible. Given an input swipe pattern, return a truthy or falsy indicating if the given input pattern is legal or not.
Input
The grid is labelled row-wise 1 through 9:
1 2 3
4 5 ... | stackexchange_codegolf |
It is trivially possible to create a bijective function from \$\mathbb{Z}\$ (the set of all integers) to \$\mathbb{Z}\$ (e.g. the identity function).
It is also possible to create a bijective function from \$\mathbb{Z}\$ to \$\mathbb{Z}^2\$ (the set of all pairs of 2 integers; the cartesian product of \$\mathbb{Z}\$ an... | stackexchange_codegolf |
Definitions
A bijection from a set S to a set T is a function from S to T such that one element in T is mapped by exactly one element in S.
A bijection within a set S is a bijection from S to S.
The natural numbers are the integers which are greater than or equal to 0.
A subset of a set S is a set such that every elem... | stackexchange_codegolf |
Let A be an m by n rectangular matrix of positive integers, where m and n are also positive integers.
We are interested in RoD ('Right-or-Down') paths from the upper-left cell of A to the lower right cell; in an RoD path, each successive cell of the path is either one cell to the Right of or one cell Down from the prev... | stackexchange_codegolf |
A Woodall Prime is a prime which can be calculated, given a positive integer n, with n * 2^n - 1.
Your task is to, given a integer k, generate a Woodall Prime with k digits. If no such Woodall Prime exists, you must generate a Woodall Prime with the closest amount of digits. If two primes exist with the same digit coun... | stackexchange_codegolf |
Trigonometry has LOTS of identities. So many that you can expand most functions into sines and cosines of a few values. The task here is to do that in the fewest bytes possible.
Identity list
Well, the ones we're using here.
sin(-x)=-sin(x)
sin(π)=0
cos(-x)=cos(x)
cos(π)=-1
sin(a+b)=sin(a)*cos(b)+sin(b)*cos(a)
cos(a+b)... | stackexchange_codegolf |
Given a non-negative integer input, write a program that converts the number to hexadecimal and returns a truthy value if the hexadecimal form of the number contains only the characters A through F and a falsey value otherwise.
Test cases
10
==> True (A in hexadecimal)
100
==> False (64 in hexadecimal)
161
==> False... | stackexchange_codegolf |
If we have a binary matrix then we will say that a \$1\$ is stable if it is in the bottom row or it is directly adjacent to a \$1\$ which is stable.
In other words there must be a path to the bottom row consisting only of \$1\$s.
So in the following matrix the \$1\$s highlighted in red are not stable.
$$
0110\color{red... | stackexchange_codegolf |
This sentence employs two a’s, two c’s, two d’s, twenty-eight e’s, five f’s, three g’s, eight h’s, eleven i’s, three l’s, two m’s, thirteen n’s, nine o’s, two p’s, five r’s, twenty-five s’s, twenty-three t’s, six v’s, ten w’s, two x’s, five y’s, and one z.
Such sentences are called autograms. Your task is to write a p... | stackexchange_codegolf |
Here in the absolutely made up country Rnccia we have a lot of good stuff, but the roads aren't good. There are lots of holes and only half of them get fixed. Even then, only half of the fixes are well done. Your task is to embrace the bad roads of this country and draw them for me.
Input
You receive two positive integ... | stackexchange_codegolf |
The TAK function is defined as follows for integers \$x\$, \$y\$, \$z\$:
$$
t(x, y, z) = \begin{cases}
y, & \text{if $x \le y$} \\
t(t(x-1,y,z), t(y-1,z,x), t(z-1,x,y)), & \text{otherwise}
\end{cases}
$$
It can be proved that it always terminates and evaluates to the simple function below:
$$
t(x, y, z) = \begin{cases}... | stackexchange_codegolf |
Challenge
Given a sequence of non-negative integers, create a function that output a descendant pyramid where the children are the sum of both parent numbers.
The result is outputted as an string using tab \t.
Note: trailing tabs on each line are not required
1\t\t2\t\t3\n\t3\t\t5\t\n\t\t8\t\t results in
1 2 ... | stackexchange_codegolf |
Introduction
The game takes place in a small world with different towns. The rulers of the towns hate each other and would like to rule the world. The people are divided into two groups, warriors and lowborns. However, lowborns can raise to warriors. You are the ruler of three of these towns.
Gameplay
When the game beg... | stackexchange_codegolf |
In 256 bytes or fewer write a function, \$f\$, from the positive integers to the positive integers that is:
Monotonic: larger inputs always map to larger outputs. (\$a < b \implies f(a) < f(b)\$)
Non-linear: does not have asymptotic order notation \$O(n)\$. (\$\displaystyle\forall c: \exists n:c\cdot n < f(n)\$)
Your... | stackexchange_codegolf |
Given a list of integers find the "trajectory" that results from indefinitely moving the instructed steps to the right (left if negative), wrapping if necessary, starting at the first element.
A "trajectory", here, is defined as a list containing the elements that are visited only one time, in the order they are visite... | stackexchange_codegolf |
I call this sequence "the Jesus sequence", because it is the sum of mod.</pun>
For this sequence, you take all the positive integers m less than the input n, and take the sum of n modulo each m. In other words:
$$a_n = \sum_{m=1}^{n-1}{n\bmod m}$$
For example, take the term 14:
14 % 1 = 0
14 % 2 = 0
14 % 3 = 2
14 % 4 =... | stackexchange_codegolf |
Given a number and either "+" or "*", return an addition or multiplication table with the dimensions of that number.
Specifications
The input will be formatted as dimension, operation.
The program should not return anything if the operation input is not + or *.
The program should not return anything if the dimension i... | stackexchange_codegolf |
Task
Given a string as input, generate a "blurred" version of that string.
Input
Your input will be a single-line string of ASCII characters, containing a minimum of 2 alphanumeric characters
Output
A string that is the "blurred" version of the input string.
A blurred string is one where every alphanumeric character fr... | stackexchange_codegolf |
This problem is an extension of what happens to me on a regular basis: I have to have $1.00 in coins and have to be able to give change to somebody. I discovered rather quickly that the ideal coins to have were 3 quarters, 1 dime, 2 nickels, and 5 pennies. This is the smallest number of coins (11 total) that allows me ... | stackexchange_codegolf |
Challenge
Given a positive integer n, you must calculate the nth digit of \$e\$, where \$e\$ is Euler's number (2.71828...).
The format of the output can be a number or a string (e.g., 3 or '3')
Example
# e = 2.71828...
nthDigit(3) => 8
nthDigit(1) => 7
nthDigit(4) => 2
Shortest code wins.
| stackexchange_codegolf |
The challenge this time is to find the nth Fibohexaprime. The definition of a Fibohexaprime is as following:
We first observe a list with Fibonacci numbers:
N | Fibonacci number
1 | 1
2 | 1
3 | 2
4 | 3
5 | 5
6 | 8
7 | 13
8 | 21
9 | 34
10 | 55
11 | 89
12 | 144
13 | 233
14 | 377
15 | 610
16 | 987 ... | stackexchange_codegolf |
Motivated by this challenge
Background
Let we have a square sheet of flexible material.
Roughly speaking, we may close it on itself four ways:
Here the color marks the edges that connect and the vectors indicate the direction.
The sphere and torus are obtained without flipping the sides, Klein bottle — with one flippi... | stackexchange_codegolf |
In this challenge we considered a frog hopping around a lily pond. To recap the lily pond was represented as a finite list of positive integers. The frog can only jump forward or backwards by a distance equal to the number at its current location. So for example:
[2, 3, 1, 4, 1]
Here the frog is on a 1 so i... | stackexchange_codegolf |
Introduction
In most interpreted languages, there is an operation that will run code generated at runtime. It generally requires alphanumeric characters to refer to this operation. Write a program, using as few alphanumeric characters as possible, that is able to download and execute any string in the language you're w... | stackexchange_codegolf |
Anyone here a die-hard Bethesda fan? Maybe you prefer Obsidian Entertainment? Well, if you're either of those things than the following picture should be relatively familiar to you.
I've taken the liberty of preparing a rather unique ASCII-Art challenge, so here's the first clue as to what I'm going to have you do:
... | stackexchange_codegolf |
Well the title says it all.
Standard loopholes apply
Nothing to read from stdin, and output goes to stdout
1-byte-long programs are... nonsense. They don't qualify
A program with a single byte repeated is also a nonsense (like aaa)
Please mark it out if your program is a palindrome
Sample:
A program with source code... | stackexchange_codegolf |
There was a previous perceptron question but it was closed. Also it required a lot of extra stuff that's not normally part of the perception algorithm like I know it. This question will be much simpler
The Perceptron is a extremely basic classification algorithm. While it still has some limited use it's been mostly ove... | stackexchange_codegolf |
The optimal matrix (for the rather narrow scope of this challenge) is obtained by "zipping" the elements from the corresponding rows and columns of a square matrix and getting the maximum of each pair.
For instance, given the following matrix:
4 5 6
1 7 2
7 3 0
You can combine it with its transpose to get: [[[4,5,6],[... | stackexchange_codegolf |
This is the audio version of the Twitter image encoding challenge.
Design an audio compression format that can represent at least one minute of music in 140 bytes or less of printable UTF-8-encoded text.
Implement it by writing a command-line program that takes the following 3 arguments (after the name of the program i... | stackexchange_codegolf |
Given a word, your task is to compact it by saving its first character and removing any other vowel (aeiou).
Input
Your input can be the word in STDIN, a function argument or any other input format that doesn't break the standard loopholes. You can assume the input only consists of lower characters.
Output
Your output... | stackexchange_codegolf |
Parenthetical names
Your challenge is to build a program that puts parentheses around the 'title' part of names. For example, Sonic the Hedgehog is converted to Sonic (the Hedgehog).
Rules:
Around every the that passes the following rules, an opening parentheses will be added before the the and a corresponding closing... | stackexchange_codegolf |
Carry sort is an \$O(n)\$ "sorting" algorithm. Here's how it works. The algorithm moves left to right along a list. As it traverses a list it "carries" a single item, the largest item it has encountered so far. Once it encounters a larger item it picks up that item and drops the item it is already carrying in place. W... | stackexchange_codegolf |
Given a positive integer n, do the following (and output every stage):
start with a list containing n copies of n.
do the following n times:
at the ith step, gradually decrement the ith entry of the list until it reaches i
So, for example, if the given n is 4, then you start with [4,4,4,4], and then at the first step... | stackexchange_codegolf |
Background: Too many illegal immigrants from Blandia are crossing the border to Astan. The emperor of Astan has tasked you with digging a trench to keep them out, and Blandia must pay for the expenses. Since all typists have been furloughed until the trench is arranged, your code must be as short as possible.*
Task: Gi... | stackexchange_codegolf |
You may have heard of the "Hacker Logo", also called the "Hacker Emblem". It looks like this:
This is a pattern from a mathematical simulation called the Game of Life. The glider is the simplest Life pattern that moves, and the most instantly recognizable of all Life patterns.
The challenge
The challenge is pretty sim... | stackexchange_codegolf |
Introduction
Ah, INTERCAL...
As much as I'd like encourage everyone to Try it Online, text output is just painful.
According to the docs it uses the "Turing Text Model".
While an... interesting concept, using it is about as much fun as shooting yourself in the foot.
And what do we do with a task like this? Automate it.... | stackexchange_codegolf |
A challenge I thought that would be very cool is to make an interpreter for a Turing-complete language of your choosing.
The rules are simple:
You may use any language to create this interpreter even if it is newer than this challenge.
You may use any Turing-complete language as long as it is not the same as the one y... | stackexchange_codegolf |
Similar to the Catalogue of hello world. I want to produce a catalogue of short ways to produce CSV.
CSV Definition
In this case CSV meaning the more literal interpretation of;
A string representation of a list or array separated by commas.
The input types should not be mixed i.e [1, "hello"] is NOT valid input
The out... | stackexchange_codegolf |
Introduction
Long story short: a few days ago I accidentally started knitting a sock and the pretty logical structure of the plain stitches lead me to the idea: Why don't we just ASCII-knit a sock?
Input
The input is an even integer N in the range [2,30].
Output
The output is a sock, obviously.
Structure
Because we wil... | stackexchange_codegolf |
Challenge
Write a program that takes as input a text and output "That's me!" if the input is equal to the program own source code, and "That's not me!" otherwise.
Notes
This is codegolf, in each programming language the shortest program wins.
The input can be taken from program arguments or function argument, and the ... | stackexchange_codegolf |
You are in a one-floor dungeon. There is a treasure which is protected by locked doors. Doors can be opened by finding the corresponding keys. Your goal is to find the shortest path to the treasure.
Input
Input will be a two-dimensional grid representing the initial layout of the dungeon.
###########
#$ # g#
# #... | stackexchange_codegolf |
Task
Your task is to take a character in:
AÁÀÃÂBCÇDEÉÊFGHIÍJKLMNOÕÓÔPQRSTUÚVWXYZaáàãâbcçdeéêfghiíjklmnoõóôpqrstuúvwxyz
and turn it into a characters in:
AAAAABCCDEEEFGHIIJKLMNOOOOPQRSTUUVWXYZaaaaabccdeeefghiijklmnoooopqrstuuvwxyz
by the obvious operation: dropping the accents in the letters.
Input
A character in any se... | stackexchange_codegolf |
The infinite monkey theorem states that, given infinite time, a machine sending an endless stream of random characters will always type any given text.
That sounds to me like a great idea for a challenge.
Process
In order to monkey-ize a string A, the following steps should be taken:
Take an empty string. We will call... | stackexchange_codegolf |
Simple task, write a program/function that returns error if and only if presented with itself.
The program must give a valid output for any input other than itself.
For the error part, you can only use errors already built in errors that comes with your language of choice. New/ self-defined error messages are not allow... | stackexchange_codegolf |
Your task is to take an array of numbers and a real number and return the value at that point in the array. Arrays start at \$\pi\$ and are counted in \$\pi\$ intervals. Thing is, we're actually going to interpolate between elements given the "index". As an example:
Index: 1π 2π 3π 4π 5π 6π
Array: [ 1.1, 1... | stackexchange_codegolf |
You know those riddles where every letter is swapped for another letter?
E.g. you get a text like
JME JG EPP IFAPE EPJE CJPPPC BP,
UIJCG JC EPP EFE GPJB EJIP EJ EJIP,
F EPJIG MPJEPPPP AJUC BJL UP
GJP BL MICJIJMPPJUIP CJMI.
and are supposed to find out that it stands for
OUT OF THE NIGHT THAT COVERS ME,
... | stackexchange_codegolf |
It can be in any language, plus the map must be in the output only not in the source code.
This is my first question here, so please feel free to edit it. Also, there might be some rules about scoreboard which I'm not familiar how to put it here.
Cheers!
| stackexchange_codegolf |
Cop's thread here
In this cops-and-robbers challenge cops will think of a positive integer. They will then write a program or function that outputs one value when provided the number as input and another value for all other positive integer inputs. Cops will then reveal the program in an answer keeping the number a... | stackexchange_codegolf |
Introduction
Connect Four is a game where you attempt to get four in a row: horizontally, vertically, or diagonally. In this code golf, we will be trying to find who won, given a game board. There will always be one winner, and only one winner.
Task
Given a Connect Four board, figure out who the winner is: X or Y. ... | stackexchange_codegolf |
As in this challenge, the task is to generate the vertices of a polyhedron. The polyhedron here is the one obtained by dividing a regular icosahedron's triangular faces into smaller triangles so that each edge is divided into \$b\$ segments (denoted \$\{3,5+\}_{b,0}\$ here) and projecting onto the unit sphere. Your pro... | stackexchange_codegolf |
Introduction:
Some times using a 24-hour clock are formatted in a nice pattern. For these patterns, we'll have four different categories:
All the same (pattern A:AA or AA:AA):
0:00
1:11
2:22
3:33
4:44
5:55
11:11
22:22
Increasing (pattern B:CD or AB:CD, where D==C+1==B+2==A+3):
0:12
1:23
2:34
3:45
4:56
12:34... | stackexchange_codegolf |
Your task is to write a computer program or function that takes a list of nonnegative integers of at least length 2 and determines if they are a "zigzag". A sequence is a zigzag if and only if the numbers alternate in being larger and smaller than the number that comes before them. For example \$[1,2,0,3,2]\$ and \$[... | stackexchange_codegolf |
There are 3 (commonly used) trigonometric functions sin cos and tan each of these functions has an inverse function
You goal is to write 3 programs or functions (one for each inverse trigonometric function asin acos atan) that take a (real) number a input and return the result of the corresponding inverse trigonometric... | stackexchange_codegolf |
Your challenge today is to output a given term of a sequence enumerating all of the integers. The sequence is as follows: If we have a 0-indexed function generating the sequence f(n) and ceil(x) is the ceiling function, then f(0) = 0; abs(f(n)) = ceil(n/2); sign(f(n)) is positive when n and ceil(n/2) are either both ev... | stackexchange_codegolf |
Introduction
Nine-Ball is a popular pool game played casually and as a competitive sport.
There is one of each numbered ball, with the numbers 1 to 9.
The game starts with all 9 of the balls in a diamond shaped rack, like so:
1
2 3
4 9 6
5 7
8
The 1 ball is always at the front of the diamond, and the 9 ball is a... | stackexchange_codegolf |
For this challenge, when given a list of (x,y) points your submission needs to output a polynomial function that goes through all of them.
For example, if your points were [(0,0), (2,5)], you could return y = 2.5*x or y = x + 1/4x^2.
All points passed in will consist only of integers
Two points will never have the sam... | stackexchange_codegolf |
Introduction:
In Dutch, the words leading and suffering, being 'leiden' and 'lijden' respectively, are pronounced the same way. One is written with a "short ei", and one with a "long ij", as we Dutchman would say, but both 'ei' and 'ij' are pronounced [ɛi].
Challenge:
Given a list of numbers, determine which (if any) a... | stackexchange_codegolf |
We do seem to have a fastest square root challenge, but it's very restrictive. In this challenge, your program (or function) will be given an arbitrarily sized nonnegative integer, which is the square of an integer.
Input
You may take input in any normally allowed way, including (but not limited to) an arbitrary sized ... | stackexchange_codegolf |
Given a value x find the smallest numerical value greater than y that is capable of being multiplied and divided by x while retaining all original digits.
The new numbers do not lose digits.
The new numbers do not gain digits.
For example:
Input: x = 2, y = 250000
Original: 285714
Division: 142857
Multiplicat... | stackexchange_codegolf |
This challenge is inspired by Mathematics is fact. Programming is not.
The mathematical notation for a factorial, or a fact is an exclamation mark !. The exclamation mark is also a common symbol for not in many programming languages.
Challenge:
Take a string, containing numerals, and the characters: + ! as input and o... | stackexchange_codegolf |
Create a script that, when run from a console, will display the text already in the console, prior to running.
Challenge
How will the winner of the challenge will be determined?
The golf with the shortest length (in bytes) will win.
Example Input and Output
Input:
(Shown is Windows)
Microsoft Windows [Version 10.... | stackexchange_codegolf |
Task
Given a non-negative number, check if it's odd or even. In case it's even, output that number. Otherwise, throw any exception/error that your language supports, and stop the program.
Example with Python
Input: 1
Output:
Traceback (most recent call last):
File ".code.tio", line 1, in <module>
IfYouWantThenThr... | stackexchange_codegolf |
Gödel's β function takes three natural numbers as arguments.
It is defined as β(x,y,z) = rem(x, 1 + (z + 1) · y) = rem(x, (z · y + y + 1) )
where rem(a, b) denotes the remainder after integer division of a by b.
The β Lemma now states that:
For any sequence of natural numbers (k_0, k_1, … , k_n), there are natural nu... | stackexchange_codegolf |
Let A be an m by n rectangular matrix of positive integers, where m and n are also positive integers.
We are interested in RoD ('Right-or-Down') paths from the upper-left cell of A to the lower right cell; in an RoD path, each successive cell of the path is either one cell to the Right of or one cell Down from the prev... | stackexchange_codegolf |
You are to write a program which outputs a single positive integer \$n\$. The integer may have leading zeros and whitespace, and/or trailing whitespace.
Then, choose a positive integer \$m > 1\$. When the program is repeated exactly \$m\$ times, it should output \$m \times n\$ (and only \$m\times n\$). When repeated an... | stackexchange_codegolf |
You must generate an text stereogram according to an input string containing a paragraph of text, an empty line then the hidden message.
The result will be displayed as a pair of paragraphs, one with different spacing causing the effect of it being raised up when viewed stereographically (An explanation can be found he... | stackexchange_codegolf |
Given a string containing some parentheses and some other ASCII printable characters, like this: (abc((123))(k)) your task is to remove any sets of parentheses that are redundant.
A set of parentheses is redundant if:
It encloses another set of matching parentheses, like ab((123)), or
It encloses the entire string, li... | stackexchange_codegolf |
Your input is a ragged list of positive integers and a positive integer. Your task is to find that positive integer and return it's index, or if the positive integer doesn't exist, indicate it's nonexistence.
How are indices in ragged lists defined? They are simply lists of indices that when used consecutively to index... | stackexchange_codegolf |
I'm sure most of us have seen SQL results in a terminal, all neatly formatted into rows and columns. If you haven't, here's an example:
+----------+-----------+----------------+
| column 1 | column 2 | column 3 |
+----------+-----------+----------------+
| data | more data | even more data |
| etc | jus... | stackexchange_codegolf |
According to Wikipedia, a strongly Darboux function is
one for which the image of every (non-empty) open interval is the whole real line
In other words, a function \$f\$ is strongly Darboux if given 3 arbitrary real numbers \$a\$, \$b\$, and \$y\$, it is always possible to find an \$x\$ between (distinct) \$a\$ and \... | stackexchange_codegolf |
Task
Take in 3 inputs. The length of the wall, the height of the wall and the coverage of the paint. Output how many tins of paint are required.
Output
Since there's no way to purchase 1/3 tin of paint, you'll need to round the amount of paint tins up to the nearest integer.
Assumptions/Stipulations
Only 1 coat of pai... | stackexchange_codegolf |
Your task is to write 2 functions/programs. They may share code.
The first function must, given a string and a character, output a new string that does not contain that character.
The second function must, given the string from the previous function and the excluded character, reconstruct the original string.
All input... | stackexchange_codegolf |
Definition
In Mathematics, Harmonic Sequence refers to a sequence where
$$a_n = \frac 1 n$$
i.e. the \$n_{th}\$ term of the sequence equals the reciprocal of \$n\$.
Introduction
In this challenge, given a positive integer \$n\$ as input, output the Partial Sum of first \$n\$ terms of the Harmonic Sequence.
Input
Yo... | stackexchange_codegolf |
Monday numbers, as defined by Gamow in this question over on Puzzling, are positive integers N with the following three properties:
The decimal representation of N does not contain the digit 0
The decimal representation of N does not contain any digit twice
N is divisible by every digit D that occurs in its decimal re... | stackexchange_codegolf |
Input: A string
Output: The rarity of the string, as described below.
To find the rarity of a string, follow the steps below.
Start with 0.
Subtract 3 for each E, A, T, or O in the string.
Subtract 2 for each I, N, S, or H in the string.
Subtract 1 for each R, D, L, or C in the string.
Add 1 for each W, F, G, or Y in ... | stackexchange_codegolf |
Sandboxed and made less complicated and hopefully more fun.
Summary of the challenge
Given a number of particles, either identical bosons or identical fermions, output the total wave function of the state assuming they are all independent.
Physics background
Don't worry, you don't need to know quantum mechanics to solv... | stackexchange_codegolf |
Pseudo-Quantum Bogosort
Quantum Bogosort is as follows:
Quantumly randomise the list, such that there is no way of knowing what order the list is in until it is observed. This will divide the universe into O(n!) universes; however, the division has no cost, as it happens constantly anyway.
If the list is not sorted, ... | stackexchange_codegolf |
Quylthulg is a language by Chris Pressey that attempts to solve the problem of infix notation using what it calls panfix:
like postfix, panfix does not require the deployment of arcane contrivances such as parentheses to override a default operator precedence. At the same time, panfix allows terms to be specified in t... | stackexchange_codegolf |
Your program should take as input a number n that is greater than 0 and output a bar composed of n // 8 ▉ characters (U+2588), as well as a final character which should be one of ▉ ▊ ▋ ▌ ▍ ▎▏(U+2589 to U+258F) representing n % 8. If n % 8 is 0, your program should not output any additional characters. This is difficult... | stackexchange_codegolf |
Introduction
Santa has too many names to process, and needs your help! He needs you to write a program or a function, which outputs nice, naughty, very naughty or very very naughty. To determine how nice or naughty someone is, Santa had developed an algorithm:
Nice (division, math):
First of all, we obtain a number fro... | stackexchange_codegolf |
Introduction: Combinatory Logic
Combinatory logic (CL) is based off of things called combinators, which are basically functions. There are two basic "built-in" combinators, S and K, which will be explained later.
Left-associativity
CL is left-associative, which means brackets (containing stuff) which are at the far-lef... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
I've got an infinite supply of \$n\$-dimensional chocolate for some positive integer \$n\$. The shape of the chocolate is not important. You may assume that they are just \$n\$-dimensional hypercubes with side length \$1\$.
To celebrat... | stackexchange_codegolf |
Thunno 2 is a stack-based golfing language with around 400 commands (achieved through overloads) created by me, The Thonnu.
It seems like a good idea to share some tips for golfing in Thunno 2.
Please, one tip per answer, and no tips like “remove comments and whitespace”.
Links:
Tutorial
List of commands
Attempt This... | stackexchange_codegolf |
This is the logo for LAPACK, a widely used software library for numerical linear algebra.
Your task is to print the logo (color and matrix brackets not required) as this exact string. Trailing newline is allowed.
L A P A C K
L -A P -A C -K
L A P A -C -K
L -A P -A -C K
L A -P -A C K
L -A -P A C -K
| stackexchange_codegolf |
This challenge was inspired by Yeah But No But Yeah.
maxb´s colleague recently sent him the following piece of JavaScript as a joke:
let butScript = (nrOfButs) => {
for(var i = 0; i < nrOfButs; i++){
if(i % 3 == 0){
console.log("Yeah")
}
if(i % 2 == 0){
console.log("... | stackexchange_codegolf |
Write a program or function which, given a non-empty sequence of right or left turns, outputs the length of the shortest self-avoiding path on a 2D lattice with those turns.
The input should be taken as a string, with each character being R or L for a right or left turn respectively.
The output should be an integer, th... | stackexchange_codegolf |
Background
Most of you know what a Fibonacci number is. Some of you may know that all positive integers can be represented as a sum of one or more distinct Fibonacci numbers, according to Zeckendorf's Theorem. If the number of terms in the optimal Zeckendorf Representation of an integer n is itself a Fibonacci number, ... | stackexchange_codegolf |
You are given a string \$s\$ of characters from a to z. Your task is to count how many unique strings of length \$n\$ you can make by concatenating multiple prefixes of the string \$s\$ together.
Since the result can be superlative you can either choose to output the whole result, the result mod \$2^{32}\$ or the resul... | stackexchange_codegolf |
Time for you to implement my new stack based language! It's called StackyMath. This will be a stack based language with 8 operations on the stack and ways to add numbers to the stack.
List of operations:
/: Division. Performed on the top 2 numbers of the stack. Pushes the result back on the stack.
*: Multiplication. P... | stackexchange_codegolf |
Calculate a product or ratio of SI units.
For example, kg m / s s (kilogram-meter per second squared) should return N (newton).
The input will always be either:
A list of symbols for SI units, space-separated (representing a product) or
The above, /, and the above (representing a ratio).
The input will never contain ... | stackexchange_codegolf |
Martin Ender's 2D programming language Alice has two different modes depending on what orientation the IP has: orthogonal (Cardinal mode) or diagonal (Ordinal mode). Commands in Alice change their meaning depending on which mode the program is in when they're executed. One especially interesting implementation of this ... | stackexchange_codegolf |
This is a cops-and-robbers challenge based around defining languages and proving they are Turing complete.
This is the robbers' thread. The cops' thread is here.
Robbers
The cops will post definitions of Turing-complete languages. Your task is to crack them by proving that they are indeed Turing complete. See the cops'... | stackexchange_codegolf |
Goal:
Given two natural numbers (integers from 0 to infinity), output a number that is not the sum of those numbers, but is a natural number.
Example solutions (TI-Basic):
A+B+1
not(A+B)
Invalid solutions:
A+B-1 (for inputs 0,0, it returns -1, which is not natural)
"ABC" (ABC is not a number)
Notes:
The output... | stackexchange_codegolf |
Daylight saving time (DST), is the practice of advancing clocks (typically by one hour) during warmer months so that darkness falls at a later clock time. The typical implementation of DST is to set clocks forward by one hour in the spring ("spring forward") and set clocks back by one hour in autumn ("fall back") to re... | stackexchange_codegolf |
Given a non-negative integer Excel-style date code, return the corresponding "date" in any reasonable form that clearly shows year, month, and "day".
Trivial, you may think. Did you notice the "scare quotes"? I used those because Excel has some quirks. Excel counts days with number 1 for January 1st, 1900, but as if 19... | stackexchange_codegolf |
The task
Today's special offer: consonants and punctuation for FREE!
Your program or function will be given as input the first 6 paragraphs of Lewis Carroll's famous novel Alice's Adventures in Wonderland, with all vowels [aeiouAEIOU] removed and all other characters left intact.
It must output the original text, byte-... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.