instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Basically the tron light-cycle game as a king of the hill competition! Leaderboard Updated as of 2022-04-05 #1) Player Avoid by Agent Biscutt #2) Dodge West by Imanton1 #3) Space Finder by Spitemaster #4) Blind Bot by TheSilican Judge/Leaderboard Website The Game Players will write bots that compete in a light-cyc...
stackexchange_codegolf
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.
stackexchange_codegolf
Background Some holidays have fixed, easy-to-remember dates, like Oct 31, Dec 25, etc. Some, however, want to be troublesome. They're specified as things like "the first Monday in September" or "the fourth Thursday in November". How am I supposed to know when that is? All I know is that Thanksgiving is fast approaching...
stackexchange_codegolf
Background The Fibonacci tiling is a tiling of the (1D) line using two segments: a short one, S, and a long one, L (their length ratio is the golden ratio, but that's not relevant to this challenge). For a tiling using these two prototiles to actually be a Fibonacci tiling, the following conditions have to be fulfilled...
stackexchange_codegolf
Given a positive integer, n, along with n non-negative integers, write a program or function that prints or returns the smallest non-negative integer that can be obtained by additions and subtractions between those numbers. You must use all of the input numbers. The winner is the algorithm with the smallest big O time ...
stackexchange_codegolf
Plot contrivance You wake up to find that something has gone horribly wrong! Your time machine has malfunctioned and you are lost sometime between June 2022 and October 1991. You check the computer that you keep on the desk to see what time it is, but alas the positron interference from your quantum undetangler has fr...
stackexchange_codegolf
We are doing a PCG challenge at work, and I'm submitting answers in C#. This is a modification of the "M'Kay" challenge. My solution has been deemed correct by the requirements, I'm just trying to shrink it further if possible. A filler word is an apparently meaningless word, phrase, or sound that marks a pause or h...
stackexchange_codegolf
Goal Your task is to create a program taking no input that returns the link to your answer. You can find a link to your answer by clicking at the share button on your answer. Rules Standard loopholes apply except for searching for the answer online. In fact, you are expected to find the answer online. You are allowed ...
stackexchange_codegolf
The task of this challenge is as following: Write a program that reads a file of reasonable size (let's say <16 MB) from stdin or anywhere else (however you like, but must not be hardcoded), and put's the compressed output onto stdout. The output must be a valid gzip compressed file and if the compressed file runs thro...
stackexchange_codegolf
In most programming languages, arithmetic is written with infix notation -- i.e. the operator is put in between the operands -- e.g. 1+2. In contrast, with Polish notation (a.k.a prefix notation), the operator comes before the operands -- e.g. +1 2. As long as the number of operands for each operator is fixed, this mea...
stackexchange_codegolf
Part of Advent of Code Golf 2021 event. See the linked meta post for details. Related to AoC2016 Day 1, Part 1. You're airdropped near Easter Bunny Headquarters in a city somewhere. "Near", unfortunately, is as close as you can get - the instructions on the Easter Bunny Recruiting Document the Elves intercepted start ...
stackexchange_codegolf
Write a Java method to check if a given string matches any value in a given enum. Your method will take two parameters, one a string and one an enum, and return true if the string representation of any of the enum's elements matches the given string, or false otherwise. Note that your method should still function norma...
stackexchange_codegolf
Today in my statistics class, I found that some factorials can be simplified when multiplied together! For example: 5! * 3! = 5! *3*2 = 5! *6 = 6! Your job: Given a string containing only Arabic numbers and exclamation points, simplify my factorial to its shortest possible string, in the least amount of bytes for your ...
stackexchange_codegolf
The diamond square algorithm is a fractal terrain (heightmap) generating algorithm. You can find a nice description how it works here: http://www.gameprogrammer.com/fractal.html (Used as a reference.) http://www.playfuljs.com/realistic-terrain-in-130-lines/ (Great JS implementation, perhaps you might want to steal his ...
stackexchange_codegolf
As a big fan of the Lost TV series, I always got intrigued by the sequence of numbers that repetitively appears on the episodes. These numbers are: \$ 4, 8, 15, 16, 23, 42\$ (A104101) Using any programming language, write a code that outputs these numbers. Scoring: Shortest answer wins The output must not contain any ...
stackexchange_codegolf
This is a code-shuffleboard answer-chaining challenge, where the answers will aim to, together, output the lyrics to this beloved 80s song. This is the full lyrics of the song, line by line. The first answer will contain a program that will output the first line of the song (We're no strangers to love). The second wil...
stackexchange_codegolf
Given a ragged list, e.g. [[4, 7], [5, 3, [], [6, [2]]]] Your challenge is to sort only the numbers in it. For example, with the above, the result would be [[2, 3], [4, 5, [], [6, [7]]]] The shape of the output should remain the same, only the numeric contents should change. This is code-golf, shortest code wins! All...
stackexchange_codegolf
Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first 5 rows (borrowed from Generate Pascal's triangle): 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 We're going to take Pascal's Triangle and p...
stackexchange_codegolf
The player has to keep guessing a number from 1 to 10 until they guess the correct number to win the game. If they make an incorrect guess, they're told if their guess was too low or too high. Each line has to render below the previous line for me to accept the solution as the new code for the game (However, you can st...
stackexchange_codegolf
Given a distance in meters as an integer \$60\le d \le 260\$, return the number of clubs that may be used according to the following arbitrary chart, where both \$min\$ and \$max\$ are inclusive: club | min | max ----------------+-----+----- Driver | 200 | 260 3-wood | 180 | 235 5-wood ...
stackexchange_codegolf
Consider an array of unique integers, with an arbitrary length greater than 2. It is sometimes possible to express elements of the array as the sum of at least two other elements. For example, if our array is [2, 3, 1], we can express 3 as the sum 2+1. However, we can't express either 2 or 1 as the sum of other element...
stackexchange_codegolf
Setup: For two sets \$A,B\$, we say \$A \subseteq B\$ if every element in \$A\$ is also in \$B\$. Another way of saying this, is that we can order the elements of \$A,B\$ into two lists \$L_A,L_B\$, such that \$L_A[i] = L_B[i]\$ where \$i\$ ranges over the indices of \$L_A\$. We proceed to extend this idea, to define ...
stackexchange_codegolf
We define a prime character as a character that has a prime ASCII value. We define a prime string as a String that only contains prime characters. Given a String that only contains printable ASCII, determine whether that String is prime. Input / Output You can take input either as a String or as a list of individual c...
stackexchange_codegolf
Overview Shue (Simplified Thue) is a language that was designed by AnttiP for this challenge. A Shue program consists of the possible outputs and a list of string replacements. For example, the following program prints "yes" if an unary string is even: yes no 11=2 12=1 22=2 1=no 2=yes Try it online! The possible outpu...
stackexchange_codegolf
Given a positive integer n, compute the nth Wilson number W(n) where and e = 1 if n has a primitive root modulo n, otherwise e = -1. In other words, n has a primitive root if there does not exist an integer x where 1 < x < n-1 and x2 = 1 mod n. This is code-golf so create the shortest code for a function or program t...
stackexchange_codegolf
This competition is over. Thanks for the interesting non-esolang entries, and congrats to Jakuje for his winning JavaScript submission. In the great tradition of ASCII Art Challenges on this site, here's another one. Given an input, draw a spiral. &>----v ||>--v| |||>v|| |||@||| ||^-<|| |^---<| ^-----< Simple, yeah?...
stackexchange_codegolf
Often I need a simple Hello World! program to show some basic concepts of a programming language on my travels. As I usually travel only with light luggage I can't to carry a Hello World! program for each language. So a program that generates Hello World! programs in as many languages as possible would be a great help....
stackexchange_codegolf
Note: Bot Factory KoTH (2.0) is now posted; you're probably looking for that one instead! In this challenge, bots (consisting of JS functions) move around an infinite factory (playing field), collecting characters (UTF-16). These characters can be used to build worker bots, or droppedfor other bots to pick up. Results ...
stackexchange_codegolf
Challenge Given input in the form <n1>, <n2> where number can be -1, 0, or 1, return the corresponding cardinal direction. Positive numbers move East in the x-axis and South in the y-axis, Negative numbers move West in the x-axis and North in the y-axis. Output must be in the form South East, North East, North. It is c...
stackexchange_codegolf
Dr. Trump is the head psychiatrist at a mental hospital, which is populated by murdering psychopaths. If 2 psychopaths are left together, they will end up brutally injuring or even killing each other, so Dr. Trump needs to build walls to separate these psychopaths, but owing to the limited amount of funds he has left, ...
stackexchange_codegolf
It's friday! Which means it's time for beer! Sadly though, today we will be golfing beer instead of drinking it. :( Challenge Output a beer and drink it. The amount of sips you take changes your output. Sips Your program should take one input string. This string can solely consist out of concatenated sips. If the input...
stackexchange_codegolf
Description In this challenge, you need to write a function that takes in a list of strings and returns the smallest string based on their ASCII value. You should assume that the input list contains only lowercase alphabetical strings. Test Cases ["a", "b", "c"] => "a" ["hello", "world", "code"] => "code" ["aaa", "aa",...
stackexchange_codegolf
Let \$R, C\$ be positive integers and let \$0 < s \leq 1\$. Consider the \$R \times C\$ matrix \$\mathbf M\$ defined as \begin{equation} M(i,j) = \frac{\mathrm{mod}\,(j, i^s)}{R^s}, \quad i = 1, \ldots, R, \quad j = 1, \ldots, C \end{equation} where \$\,\mathrm{mod}\,\$ denotes the modulo operation: for \$a,b > 0\$ not...
stackexchange_codegolf
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\$ and \$b \oplus a > x\$, where \$\oplus\$ is concatenation. For example [3,2,3,3] is not cyclic maximal because you can c...
stackexchange_codegolf
UPDATE: The gist-files are updated (including new submissions) as the Controller.java did not catch Exceptions (only errors). It does now catch errors and exceptions and also prints them. This challenge consists of two threads, this is the catcher thread, the cat thread can be found here. The controller can be download...
stackexchange_codegolf
Spherical excess of a triangle As we all know, the sum of angles of any planar triangle is equal to 180 degrees. However, for a spherical triangle, the sum of angles is always greater than 180 degrees. The difference between the sum of the spherical triangle angles and 180 degrees is called spherical excess . The task ...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. An Elf is hopping on a chessboard which extends infinitely in all four directions. They move like a generalized chess Knight: on each step, they move X units horizontally and Y units vertically, or Y units horizontally and X units vert...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. On the flight to Hawaii for vacation, I'm playing with a deck of cards numbered from 1 to \$n\$. Out of curiosity, I come up with a definition of "magic number" for a shuffled deck: The magic number of a shuffle is the minimum number ...
stackexchange_codegolf
Problem: You must make a program that does the following: takes a large string of lowercase text, and counts all the occurrences of each letter. then you put the letters in order from greatest to least occurences. then you take that list and turns it into an encoder/decoder for the text. then encodes the text with tha...
stackexchange_codegolf
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consistent values eac...
stackexchange_codegolf
You are to write a program which generates random integers between \$0\$ and \$99\$ inclusive, outputting each integer in turn, until \$0\$ is generated. You may choose which single-order random distribution (uniform, binomial, Poisson etc.) you use so long as each integer has a non-zero chance of being generated and i...
stackexchange_codegolf
Entries are now closed. Any new entries or edits will not be counted in the final run. Join the chat! Challenge Try to fill the canvas with as much paint as possible. Be careful of other bots that may paint over your hard work though! Note: In this challenge description, paint means to change the colour of the squar...
stackexchange_codegolf
Introduction As you all know, German has umlauts. They're these things: ¨ However, most keyboards don't have an umlaut key. That's fine, though, because you can write ö, ä, and ü as oe, ae, and ue. Challenge Your job is to to replace ö, ä, and ü with oe, ae, and ue (and likewise for their capital versions). You have t...
stackexchange_codegolf
I love functional programming in Octave, but it's rather unwieldy in practice. I'm wondering about the shortest way to define an anonymous recursive function. I have some ideas, but I'm wondering if there is a way to combine these ideas to make them even shorter (or equally short but more versatile). For the sake of th...
stackexchange_codegolf
Let \$ A \$ represent the alphabet, such that \$ A_1 = \$ a and \$ A_{26} = \$ z. Let's define that a word \$ W = w_1 w_2 ... w_n \$ (where \$ w_c \in A\$) is in standard order if and only if: \$ w_1 = A_1 \$, and for \$ 2 \le i \le n \$, if \$ w_i = A_x \$ then \$ w_j = A_{x-1} \$ for some \$ j < i \$ and some \$x\$....
stackexchange_codegolf
Background The special linear group \$ SL_2(\mathbb{Z}) \$ is a multiplicative group of \$ 2 \times 2 \$ matrices whose elements are integers and determinant is 1. It is known that every member of \$ SL_2(\mathbb{Z}) \$ is a product of some sequence of the following two matrices \$ S \$ and \$ T \$ (reference pdf): $$ ...
stackexchange_codegolf
Intro: A Frobenius number is a number which cannot be made from numbers in a set. For example, 43 is the Frobenius number of the set {6, 9, 20}, because you cannot get 43 from those numbers, and it is the largest number which cannot be made. 42 is not a Frobenius number of the set {6, 9, 20}, because it can be made fro...
stackexchange_codegolf
I think the ASCII art questions on PPCG are fun to do, but personally I think it can be pretty hard, especially when the question is tagged as code-golf. I wonder if anyone here might have some tips that will be useful for producing ASCII art. Simply arranging characters is easy, but with (short) algorithms, things wil...
stackexchange_codegolf
Background Minifiers are used, commonly, when serving JavaScript to your Web Browser. It is commonly used to reduce the number of bytes that have to be sent. Saving bandwidth is useful for obvious reasons. Some people use obfuscaters (that intentionally make code harder to read), I am not talking about those. We wil...
stackexchange_codegolf
A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy. Input The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine...
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
As a child, my friend had a magic 8 ball that we would ask questions to and see what the fate of that question was. Challenge Your challenge is to write a program (or function) that when run (or called), outputs (or returns) a random answer from the possible answers below. (Random being: each output should have a nonze...
stackexchange_codegolf
You have been collecting data from a Advanced Collecting Device Controller™ for a long time. You check the logs, and to your horror you discover that something has gone terribly wrong: the data only contains the last bits of the numbers! Luckily, you know the starting value and that the value never changes fast. That ...
stackexchange_codegolf
4, 8, 15, 16, 23, 42 Write a program that outputs this sequence of numbers infinitely. However, The Numbers must not appear in your source code anywhere. The following is not a valid Java program to output The Numbers because The Numbers appear in its source code: class TheNumbers { public static void main(String[]...
stackexchange_codegolf
I love functional programming in Octave, but it's rather unwieldy in practice. I'm wondering about the shortest way to define an anonymous recursive function. I have some ideas, but I'm wondering if there is a way to combine these ideas to make them even shorter (or equally short but more versatile). For the sake of th...
stackexchange_codegolf
Introduction The four basic math operators (+, -, *, /) can be reduced to just two, due to the fact that: x + y = x - (-y) x * y = x / (1/y), y != 0 x * 0 = 0/x Challenge The challenge is to take input as a "string" containing: Numbers Single character variables ("x", "y") The four basic math operators (+, -, *, /) P...
stackexchange_codegolf
Inspired by this video by Matt Parker The distances between the letter keys of a QWERTY keyboard are somewhat standardised. The keys are square and both the horizontal and vertical spacing are 19.05mm (so if there were no gaps between the keys, their side lengths would be 19.05mm), and the three rows of keys are offset...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. On the flight to Hawaii for vacation, I'm playing with a deck of cards numbered from 1 to \$n\$. Out of curiosity, I come up with a definition of "magic number" for a shuffled deck: The magic number of a shuffle is the minimum number ...
stackexchange_codegolf
tinylisp is, in its essence, a very stripped-down version of Lisp, as the name suggests. It was made by @DLosc for an "interpret this language" challenge, which can be found here. It features a small amount of builtins, which can be used to create practically anything. There is a repository for the "official" tinylisp ...
stackexchange_codegolf
In this challenge, you'll calculate how great your land is. Write a program or function that calculates the size of your land, given a wall you have built. You're given a non-empty input string containing a set of 4 distinct characters of your choice that represent the four directions "up", "down", "left" and "right" ...
stackexchange_codegolf
Challenge Given a valid goo.gl shortened link, output the original URL. Example goo.gl/qIwi3N would give something like https://codegolf.stackexchange.com/. For input, you can choose to have the https?:// at the beginning, you can choose to have www. before the goo.gl, and you can also choose to get rid of the goo.gl i...
stackexchange_codegolf
Challenge Write a program or function that takes in 4 non-negative integers, A, B, C, and D, that represent two fractions, A/B and C/D, where B and D are non-zero and A <= B and C <= D. Output an ASCII art depiction of the fractions made of |x- characters on two lines as follows: The lines will always be the same, min...
stackexchange_codegolf
In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules: You may only output bytes in the printable ASCII range (0x20 to 0x7E, inclusive), or newlines (0x0A or 0x0D). Your code must not be a...
stackexchange_codegolf
Challenge Draw lines in ASCII corresponding to given inputs: in the first line there are given size of rows and columns of the view and number of separators between each point in the second line is given list of lines separated by space a line contains the position of head and tail coordinates (within the size of colum...
stackexchange_codegolf
Specifications Your program must can take in an integer n, then take in n more strings (containing only alphanumeric characters) in your preferred method (separated by whitespace, file input, hash table etc.). You must then find the permutation before the inputted strings when sorted in lexicographical order, and outpu...
stackexchange_codegolf
The challenge is to manipulate strings using basic Vim-like commands Input: A string of text to be transformed. The input alphabet is [a-z]. A string of legal commands Output: The transformed string There are a few ideas you should understand: The cursor is represented as a location between 2 characters. | will be...
stackexchange_codegolf
This is a CC-BY-SA challenge from the CCSC Mid-South Programming Contest 2018. Author(s): Brent Yorgey Source: Consortium for Computing Sciences in Colleges Mid-South Programming contest 2018 https://ccsc18.kattis.com/problems/ccsc18.mountainrange Good news: you have been hired to do all the special effects for a fil...
stackexchange_codegolf
Define the "maximum sub-array" of a given array as "a (consecutive) sub-array that has the biggest sum". Note there's no "non-zero" requirement. Output that sum. Give a description of your code if possible. Sample input 1: 1 2 3 -4 -5 6 7 -8 9 10 -11 -12 -13 14 Sample output 1: 24 Description 1: The biggest sum is yie...
stackexchange_codegolf
A guess the word game The agreed dictionary. All words are 6 letters long with all letters distinct Rules: This is a game of two players and the task will be to implement Player 2. Player 1 chooses a word from the agreed dictionary Player 2 repeatedly guesses a word from the agreed dictionary. At each turn, Player 1 ...
stackexchange_codegolf
I can't believe we don't have this already.. It's one of the most important data-structures in programming, yet still simple enough to implement it in a code-golf: Challenge Your task is to implement a stack that allows pushing and popping numbers, to test your implementation and keep I/O simple we'll use the following...
stackexchange_codegolf
Description While support is getting better and better for people to write in various scripts around the world using unicode, and now you can even write in emojis as well, unfortunately most fonts[citation needed] are still missing Latin characters based on the double acute accent, which is required to write properly i...
stackexchange_codegolf
In Vim, you can repeat a command by preceding it with a number, like 3dd is equivalent to dd dd dd. Well, this repeating pattern is not restricted to Vim commands. String can be replicated in this way, too. Specification: Given a string, consisting of only digits, alphabetical characters (both upper-case and lower-case...
stackexchange_codegolf
This ascii-art challenge is about walking around a string like a snake. s-n-a-k .---. e d <-' a n-u-o-r You will be given a string \$ S \$ of length \$ l \$ and a positive integer \$ n \$ where \$ n ^ 2 \ge l + 1 \$. The string rotates 90° after writing \$ n \$ characters of \$ S \$, or when it hits itself. When \$ S ...
stackexchange_codegolf
This challenge is brought to you by real (and tragic) inspiration. Recently, the number row on my keyboard has been a bit sporadic. The keys 1-9 work sometimes--but other times they have no result. As an avid programmer, this is horrible! (See that exclamation point? That's how you know they're working right now.) Not ...
stackexchange_codegolf
We have a challenge to output your own score, but it seems like all the answers there just hardcode the output and that's boring1. So lets have a new challenge. Your program must output its own length in bytes followed by the string " bytes", but in order to prevent hardcoded solutions if we reduce its size by removi...
stackexchange_codegolf
Specification This challenge is simple to state: your input is a non-empty array of nonnegative integers, and your task is to partition it into as few increasing subsequences as possible. More formally, if the input array is A, then the output is an array of arrays B such that: Each arrays in B form a partition of A i...
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
(or: Output the plural demonym.) When in Rome, do as the Romans do. This is a well-known English phrase meaning that it’s best to follow what others are doing around you — to go with the flow. Today, you're going to rewrite the phrase to fit most (Western) place names. To get the name of a group that lives within a reg...
stackexchange_codegolf
Write a program or function that takes in a positive integer N (via stdin/command line/function arg) and prints or returns a string representation of a two dimensional random walk that is N steps long, drawn out of slashes: / \ (plus spaces and newlines for spacing). A 2D random walk starts at the origin of an infinite...
stackexchange_codegolf
Output a sequence of all the primes that are of the following form: 123...91011...(n-1)n(n-1)..11109...321. That is, ascending decimal numbers up to some n, followed by a descending tail, all concatenated. Background Recently, Numberphile posted a video about primes that follow this pattern. Output 1 -> 123456789109876...
stackexchange_codegolf
I found another sequence not yet in the OEIS The binary expansion sequence is defines as follows, assuming 0 indexing: The even numbers of the sequence are how often 0 has appeared in the binary expansion of all previous items in the sequence The odd elements are the same, but for 1s. If you choose to 1-index, revers...
stackexchange_codegolf
Your function must accept two strings and return new string where are UTF-16 code of all symbols is the sum of UTF-16 codes of inputs symbols If the resulting sum is greater than 65535 (maximum UTF-16 codepoint), take the sum modulo 65536 If there are more symbols in one string then sum with zero, codes of symbols wh...
stackexchange_codegolf
Inspired by this challenge, and similar to this and this. After seeing these, I figured I would continue the trend as there was no inclusive/exclusive sum. The goal here is to sum an interval of integers, either inclusive and exclusive, and output the total to stdout. Input format: either a ( or [ followed by 2 comma s...
stackexchange_codegolf
In Bloons Tower Defense 6, the strength of different bloons can be measured by their Red Bloon Equivalent (RBE), or the number of single pops it takes to completely defeat the bloon. The RBE for the bloon types are as follows (sourced from the wiki) Bloon RBE red 1 blue 2 green 3 yellow 4 pink 5 black...
stackexchange_codegolf
You work at a bakery and every day you make exactly 100 bagels. However your customers are not as reliable and every day a random number of bagels will be ordered. So sometimes you will run out of bagels and sometimes you will have leftovers. Now leftover bagels will still be good for 1 more day. After a day on the ...
stackexchange_codegolf
Background Many esoteric programming languages don't have numbers built in at literals, so you have to calculate them at runtime; and in many of these cases, the number representation can be quite interesting. We've already had a challenge about representing numbers for Underload. This challenge is about representing n...
stackexchange_codegolf
I'm currently working with a branchless language which does not have native Less-Than, Greater-Than or Equal-To functions. I do however have min, max and abs functions and standard arithmetic (+, -, / and *) available to me. I'd like to create these three functions (as L(a, b), G(a, b) and E(a, b) respectively, which w...
stackexchange_codegolf
Create a function or program that makes a grid as close to an square as possible You will be given an integer N as input, whole numbers (1,2,3,25, etc) The output must be a perfect rectangular grid of N letters as close to a square as possible The (wannabe)square must consist of one of the the letters O or X as specif...
stackexchange_codegolf
Your task is, to count how many pluses I have. What Pluses? The no plus: 0 Points - The naïve Plus: 1 Point + The double Plus: 2 Points + +++ + The mega double plus: 3 Points + +++ + + + + +++++++++ + + + + +++ + Pluses of higher order than 3 must be ignored. Rules Input will ...
stackexchange_codegolf
We've recently reached the threshold of 10,000 questions on PPCG. Hooray! Let's celebrate this with a simple challenge. Input Two integers \$A\$ and \$B\$, both in \$[1..9999]\$, such that \$A+B<10000\$. Task Your task is to add one single digit to one of these integers or one single digit to both of them such that \$A...
stackexchange_codegolf
Your task is to program a mathematical function \$s\$, that takes a nonempty finite set \$A\$ of points in the 2D plane, and outputs an uncircularity score \$s(A)\$ that satisfies following properties: Positive Definiteness: If there is a circle or a straight line that contains all points of \$A\$, then \$s(A) = 0\$. ...
stackexchange_codegolf
Write a function or program that outputs Quater-imaginary base displayed as binary digits. The number base is 2i, where i is the square root of -1. See Complex Number for more details on i. Each digit position can go from 0 to 3 (quaternary), as each real and imaginary part is -4 times as large as the previous real and...
stackexchange_codegolf
In this challenge you are asked to find in how many ways we can express a positive integer n as the sum of two positive integers k and the reverse of k. Here is an example using n = 1069 : 188 + 881 = 1069 287 + 782 = 1069 386 + 683 = 1069 485 + 584 = 1069 980 + 89 = 1069 So, the answer here would be 5. rules As you ca...
stackexchange_codegolf
I just discovered this site and this is my first question, I hope I'm doing it correctly. The challenge is the following, you must write a code that prints all the prime numbers of \$n\$ digits. Since this problem is computationally complicated, I think that one way to simplify it is to give a number \$m\$ that will be...
stackexchange_codegolf
You are given two strings, each consisting of the English word for a number between 1 and 13: one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen Your program or function must find out whether it's possible to spell at least one other word from the same list without using any of the let...
stackexchange_codegolf
The golfing language Jelly has a very complex and clever string compression system which I'm not going to go into depth about here. You can find a very good explanation here. Basically, Jelly's string literals are represented as “...», where ... is a string of characters from Jelly's codepage that is decoded into a bas...
stackexchange_codegolf
This site had a lot of problems involving implementing various languages in interpreter tag. However, practically all of them were esoteric languages that nobody uses. Time to make an interpreter for a practical language that most of users here probably already know. Yes, it's shell script, in case you have problems re...
stackexchange_codegolf
Write a program or function to output the sum of the odd square numbers (OEIS #A016754) less than an input n. The first 44 numbers in the sequence are: 1, 9, 25, 49, 81, 121, 169, 225, 289, 361, 441, 529, 625, 729, 841, 961, 1089, 1225, 1369, 1521, 1681, 1849, 2025, 2209, 2401, 2601, 2809, 3025, 3249, 3481, 3721, 396...
stackexchange_codegolf
Task Your task is to print or output all positive numbers in which every multi-digit substring in its decimal representation is also prime. If the number has at least 2 digits, this would imply that the number itself also needs to be prime. Example 6197 is in the sequence because every multi-digit substring in 6197 is...
stackexchange_codegolf
Note: This challenge only allows answers in compiled languages Task Your task is pretty simple, make two different programs that when compiled result in the same output. Scoring Here is where the fun comes in. Your score will be the number of unique bytes present in exactly one program. For example if your two progra...
stackexchange_codegolf