instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Given a sequence of three integers, determine if the sequence is arithmetic (of the form [a, a+d, a+2*d]) or geometric (of the form [a, a*r, a*r^2]) by outputting a fourth term that completes it (a+3*d for arithmetic, a*r^3 for geometric).
Examples:
[1, 2, 3] -> 4 (This is an arithmetic sequence with a difference of 1)... | stackexchange_codegolf |
Inspired by this 3Blue1Brown video
Given a square matrix \$ M \$, compute its matrix exponential \$ \exp(M) \$, which is defined, using an extension of the Maclaurin series for \$ e^x \$, as
$$ \exp(M) = \sum_{r=0}^\infty \frac {M^r} {r!} = M^0 + M^1 + \frac 1 2 M^2 + \frac 1 6 M^3 + \cdots + \frac 1 {n!} M^n + \cdots ... | stackexchange_codegolf |
Given an input string, output at random the unique combinations with repetition of the characters in the input string, from length 1 up to the length of the input string, with an equal chance of each one occurring.
Example: given the input abcd (or any combination thereof of the four characters a,b,c,d) , there is an e... | stackexchange_codegolf |
Letters of the words want fairness.
They decided to appear same number of times in a sentence equally.
Example:
Priorities
Will become:
Ppprrioooritttieeesss
Each letter appears 3 times, as the most common letter was i, appearing 3 times.
It does not matter where you put the repeated letters, as long as they are next... | stackexchange_codegolf |
Your program must print out this exact sequence:
1
2
4
10
24
54
116
242
496
1006
2028
4074
8168
16358
32740
65506
131040
262110
NOPE!
As usual, shortest program wins. Standard code golf rules apply.
| stackexchange_codegolf |
Write an \$n\$-bytes program \$AB\$ such that:
it outputs an integer \$x,\ 0\lt x\lt n\$;
both its \$x\$-byte prefix \$A\$ and \$(n-x)\$-byte suffix \$B\$, when run as programs, output \$AB\$.
\$A, B\$ and \$AB\$ should:
run in the same language
not take any input
use the same output method
This is code-golf, so th... | stackexchange_codegolf |
Given a number from 1 to 24, output the kissing number to the best of current knowledge (some numbers will have more than one acceptable output). Knowledge of geometry is not essential as the outputs are all listed below.
From the Wikipedia page on the Kissing Number Problem:
a kissing number is defined as the number ... | stackexchange_codegolf |
Definition
The maxima and minima of a given function are the largest and smallest values of the function either within a given range or otherwise within the entire domain of the function.
Challenge
The challenge is to find the local maxima and minima of a given polynomial function using any method you may like. Don't w... | stackexchange_codegolf |
An incremental word chain is a sequence of words of a vocabulary such that each word is the result of either prepending or appending a single character to the previous word, ignoring capitalization. An example of such a chain can be found below.
I → is → his → hiss
Your task is to write a program that for a given voc... | stackexchange_codegolf |
Context
In APL, trains are tacit sequences of monadic/dyadic functions that can be called with one or two arguments. We'll code something to check if a given train follows the correct structure we need in order to have a sound train.
Task
Given the sequence of function arities in the train, determine if the train is va... | stackexchange_codegolf |
Most square numbers have at least 1 different square number with which their Levenshtein distance is exactly 1. For a given square \$x\$, each square that meets this condition is called a Levenshtein neighbour of \$x\$. For example, \$36\$ is a Levenshtein neighbour of \$16\$, as only 1 edit (\$1 \to 3\$) is required. ... | stackexchange_codegolf |
A binary relation on a set \$X\$ is simply a subset \$S \subseteq X \times X\$; in other words, a relation is a collection of pairs \$(x,y)\$ such that both \$x\$ and \$y\$ are in \$X\$. The number of different relations grows quickly with the size of the set: if \$X\$ contains \$n\$ elements, there are \$2^{n^2}\$ bin... | stackexchange_codegolf |
Here's the phonetic alphabet:
Alfa
Bravo
Charlie
Delta
Echo
Foxtrot
Golf
Hotel
India
Juliett
Kilo
Lima
Mike
November
Oscar
Papa
Quebec
Romeo
Sierra
Tango
Uniform
Victor
Whiskey
X-ray
Yankee
Zulu
In the fewest bytes possible:
Input will be these words in a random order, with the first letters removed.
Your goal is to... | stackexchange_codegolf |
Background
A binary tree is a rooted tree whose every node has at most two children.
A labelled binary tree is a binary tree whose every node is labelled with a positive integer; moreover, all labels are distinct.
A BST (binary search tree) is a labelled binary tree in which the label of each node is greater than the l... | stackexchange_codegolf |
This code golf challenge is to show directions through numbers.
When the user enters a number, then that means a direction change as follows:
0 means stay still
1 means forward (initially from left to right and initially start with `:`)
2 means turn right
3 means turn left
4 means go backward
I will show you an exampl... | stackexchange_codegolf |
Challenge
Calculate the strange sum of two natural numbers (also known as lunar addition):
Given \$A=...a_2 a_1 a_0\$ and \$B=... b_2 b_1 b_0\$ two natural numbers written in the decimal base, the strange sum is defined, based on the maximum operation, as:
\$A+B=... \max(a_2,b_2) \max(a_1,b_1) \max(a_0,b_0)\$
... ... | stackexchange_codegolf |
Challenge
You just entered a room. Here's how it looks (you are the X):
|\ /|
| \/ |
| X |
| |
|----|
You challenge yourself to see if you can reach where you started by following the walls. You go right until you find a wall. Then, you turn clockwise until you are facing parallel to the wall.
For example, if you... | stackexchange_codegolf |
The Challenge
Given a grid of numbers (10 <= N <= 99)
Return number with the highest sum of the four numbers adjacent to it; that is the numbers above, below, right, and left of the number, but not itself.
The number itself does not count, only its four neighbors.
A number on the edge should be treated as though the m... | stackexchange_codegolf |
Consider a square grid on the plane, with unit spacing. A line segment of integer length \$L\$ is dropped at an arbitrary position with arbitrary orientation. The segment is said to "touch" a square if it intersects the interior of the square (not just its border).
The challenge
What is the maximum number of squares th... | stackexchange_codegolf |
Given the input tilesX and tilesY create a method that would make a rectangular ring from the tiles.
The function must order the tiles in a ring like this:
tilesX and tilesY are always positive integer values, cannot be 0
tilesX and tilesY are not always equal, expect values like: 2x5, 6x3 etc.
Checking for invalid i... | stackexchange_codegolf |
Adapted from tips for restricted-source in Python
Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the zsh language. While we already have a place to collect all these tips for code-golf, those for restricted-source remain transmitted by word of mouth or hidden deep within the ... | stackexchange_codegolf |
For this challenge, a linked list looks like this:
[1, 2, 4, 0, 6, 1, 3, 1]
You'll notice there's no data; each item in the list is just a reference to the index of the next one. Your task is to write a program or function which will follow a linked list like this forever, outputting each item as it is encountered. Fo... | stackexchange_codegolf |
Introduction
This challenge is inspired by the Meta Stack Exchange question The longest consecutive days streak; it turns out that the URL https://codegolf.stackexchange.com/users/daily-site-access/[user id], where the last number is your user ID (found in the URL of your profile) contains information about which days ... | stackexchange_codegolf |
Challenge
Create 2 programs A and B
The output of program A is exactly program B
The output of program B is exactly program A
Neither program should depend on inputs to yield the correct output
A and B are not identical programs
A and B are of different programming languages
Neither program may be equivalent to i... | stackexchange_codegolf |
Write a function that takes an ASCII-printable-only (all charcodes ∈ [32..126]) string input x and provides an ASCII-printable-only output string f(x), such that for every x
f(f(x))=x
f(x) is all-numeric (all charcodes ∈ [48..57]) iff x is not all-numeric
You can assume input is not empty and never provide empty outp... | 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 |
Problem
A fact you may have noticed about factorials is that as \$n\$ gets larger \$n!\$ will have an increasing number of \$0\$s at the end of it's base \$10\$ representation. In fact this is true for any base.
In this challenge you will be given a base \$b > 1\$ and an integer \$n > 0\$ and you will determine the sm... | stackexchange_codegolf |
Description
Write a function f(m, G) that accepts as its arguments a mapping m, and a set/list of distinct, non-negative integers G.
m should map pairs of integers in G to new integers in G. (G, m) is guaranteed to form a finite abelian group, but any element of G may be the identity.
There is an important theorem that... | stackexchange_codegolf |
In this challenge, you'll create some programs which behave similarly to genes. When you run one, it will return one of its two "alleles" (a half of its source code), and concatenating any two alleles from your programs will result in a new, functioning program (which returns its own alleles).
As an example, say you wr... | stackexchange_codegolf |
In exactly 1024 characters, no more, no less:
Must print Hello World.
Must not use unnecessary whitespace.
Must not use comments.
Judging should favor creativity and/or humor over simple obfuscation when voting up answers.
The earliest I will select an answer is the 11th (Sunday) of November (2012). I'm seeing s... | stackexchange_codegolf |
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 sequence of positive integers, units and operators in RPN (postfix) notation, while checking whether the units are comp... | stackexchange_codegolf |
From the wikipedia:
Net neutrality is the principle that Internet service providers and governments regulating the Internet should treat all data on the Internet the same, not discriminating or charging differentially by user, content, website, platform, application, type of attached equipment, or mode of communicatio... | stackexchange_codegolf |
Given a grid of directions and a start and end position, determine the minimum number of substitutions in the direction grid that needs to be made to complete the path between the two points. The grid is doubly-cylindrical. This is clearer given an example.
Example
Let's take the following grid as an example:
>>>>v
>>>... | stackexchange_codegolf |
In Dungeons & Dragons 5th edition (as well as most other editions), there exists a magic item called the Deck of Many Things. It is an incredibly powerful item, as the cards all have very strong positive or negative effects. To use the deck, a character declares a number, and then draws up to that number of cards, with... | stackexchange_codegolf |
This is an answer chaining puzzle, where each answer must add on to the last.
The \$n\$th submission must output its own source code in the \$n\$th language and the \$n−1\$ languages before it.
A language can be either a dialect or a major version of a language, so Python version 2.121 is only counted as version 2 and ... | stackexchange_codegolf |
On PPCG, we have had lots of challenges where the length of your output is dependent on the length of your source code. For the purposes of this challenge, we will call these Source-length problems. The two most well known examples of source-length problems are
Output with the same length as the code (the 1X source-l... | stackexchange_codegolf |
Inspired by I reverse the source code, ...
Your task, if you wish to accept it, is to reverse text and mirror select characters. Yes, yes, I know. Very surprising.
Input
A string, stdin, an array of characters, or any other source of text. All characters of the input are guaranteed to be in the printable ASCII range (3... | stackexchange_codegolf |
You are on an advanced intergalactic space station. A friend of yours who is minoring in the Study of Gravity just created a game that involves using microgravity as a way to move a ball around.
She hands you a small controller with four directional arrows on it and a maze like structure with a ball sitting to the lef... | stackexchange_codegolf |
Seeing that the current language for Learn You a Lang for Great Good is Piet, and that we don't seem to have a tips page for Piet yet, I decided to make one.
Piet is a stack-based esoteric programming language in which the programs are meant to resemble abstract drawings.
What are some general tips for golfing in Piet?... | stackexchange_codegolf |
Find what is the distance for a given string to its closest palindrome of the same length.
For this task I decided to give the characters further away from the string's center more weight (think of it as contributing more torque), proportional to their distance to the center.
Let's define the palindrome distance for a ... | stackexchange_codegolf |
The cardinality of the set \$\mathbb Q\$ of rational numbers is known to be exactly the same as that of the set \$\mathbb Z\$ of integers. This means that it is possible to construct a bijection between these sets—a mapping such that each integer corresponds to exactly one rational number, and vice versa.
Provide such ... | stackexchange_codegolf |
Introduction
Some time ago, I need to write function which split string in some specific way. At the first look, task looks trivial, but it was not so easy - especially when I want to decrease code size.
Challenge
As example we have following input string (it can be arbitrary)
Lorem ipsum dolor sit amet consectetur ad... | stackexchange_codegolf |
As input you will be given a ragged list of positive integers containing at least one integer at some level. For example:
[[],[[1,2,[3]]],[]]
You should output the depth of the least deep integer. For example if the input is just a list of integers, then the every integer is 1 level deep so the answer is 1. There m... | stackexchange_codegolf |
Challenge
Giving a valid arithmetic sum with some missing numbers, output the full expression.
Example:
1#3 123
+ 45# => + 456
-------- --------
579 579
Input
Expression format can be an array ["1#3", "45#", "579"], a string "1#3+45#=579", or 3 inputs f... | stackexchange_codegolf |
Background
Lambda calculus is a model of computation using lambda terms.
A variable \$x\$ is a lambda term.
If \$E\$ is a lambda term, the lambda abstraction \$\lambda x. E\$ is a lambda term.
If \$E_1, E_2\$ are lambda terms, the lambda application \$E_1 E_2\$ is a lambda term.
The rule of computation is called \$\b... | stackexchange_codegolf |
I noticed a certain game had a peculiar life counter, which instead of stopping at 999, gained a new digit – the next number was crown hundred or 00. After 99 came crown hundred crownty (0) and the last number, after 9, was crown hundred crownty crown or , which would be 1110 in decimal.
Your task is to write a program... | stackexchange_codegolf |
Input
The input will be a year between 1583 and 2239. We just want to know when Hannukah was or will be in that year. This is information used by millions of people every year and put in calendars across the world. What could be easier?
Output
The Gregorian date of the first evening of Hannukah that year. That is the ... | stackexchange_codegolf |
The world of art is full of colour, but the world of the network is even fuller than the world of art of diferent colours and it's renderings. That's why we need to know how to convert one type of colour format to another.
The challenge is self-evident:
Write a program / function than converts an given HEX code (#00ff0... | stackexchange_codegolf |
Not to be confused with Password Bishop Goodness!
Given a string, answer (truthy/falsy or two consistent values) if it constitutes a password which is strong against bishops.
A password is strong against bishops if it is a string consisting of alternating letters (in a-h) and digits (in 1-8) such that each pair of char... | stackexchange_codegolf |
Your task, is simply to multiply 2 integers given in input, separated by a ",". The catch is, you cannot use the multiplication operator "*", even if it is being used differently, or any loops whatsoever
This is code-golf, so shortest code wins!
Test cases: i dont know if you even need it! lol
1,0 -> 0
5,6 -> 30
3920,5... | stackexchange_codegolf |
Your task is, given x, output 2*x. Easy right!? But there's a catch: x will be given as a (possibly infinite) continued fraction, and the output must be a continued fraction. The input is guaranteed to be a real algebraic number whose degree is at most 2.
Input: The continued fraction of x. This is split into 3 parts: ... | stackexchange_codegolf |
In this challenge you will write code to take a list of positive integers and output all maximal linear sublists.
A sublist is is a list which can be created by deleting values from the the input list. Sublists have more structure than just lists. They in a way "remember" which values are deleted.
Similarly we say tha... | stackexchange_codegolf |
This is a cops-and-robbers challenge based around defining languages and proving they are Turing complete.
This is the cops' thread. The robbers' thread is here.
Cops
As a cop, you will prepare two things:
A formal specification of a programming language, or other computational system. (Computational systems are defin... | stackexchange_codegolf |
Introduction
Inspired by Dyalog Ltd.'s 2016 student competition. The challenge there is to write good APL code, but this is a code-golf and it is open to all languages. Derived from this closed challenge.
The real challenge here is to combine the various (quite trivial) parts of the problem in a byte-efficient way by r... | stackexchange_codegolf |
Your task is to write the shortest algorithm in a language of your choosing that accomplishes the following:
Given two matrices it must return the euclidean distance matrix. The euclidean distance between two points in the same coordinate system can be described by the following equation:
\$D = \sqrt{ (x_2-x_1)^2 + (y_... | stackexchange_codegolf |
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Each tile is either a mine (represented by *) or a clue, i.e. a number from 0 to 8 representing how many of the 8 neighboring tiles are mines. Your task today is to take a board containing the mines and... | stackexchange_codegolf |
Presumably everybody here knows that for the legacy BIOS, the tiniest bootable disk image is 512 bytes (the lower bound is due to the 2-byte magic at offset 510), and there is a bootsector demoscene where people try to fit the entire demo into the 510 bytes of usable space.
Now that the BIOS is being superseded by UEFI... | stackexchange_codegolf |
Given a string, first square it as follows:
First, write the string.
abcde
Next, write the string rotated one left.
abcde
bcdea
Keep doing this until you have written len(string) lines.
abcde
bcdea
cdeab
deabc
eabcd
Now, read from the string like this:
----+
+--+|
|+>||
|+-+|
+---+
Which gives:
abcdeabcdcbaedcbcdea... | stackexchange_codegolf |
The recent volume of MAA's Mathematics Magazine had an article "Connecting the Dots: Maximal Polygons on a Square Grid" by Sam Chow, Ayla Gafni, and Paul Gafni about making (very convex) \$n^2\$-gons where each vertex is a different point of the \$n \times n\$ grid.
One is not allowed to have two consecutive segments ... | stackexchange_codegolf |
You must make a regex that matches everything except itself. For example, PPCG must not match PPCG, but must match everything else, like something, PPC, and PPCG!.
Surrounding slashes are not considered part of the regex in flavors where they are usually part of the syntax. The same is true of all delimiters.
The rege... | stackexchange_codegolf |
Task:
Make a random number generator. The catch is that you can't use any built-in randomness functions. Your random numbers must be anything between 0 and 100, though they do not have to be floating point.
Rules:
It must produce a pseudorandom number.
Randomness defined: If you run it x times, then x times again, the... | stackexchange_codegolf |
In this challenge you are going to place letters from the alphabet in a Cartesian plane and output the result as a text.
Your input will consist in a list of list with 3 parameters:
X coordinate
Y coordinate
String
How?
We know that a Cartesian plane contain 2 axes \$(X, Y)\$ and 4 quadrants where the signs of the \... | stackexchange_codegolf |
Getting the area covered by a rectangle is really easy; just multiply its height by its width. However in this challenge we will be getting the area covered by multiple rectangles. This is equally easy ... so long as the rectangles don't overlap.
If the rectangles don't overlap the total area covered is the sum of th... | stackexchange_codegolf |
Given a list of positive integers such as [69, 420], your challenge is to generate the sequence of numbers that can be formed by concatenating numbers from the above set, in ascending numerical order.
For example, with [69, 420] the sequence begins:
69
420
6969
42069
69420
420420
Note that elements of the sequence sho... | 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 |
Introduction
This challenge is similar to Project Euler problems. I came up with it because I was playing a deceivingly simple board game and couldn't come up with an efficient solution to answer a simple question about its mechanics.
Quarto is a fun variant of 4 in a row. It is played on a 4 by 4 board with 16 unique ... | stackexchange_codegolf |
Curry is the Language of the Month this month and some users are starting to get into it, so let's get some tips together.
Haskell and Curry are similar in a lot of ways and a lot of tips for Haskell work well in Curry and vice versa. So I'd like in this question to gather tips for code-golf in Curry, that would be use... | stackexchange_codegolf |
Mahjong is a tabletop game played using tiles. It features three "number" suits (pins, sous, mans, represented as p, s and m) from 1 to 9, and one "honor" suit z of seven distinct tiles. Note that contrary to western card games, tiles are not unique.
To complete a hand and win, the 13 tiles in your hand are combined w... | stackexchange_codegolf |
Golomb rulers are sets of non-negative integers such that no two pairs of integers in the set are the same distance apart.
For example, [0, 1, 4, 6] is a Golomb ruler because all distances between two integers in this set are unique:
0, 1 -> distance 1
0, 4 -> distance 4
0, 6 -> distance 6
1, 4 -> distance 3
1, 6 -> di... | stackexchange_codegolf |
Write a program or function that fulfills the following
Scores less than 101 bytes under normal code-golf rules
Takes no input1 and always outputs a single integer.
Every integer is a possible output.
Your score will be the probability of the most frequent integer occurring, with a lower scoring being the goal. That... | stackexchange_codegolf |
Introduction
All these snakes everywhere! I've had enough, and have decided that I much prefer camels. Therefore, I want you to convert my snakes to camels for me.
Challenge
Turn any snake_case string into a camelCase string.
Capitals should be returned to lowercase before the conversion occurs.
Test Cases
In: camel_c... | stackexchange_codegolf |
Everybody loves golfing code. Code is written in English (eh...). Therefore, everybody loves golfing English!
Your task is to write a program or function that takes a string as input, and then returns or prints the golfed version. There will be no newlines or tabs in the input.
This is how you golf a string. The order... | stackexchange_codegolf |
Gamma function is defined as
It is a well-known fact that for positive integers it coincides with a properly shifted factorial function: Γ(n) = (n - 1)!. However, a less famous fact is
Γ(1/2) = π1/2
Actually, the Gamma function can be evaluated for all half-integer arguments, and the result is a rational number mult... | stackexchange_codegolf |
Given a PPCG User ID, output that user's current username.
Examples
Input -> Output
61563 -> MD XF
2 -> Geoff Dalgas
12012 -> Dennis
foo ->
-3 ->
Rules
Input/output can be taken via any allowed means.
The output must be the full username with proper capitalization and spacing, nothing more and nothing less... | stackexchange_codegolf |
Overview
As most of y'all who visit chat know, I am Russian by ethnicity[citation not needed]. Recently, I switched from a keyboard that maps the letters 1-to-1 (mnemonic) to Windows' default mnemonic keyboard. Here are the letter mappings:
"`" -> "ъ"
"q" -> "я"
"w" -> "ш"
"e" -> "е"
"r" -> "р"
"t" -> "т"
"u" -> "у"
"i... | stackexchange_codegolf |
It's a well-known fact that Fermat's Last Theorem is true. More specifically, that for any integer \$n \gt 2\$, there are no three integers \$a, b, c\$ such that
$$a^n + b^n = c^n$$
However, there are a number of near misses. For example,
$$6^3 + 8^3 = 9^3 - 1$$
We'll call a triple of integers \$(a, b, c)\$ a "Fermat n... | stackexchange_codegolf |
Today's challenge is simple: Without taking any input, output any valid sudoku board.
In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like:
The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid (... | stackexchange_codegolf |
Introduction
Forte is a very peculiar esoteric language based on the concept of modifying the values of numbers. In Forte numbers are not constants but variables, you can use the LET instruction to assign new values to them.
For example, after executing LET 2=4-1 from now on 2 assumes the value of 3, which means that w... | stackexchange_codegolf |
This challenge is inspired by turn based videogames like "Heroes of Might and Magic"
Implement this game mechanic:
There is some units(Imps, Swordsmans etc...) in our game
Every unit have an integer "initiative"
Your program must decide which unit's turn now - based on unit's initiative
The more initiative means mor... | stackexchange_codegolf |
Challenge
Given two lists of strings where each string is of length 50 and each list is also of length 50 generate the shortest regex you can that fully matches all the strings in the first list and does not match any of the strings in the second list.
Scoring
Your score will be the average length of the regexes your p... | stackexchange_codegolf |
A cruise control has 3 different options to move the handle to set the speed you want to drive with.
Towards you: Adds 1 speed.
Upwards: Increases speed to the next multiple of 10 (e.g. 20-->30, 32-->40)
Downwards: Decreases speed to the next multiple of 10 (e.g. 20-->10, 32-->30)
Input
2 integers: the first is the ... | stackexchange_codegolf |
Your task, if you choose to accept it, is to write a program/function that accepts an integer \$N\$ as input. The program/function should output/return a list of the first \$N\$ prime numbers. But here's the catch: you are not allowed to use prime characters in your code. A prime character is a character whose Unicode ... | stackexchange_codegolf |
Almost six years ago, fellow PPCG member steenslag posted the following challenge:
In a standard dice (die) the numbers are arranged so that opposite
faces add to seven. Write the shortest possible program in your
preferred language which outputs a random throw followed by 9 random
tippings. A tipping is a quart... | stackexchange_codegolf |
Given a random code written using Brainfuck commands. You program should translate that code into the following ascii art: each Brainfuck command represents as 5x9 array of A and B symbols. All commands are concatenated with 5x3 arrays of A symbols. Symbols A and B you choose yourself.
For example, when input is ><+,.[... | stackexchange_codegolf |
As we learned from The Holy Numbers, there are 5 holy digits (0, 4, 6, 8, 9), and positive integers consisting solely of those digits are holy. Additionally, the holiness of a number is the sum of the holes in the number (+2 for every 0 or 8, and +1 otherwise).
Now, there is an additional property to take into consider... | stackexchange_codegolf |
You have to decompose a positive integer/fraction as a product of powers of factorials of prime numbers.
For example
22 = (11!)^1 × (7!)^(−1) × (5!)^(−1) × (3!)^(−1) × (2!)^1
10/9 = (5!)^1 × (3!)^(−3) × (2!)^1
Use this special notation: prime number#power
to denote each term, e.g. (11!)^4 is denoted as 11#4.
Output... | stackexchange_codegolf |
It's likely that anyone who used Twitter a couple of months ago would know about the 'Howdy! I'm the sheriff of X" meme. Where a simple image of a sheriff is drawn with emoji, and changes to fit a theme. So I thought it was time for the Sheriff of Code Golf. Here he is:
###
#####
###
###
###
#
... | stackexchange_codegolf |
Print this text:
_________
| |
| |
| |
|_________|
Shortest code wins. Notice the space at the start of the first line.
| stackexchange_codegolf |
Given a positive integer N, your task is to return the number of steps required by the following algorithm to reach N:
Find the smallest triangular number Ti such that Ti ≥ N. Build the corresponding list L = [ 1, 2, ..., i ].
While the sum of the terms of L is greater than N, remove the first term from the list.
If t... | stackexchange_codegolf |
Background
This is a follow up question to the question: Will the Hydra finally die?
As before a dangerous A Medusa have released a dangerous Hydra which is revived unless the exact number of heads it have is removed. The knights can remove a certain number of heads with each type of attack, and each attack causes a sp... | stackexchange_codegolf |
EDIT: I'm getting a lot of comments about this not terminating - I will give the "correct answer" tag to either the first person who gives me FF(3) (as in provides it in their answer) or proves that FF(3) does indeed blow up indefinitely.
Task:
Your task is make the smallest program possible that generates the list of ... | stackexchange_codegolf |
Challenge
Write a program that compresses and decompresses ASCII text losslessly. It should be specialized to work well with palindromes, including case-insensitive and punctuation-insensitive palindromes. The best compression with the smallest source wins.
Scoring
total_bytes_saved / sqrt(program_size) - Highest score... | stackexchange_codegolf |
Challenge
We once had a challenge to count domino tilings of m by n grid, and we all know that, for any fixed number of rows, the number of domino tilings by columns forms a linear recurrence. Then why not have a challenge to compute the linear recurrence?!
Let's define \$D_m(n)\$ as the number of domino tilings on a g... | stackexchange_codegolf |
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 sum them up, then sort the best pairs ordered by the absolute distance to 100 in ascending order. Paired up integers from each list shall not be repeated in the output.
For instance, we have
... | stackexchange_codegolf |
Inspired (like 2 others) by this chat message. (and to some extent, my CMC)
Given a string as an input, your task is to check whether or not that string is a number.
What is a number?
This is a list of all input formats that are "numbers":
Integers: An integer is a string made entirely of characters from 1234567890, w... | stackexchange_codegolf |
The Roman numeral for 499 is usually given as CDXCIX which breaks down as CD + XC + IX = 400 + 90 + 9 where numerals like CD and IX are written using subtractive notation. Some programming languages have a roman() function that extends this subtractive notation through various relaxation levels. From Google Sheets docu... | stackexchange_codegolf |
Marshall Lochbaum's online BQN REPL has an interesting(and aesthetically pleasing) method of displaying arrays. Your task is to implement a version with simpler rules.
[2,[3],4,[[[6,[5],7]]]]
becomes:
┌─
· 2 ┌· 4 ┌·
· 3 · ┌·
┘ ... | stackexchange_codegolf |
A redox reaction is a chemical reaction in which elements transfer electrons. One element loses electrons, while another gains electrons. Oxidation is the process where an element loses electrons, and reduction is the process where an element gains electrons. Since electrons have a negative charge, the oxidation number... | stackexchange_codegolf |
Write a regex that only matches valid country code top level domains (ccTLDs). Your regex must match both the domains with the dot and without the dot (it must match tv and .tv). Any domain that is not a ccTLD or does not exist (e.g. .info or .jobs or .xz) must not be matched.
Use Perl, POSIX, PCRE or Python.
For refer... | stackexchange_codegolf |
xkcd is everyone's favorite webcomic, and you will be writing a program that will bring a little bit more humor to us all.
Your objective in this challenge is to write a program which will take a number as input and display that xkcd and its title-text (mousover text).
Input
Your program will take a positive integer a... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.