text
stringlengths
180
608k
[Question] [ Consider a stream/file with one integer per line. For example: ``` 123 5 99 ``` Your code should output the sum of these numbers, that is `227`. The input format is strictly one integer per line. You cannot, for example, assume the input is on one line as an array of integers. You can take input either...
[Question] [ # Goal You have to print the ASCII printable characters' code page (0x20-0x7E). The output should look like this: ``` !"#$%&'()*+,-./ 0123456789:;<=>? @ABCDEFGHIJKLMNO PQRSTUVWXYZ[\]^_ `abcdefghijklmno pqrstuvwxyz{|}~ ``` # Rules * The output should be **exactly** like shown above, but trailing whites...
[Question] [ # Description Subtract the next P numbers from a N number. The next number of N is N + 1. Look at the examples to get what I mean. # Examples: ``` Input: N=2,P=3 Calculate: n - (n+1) - (n+2) - (n+3) //Ending with 3, because P=3 Calculate: 2 - 2+1 - 2+2 - 2+3 //Replacing N with 2 from Inpu...
[Question] [ *(inspired by [this challenge](https://puzzling.stackexchange.com/q/42278) over on Puzzling -- **SPOILERS** for that puzzle are below, so stop reading here if you want to solve that puzzle on your own!)* If a letter in a word occurs alphabetically later than the previous letter in the word, we call tha...
[Question] [ In this challenge, you are going to take a number and turn it into a string, but not in the common way. You will use the `aaaaa` way! The `aaaaa` way is simply replacing each digit of the input number with the letter at that position in the alphabet. For example, `11111` would become `aaaaa` and `21223...
[Question] [ Your goal is simple: the program must turn the screen of your computer **totally black**. After the program is started, the screen must quickly turn completely black, and remain so until the program is exited (any key, or alt+F4, mouse movement, etc.), after which things should turn back to normal. So...
[Question] [ **Write a program that count from 1 to 100 in [Roman Numerals](http://en.wikipedia.org/wiki/Roman_numerals)** and print these numbers by standard output. Each one of the numbers must be separated by spaces. You cannot use any built in function to transform to roman numerals nor external application or ...
[Question] [ We have lots of horizontal axis for numbers, but I honestly think they're kind of boring. Your task today is to build me a portion of a diagonal axis between two distinct non-negative integers given as input. ## How to build a diagonal axis? * Let's take an example, with the input `0, 5`. Our axis shou...
[Question] [ This is a problem on Luogu OJ. I decided to post it here because on Luogu OJ, many people, including me and my friend, are interested about how to solve this problem within the fewest characters. Your task is to output the following ASCII-art: ``` ************ ####....#. ...
[Question] [ My dog ate my calendar, and now my days are all mixed up. I tried putting it back together, but I keep mixing up the days of the week! I need some help putting my calendar back together, with the days in the correct order. And since I need my calendar put together as fast as possible, don't waste my ti...
[Question] [ ### The Task The task is very simple. Given an array containing **only integers** and **strings**, output the largest number and the smallest number. ### Test Cases ``` Input: [1, 2, 3, 4, 5, 6, 7, 8] Output: 1, 8 Input: [5, 4, 2, 9, 1, 10, 5] Output: 1, 10 Input: [7, 8, 10, "Hello", 5, 5] Output: 5, 1...
[Question] [ Given an integer \$1 < n < 10 \$ generate a table like below. For \$n = 5\$, ``` 1 2 3 4 5 2 2 3 4 5 3 3 3 4 5 4 4 4 4 5 5 5 5 5 5 ``` For \$n = 8\$, ``` 1 2 3 4 5 6 7 8 2 2 3 4 5 6 7 8 3 3 3 4 5 6 7 8 4 4 4 4 5 6 7 8 5 5 5 5 5 6 7 8 6 6 6 6 6 6 7 8 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 ``` Shortest code win...
[Question] [ *Not to be confused with [Least Common Multiple](https://codegolf.stackexchange.com/questions/94999/least-common-multiple).* Given a list of positive integers with more than one element, return the most common product of two elements in the array. For example, the MCM of the list `[2,3,4,5,6]` is `12`,...
[Question] [ [A000330 - OEIS](https://oeis.org/A000330) # Task Your task is simple, generate a sequence that, given index `i`, the value on that position is the sum of squares from `0` upto `i` where `i >= 0`. # Example: ``` Input: 0 Output: 0 (0^2) Input: 4 Output: 30 (0^2 + 1^2 + 2^2 + 3^2 + 4^...
[Question] [ I find it deeply weird that this is possible in Ruby (I won't immediately say how): ``` obj = #code redacted print obj.state # Some value. LValue = obj print obj.state # Different value! ``` Your challenge is to create code roughly of this form. Create an object and assign it to a variable. It should h...
[Question] [ Your task is to write a non-empty computer program comprised of some sequence of bytes. If we choose a particular byte in the program and remove all instances of it from the program, the modified program should output the removed byte. For example if our program were ``` aabacba ``` Then `bcb` would ou...
[Question] [ Mr. Binary Counterman, son of Mr. Boolean Masker & Mrs. Even Oddify, follows in his parents’ footsteps and has a peculiar way of keeping track of the digits. When given a list of booleans, he counts the 1s and 0s separately, numbering the 1s with the odds & the 0s with the evens. For example, when he l...
[Question] [ Given an input string only containing the characters `A-Z`, `a-z`, and spaces, remove all occurrences of the uppercase and lowercase versions of the first character of the string (if the first character is `A` remove all `A`s and `a`s, if the first character is (space) remove all spaces), and print the...
[Question] [ The partial sums of a list of integers [a1, a2, a3, ..., an] are s1 = a1 s2 = a1 + a2 s3 = a1 + a2 + a3 ... sn = a1 + a2 + ... + an We can then take the list of partial sums [s1, s2, s3, ..., sn] and compute its partial sums again to produce a new list, and so on. Related: [Iterated forward di...
[Question] [ ### Introduction In the wake of the [left-pad npm package](https://www.npmjs.com/package/left-pad) [fallout](https://www.reddit.com/r/programming/comments/4bjss2/an_11_line_npm_package_called_leftpad_with_only/), let's have a code golf for implementing left-pad. The *left-pad* function consists of 2 de...
[Question] [ There are 95 [printable ASCII](http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters) characters: ``` !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ``` In the [Consolas font](http://en.wikipedia.org/wiki/Consolas) (the Stack Exchange code block ...
[Question] [ ### Description Chicken McNugget numbers are numbers that can be expressed as a sum of \$6\$, \$9\$ or \$20\$ - the initial sizes of the famous [Chicken McNuggets](https://en.wikipedia.org/wiki/Chicken_McNuggets) boxes sold by McDonald's. In that sum, a number may occur more than once, so \$6 + 6 = 12\...
[Question] [ ### Task Find the set of numbers such that the binary representation contains two or more runs of `1` separated by at least one `0`. For example, the for the numbers that are 4 bits long: ``` 0 0000 (no ones) 1 0001 (only one run) 2 0010 (only one run) 3 0011 (only one r...
[Question] [ Write a program to play the popular English nursery rhyme. [![Sheet music](https://i.stack.imgur.com/t6uGH.png)](//commons.wikimedia.org/wiki/File:Twinkle_Twinkle_Little_Star.png) (This file is licensed under the Creative Commons [Attribution-Share Alike 3.0 Unported](//creativecommons.org/licenses/by-...
[Question] [ Given a non-empty string of lowercase ASCII letters `a-z`, output that string with each consecutive “run” of the same letter lengthened by one more copy of that letter. For example, `dddogg` (**3** `d`’s, **1** `o`, **2** `g`’s) turns into `ddddooggg` (**4** `d`’s, **2** `o`’s, **3** `g`’s). This is [c...
[Question] [ Here is a simple, bite-sized (byte-sized?) code golf: given a non-empty list of positive integers less than 10, print a [block-diagonal](http://en.wikipedia.org/wiki/Block_matrix#Block_diagonal_matrices) matrix, where the list specifies the size of the blocks, in order. The blocks must consist of posit...
[Question] [ The challenge is simple. Give the shortest code possible to reproduce the classic 2-player game of pong <http://en.wikipedia.org/wiki/Pong> . The level of graphics and functionality should be as close as possible to this javascript demonstration <http://codeincomplete.com/posts/2011/5/14/javascript_pon...
[Question] [ Given a list of at least two words (made only of lowercase letters), construct and display an ASCII ladder of the words by alternating the direction of writing first to the right, then to the left, relatively to the initial direction from left to right. When you finish writing a word, change the direct...
[Question] [ Given an integer N >= 1, output the mean number of bits in an integer from 0 to N - 1 # Specification * The output can be calculated as the sum of the number of bits in the binary representation of each integer from 0 to N-1, divided by N. * The binary representation of an integer has no leading zeroes...
[Question] [ In any programming language that existed before this question was asked, write a program (not a function) that outputs the characters `Hello world!` followed by a newline. Your program: * should not use any character more than once (including whitespace) * should only use ASCII characters * should not ...
[Question] [ Given a positive integer (0 and above, no maximum), convert it into a grade following these rules: ``` A = 100+ B = 90 - 99 C = 80 - 89 D = 70 - 79 E = 60 - 69 F = 59 and less. ``` This felt a little boring, so make the grade a `+` if it's 7,8 or 9 and a `-` if it's 0,1 or 2. Ignore this for ...
[Question] [ Assume we have a string, and we want to find the maximum repeated sequence of every letter. For example, given the sample input: ``` "acbaabbbaaaaacc" ``` Output for the sample input can be: ``` a=5 c=2 b=3 ``` Rules: * Your code can be function or a program - for you to choose * Input can be by stdin,...
[Question] [ We've had a lot of [quine](/questions/tagged/quine "show questions tagged 'quine'") challenges, but a lot of the quine formats are similar, lets create some variance in our quines. Your task is to create a selection of programs in the same language (at least 2), all of which output their own source cod...
[Question] [ A Sphenic Number is a number that is the product of exactly three distinct primes. The first few Sphenic numbers are `30, 42, 66, 70, 78, 102, 105, 110, 114`. This is sequence [A007304](https://oeis.org/A007304) in the OEIS. ## Your Task: Write a program or function to determine whether an inputted in...
[Question] [ Your job is quite simple, write a program that prints `Hello, world!`, that when twisted creates a program that prints `Twister!`. ## How strings are twisted The twisting algorithm is very simple. Each column is shifted down by its index (col 0 moves down 0, col 1 moves 1, ...). The column shift wraps ...
[Question] [ The [random Fibonacci sequence](https://en.wikipedia.org/wiki/Random_Fibonacci_sequence) is defined as follows: $$ f\_n = \begin{cases} f\_{n-1}+f\_{n-2} \text{ with probability } 1/2 \\ f\_{n-1}-f\_{n-2} \text{ with probability } 1/2 \\ \end{cases} $$ $$ f\_1 = f\_2 = 1 $$ i.e. whether the next term ...
[Question] [ The prospect of this challenge is: * If your program is run normally, all of the code in the speech marks (`"` - double quotes) should be printed. * If your program is wrapped in double quotes (in turn inverting the speech marks), the code that is normally not in quotes should be printed. E.g: Let's sa...
[Question] [ Here is an example of an input of **monoliths**. There are 4 in this example. ``` _ | | _ | | _ | | | | | | | | _ _| |_| |___| |____| |_ ``` The first monolith is 4 units high, the second is 2, the third is 3, and the last is 1. # The task Your program should output the heights of...
[Question] [ We'll call the consecutive distance rating of an integer sequence the sum of the distances between consecutive integers. Consider `2 9 3 6 8 1`. ``` 2 9 3 6 8 1 <----5----> <-2-> <--3--> ``` \$2\$ and \$1\$ are consecutive integers, and their distance apart in the sequence is \$5\$. \$2\$ and \$3\$...
[Question] [ This is my first challenge, so I'm keeping it fairly simple. If you've ever typed `telnet towel.blinkenlights.nl` on your command line and pressed enter, you will have experienced the joy of asciimation. Asciimation is, quite simply, doing an animation with ascii art. Today we will be doing a very basi...
[Question] [ Let's play Russian Roulette! Normally, this would be a race to write the shortest MOD 6 program, but that's not very realistic, as the chance of winning decreases with each click. Here are the rules: 1. Emulate a real [six-shooter](https://en.wikipedia.org/wiki/Revolver): * A single bullet is placed i...
[Question] [ Given two positive integers, W and H, output an ASCII-art box whose border is made of slashes (`/` and `\`) with W "spikes" on the top and bottom edges, and H "spikes" on the left and right edges. The box's interior is filled with spaces. A "spike" is simply two slashes coming together to form an arrow...
[Question] [ In celebration of [HyperNeutrino](https://codegolf.stackexchange.com/users/68942/hyperneutrino) getting back his account and rep, [following Mr. Xcoder](https://codegolf.stackexchange.com/q/128075/20260). [![HyperNeutrino's flair](https://i.stack.imgur.com/vDxGx.png)](https://codegolf.stackexchange.co...
[Question] [ ### Introduction For the ones who don't know, a palindrome is when a string is equal to the string backwards (with exception to interpunction, spaces, etc.). An example of a palindrome is: ``` abcdcba ``` If you reverse this, you will end up with: ``` abcdcba ``` Which is the same. Therefore, we call t...
[Question] [ ### Introduction: I think we all know it, and it has probably been translated in loads of different languages: the "Head, Shoulders, Knees and Toes" children song: > > Head, shoulders, knees and toes, knees and toes > > Head, shoulders, knees and toes, knees and toes > > And eyes and ears and ...
[Question] [ Program A outputs program B's code when run, and B outputs A's source. Requirements: * Only one language across both programs * Programs are different. One program that outputs itself does not qualify. * Both programs are non-empty, or at least 1 byte in length. Trailing newlines in both source and out...
[Question] [ The nth [Motzkin Number](http://mathworld.wolfram.com/MotzkinNumber.html) is the number of paths from (0, 0) to (n, 0) where each step is of the form (1, -1), (1, 0) or (1, 1), and the path never goes below y = 0. Here's an illustration of these paths for n = 1, 2, 3, 4, from the above link: [![Motzkin...
[Question] [ You are given four integers: \$e,s,b\in\{0,1\}\$ and \$S\in \{0,1,2,4\}\$, where \$e,s,b,S\$ stand for egg, sausage, bacon and spam respectively. Your task is to figure out whether the corresponding ingredients match a valid entry in the following menu: ``` [e]gg | [s]ausage | [b]acon | [S]pam -------...
[Question] [ Okay, so yesterday was 2nd Christmas day and my (grand)parents and me had a game of "sjoelen", as it is called in the Netherlands. The inner programmer came up in me, but just when I had the answer, I lost it. I want you to remake it. *The rules:* You have a wooden plank, a *sjoelbak*, with 4 boxes, ea...
[Question] [ Most languages come with a built-in to search a string for all occurrences of a given substring and replace those with another. I don't know of any language that generalises this concept to (not necessarily contiguous) subsequences. So that's your task in this challenge. The input will consist of three...
[Question] [ # Challenge description In this challenge, we only consider `love` and `hate` as feelings. If we want to utter a **feeling expression** of order `N`, we alternate between these two (starting with `hate`): ``` order | expression 1 I hate it. 2 I hate that I love it. 3 I hate that I lov...
[Question] [ Here is a simple ASCII art [ruby](http://en.wikipedia.org/wiki/Ruby): ``` ___ /\_/\ /_/ \_\ \ \_/ / \/_\/ ``` As a jeweler for the ASCII Gemstone Corporation, your job is inspect the newly acquired rubies and leave a note about any defects that you find. Luckily, only 12 types of defects are possib...
[Question] [ [Toki Pona](https://tokipona.org) is a constructed language with 137ish words, designed to constrain the speaker to expressing ideas in a simple and straightforward manner, reducing ideas to more essential forms. Often, people attempt to avoid directly expressing numeric quantities in Toki Pona, opting...
[Question] [ # Introduction By definition, unique identifiers should be unique. Having multiple identifiers that are the same causes one to retrieve unexpected data. But with data arriving concurrently from multiple sources, it can be difficult to ensure uniqueness. Write a function the uniquifies a list of identif...
[Question] [ # Text to DNA golf ## Challenge Convert input into a DNA output. ## Algorithm * Convert text into ASCII code points (e.g. `codegolf` -> `[99, 111, 100, 101, 103, 111, 108, 102]`) * String the ASCII codes together (e.g. `99111100101103111108102`) * Convert to binary (e.g. `101001111110011010010110100010...
[Question] [ # Challenge description A **Smith number** is a **composite** number whose sum of digits is equal to the sum of sums of digits of its prime factors. Given an integer `N`, determine if it's a Smith number or not. The first few Smith numbers are `4`, `22`, `27`, `58`, `85`, `94`, `121`, `166`, `202`, `26...
[Question] [ # Challenge Write a program or function that takes a number \$n\$ and returns the smallest \$k\$ such that concatenation \$n'k\$ is a square. This sequence is described by [A071176 on the OEIS](https://oeis.org/A071176). # I/O Examples ``` input --> output 1 --> 6 (4^2) 10 --> 0 (10^2) 35 -->...
[Question] [ Given a positive integer `n`, simplify the square root `√n` into the form `a√b` by extracting all square factors. The outputted `a,b` should be positive integers with `n = a^2 * b` with `b` as small as possible. You may output `a` and `b` in either order in any reasonable format. You may not omit outp...
[Question] [ Inspired by [a recent Daily WTF article](https://thedailywtf.com/articles/ternt-up-guid)... Write a program or function that takes a GUID (string in the format `XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX`, where each X represents a hexadecimal digit), and outputs the GUID incremented by one. ## Examples ``` ...
[Question] [ A [Faro shuffle](https://en.wikipedia.org/wiki/Faro_shuffle) is a technique frequently used by magicians to "shuffle" a deck. To perform a Faro shuffle you first cut the deck into 2 equal halves then you interleave the two halves. For example ``` [1 2 3 4 5 6 7 8] ``` Faro shuffled is ``` [1 5 2 6 3 7 ...
[Question] [ Inspired by [this](http://www.smbc-comics.com/index.php?db=comics&id=2874). There is a number, given as either integer, string or array of digits (your choice). Find the base in which the representation of the number will have most "4"s and return that base. ``` Number Result 624 5 444 ...
[Question] [ Given a positive integer, output a truthy/falsy value as to whether the number can eat itself. ### Rules Leftmost is the head, rightmost is the tail If the head is greater than or equal to the tail, the head eats the tail and the new head becomes their sum. If \$sum \ge 10 \$ then the head is replaced ...
[Question] [ ## Introduction and Credit We all know and love our awesome rules to test whether a number is divisble by 11 or 3, which is just some clever sum over the digits of the number. Now this challenge takes this to a new level, by requiring you to compute the sum of the digits and then checking whether the r...
[Question] [ Write a program or function that takes in three positive integers, W, H, and N. Print or return a W×H grid of `.`'s where every Nth `.` in normal English reading order is replaced with an `X`. For example, given W = 7, H = 3, N = 3, the grid is 7 characters wide and 3 high, and every third character re...
[Question] [ Please excuse the punny title. This is a question is inspired by [A Curious Property of 82000](https://plus.google.com/101584889282878921052/posts/Fni6x2TTeaS). In it, the author points out that the number 82000 is binary in base 2, 3, 4, and 5. The post then poses the question "is there a number that...
[Question] [ What do you get when you cross Pascal's Triangle and the Fibonacci sequence? Well, that's what you have to find out! # Task Create a triangle that looks like this: ``` 1 1 1 2 2 2 3 5 5 3 5 10 14 10 5 8 20 32 32 20 8 ``` Basically, instead of each cell b...
[Question] [ Fermat's last theorem says that there there are no positive, integral solutions to the equation `a^n + b^n = c^n` for any `n>2`. This was proven to be true by Andrew Wiles in 1994. However, there are many "near misses" that almost satisfy the diophantine equation but miss it by one. Precisely, they are...
[Question] [ Choose your favorite famous computer scientist or [computer science pioneer](http://en.wikipedia.org/wiki/List_of_pioneers_in_computer_science) who was **born in 1942 or earlier** (as 1943 marks the start of the creation of the ['first' computer](http://en.wikipedia.org/wiki/ENIAC)). They should have a...
[Question] [ Write a program or function that can distinguish the following 12 trigonometric functions: [`sin`](https://de.mathworks.com/help/matlab/ref/sin.html), [`cos`](https://de.mathworks.com/help/matlab/ref/cos.html), [`tan`](https://de.mathworks.com/help/matlab/ref/tan.html), [`asin`](https://de.mathworks.co...
[Question] [ ### Background / Description Note: as @HelkaHomba points out, the actual GitHub identicons *are not actually random but based on the hash of a username* The default GitHub avatar is a 5x5-pixel image. A color is picked randomly, and then random pixels are filled in on one side (right or left, 2x5 size)...
[Question] [ I recently learned from [a comment](https://mathoverflow.net/q/413087/104733#comment1058750_413087) by MathOverflow user [pregunton](https://mathoverflow.net/users/115044/pregunton) that it is possible to enumerate all rational numbers using iterated maps of the form \$f(x) = x+1\$ or \$\displaystyle g...
[Question] [ Write a program that goes through a string of non-whitespace characters (you may assume that they are digits `0` to `9`, but nothing in the way they are to be processed depends on this) and adds spaces according to the following rules. 1. Let the current token be the empty string, and the previously em...
[Question] [ > > Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro. > > > I am an evil farmer, and to drive up the price of wheat in my area, I've decided to burn the fields of all the farmers around me. I would really like to see t...
[Question] [ People keep telling me that the square of a number is the number multiplied by itself. This is obviously false. The correct way to square a number is to make it into a square, by stacking it on top of itself a number of times equal to the number of digits it has, and then reading all the numbers from t...
[Question] [ For this challenge, an ASCII art quilt will be a block of text 24 characters wide and 18 lines tall, containing the characters `=-<>/\` in a quilt-like pattern that is horizontally and vertically symmetrical. Example quilt: ``` ======================== ------------------------ //\\//\\\//\/\\///\\//\\ ...
[Question] [ ## Background *Note: This configuration was co-found by one of our fellow code golf enthusiasts, [Zgarb](https://codegolf.stackexchange.com/users/32014/zgarb)* A [29 year old conjecture by John Conway](https://cp4space.hatsya.com/2022/01/14/conway-conjecture-settled/) about the Game of Life was recentl...
[Question] [ You may know the game [*The Six Degrees of Kevin Bacon*](https://en.wikipedia.org/wiki/Six_Degrees_of_Kevin_Bacon), based on the conjecture that every actor in Hollywood can be connected to Kevin Bacon by no more than 6 "co-star" relations, so Kevin Bacon is supposedly the "best-connected" node in that...
[Question] [ Some divisors of positive integers really hate each other and they don't like to share one or more common digits. Those integers are called *Hostile Divisor Numbers* (***HDN***) **Examples** Number `9566` has `4` divisors: `1, 2, 4783 and 9566` (as you can see, **no two of them share the same digi...
[Question] [ Given an input of a list of positive integers with some replaced with `0`, output the list with the missing numbers that were changed to `0` replaced. Characteristics of the input list: * The list will always have a length of at least 2. * Let us define the input list as `a` and the "original list" (th...
[Question] [ In [Salesforce CRM](http://salesforce.com), every object has 15-character alphanumeric ID, which is case-sensitive. If anyone's curious, actually it's [base-62 number](https://help.salesforce.com/apex/HTViewSolution?id=000004383). However, tools used for data migration and integration may or may not su...
[Question] [ You should write a program or function which receives a string representing an ascii-art polygon as input and outputs ot returns the area of the polygon. The input is a string consisting of the characters `_ / \ L V space` and `newline` defining a [simple polygon](http://en.wikipedia.org/wiki/Simple_po...
[Question] [ [Related](https://codegolf.stackexchange.com/questions/226292/g%C3%B6del-numbering-of-a-string) but different. [Part II](https://codegolf.stackexchange.com/questions/260178/g%C3%B6del-encoding-part-ii-decoding) Taken from the book: Marvin Minsky 1967 – Computation: Finite and Infinite Machines, chapt...
[Question] [ Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C. Program B, when run in language B produces Program A, and running program B in language A produces program C. Program C, when run in language *A* or language *B*, prints "W...
[Question] [ A [man from the stars](https://codegolf.stackexchange.com/users/12914/elendia-starman) has come to Earth! Luckily the president of the United States, Donald Trump, has an infinity-sided die. Using this die, he can conjure up a number which *you*, the mayor of [Podunk](http://earthbound.wikia.com/wiki/P...
[Question] [ The mean of a population \$(x\_1,\dots,x\_n)\$ is defined as \$\bar x=\frac1n\sum\_{i=1}^n x\_i\$. The (uncorrected) [standard deviation](https://en.wikipedia.org/wiki/Standard_deviation#Uncorrected_sample_standard_deviation) of the population is defined as \$\sqrt{\frac1n\sum (x\_i-\bar x)^2}\$. It me...
[Question] [ ## Background [**Conway chained arrow notation**](https://en.wikipedia.org/wiki/Conway_chained_arrow_notation) is a notation to express very large numbers. It consists of zero or more positive integers separated by right arrows, e.g. \$2 \to 3 \to 4 \to 5 \to 6 \$. Assuming \$p, q, a\_1, \dots, a\_n\$ ...
[Question] [ One day you awake only to find yourself caught in an array. You try to just walk out of there, taking one index at the time, but it seems there are other rules: The array is completely filled with natural numbers. * If you find yourself on an index `n`, you go to the index `array[n]`, except: * If you ...
[Question] [ ## Task This one is simple. We want to compress a URL, but don't trust URL shorteners. Write a program that prints to stdout (or a 0-argument function that returns) the following, working URL: <http://a.b.c.d.e.f.g.h.i.j.k.l.m.n.oo.pp.qqq.rrrr.ssssss.tttttttt.uuuuuuuuuuu.vvvvvvvvvvvvvvv.wwwwwwwwwwwwwww...
[Question] [ It's strange that I haven't seen this, as Excel seems to be a valid language for code golfing (despite its 'compiler' not being free). Excel is somewhat of a wildcard in golfing, being good at golfing challenges of medium complexity, and sometimes simpler challenges as well. More often than not, Excel ...
[Question] [ Write a program that takes in a true-color RGB image *I*, the maximum number of lines to draw *L*, and the minimum *m* and maximum *M* length of each line. Output an image *O* that looks as much as possible like *I* and is drawn using *L* or fewer straight lines, all of which have Euclidean length betw...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/41522/edit). Closed 2 years ago. [Improve this question](/p...
[Question] [ [Minesweeper](https://en.wikipedia.org/wiki/Minesweeper_(video_game)) is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Instead, you click on nearby tiles to reveal the number of adjacent mines. One downside about the game is that it is possible t...
[Question] [ [Tab completion](https://en.wikipedia.org/wiki/Command-line_completion) is a useful feature that auto-completes partially written commands. You're going to be implementing it. For example, if the available commands were `['apply','apple','apple pie','eat']`, then `a` would complete to `appl`, as all of...
[Question] [ Each cell in a [life-like cellular automaton](http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) only needs one bit to represent it since it can only be alive or dead. That means there are only two colors; pretty boring. Normal images have 24 bits per pixel (8 in each of R G B). This means in a norm...
[Question] [ When translating DNA into proteins, the ribosomes read the sequence of DNA nucleotides 3 by 3. Each set of 3 nucleotides is called a codon, and each codon encodes for an amino acid, with some redundancies. Here's the conversion table used by most organisms (table is read left, top, right): [![Codon to ...
[Question] [ Write a program or function that takes in an eight byte string containing one of each of the characters `()[]{}<>` arranged in any way such that the four respective bracket types match. For example, `]<([){}>` is invalid input because the square brackets don't match (though all the others do). Print or...
[Question] [ Write the shortest code that will take any real number greater than 1 as input and will output its positive inverse factorial. In other words, it answers the question "what number factorial is equal to this number?". Use the Gamma function to extend the definition for factorial to any real number as de...
[Question] [ ## Description Your task is to output a 'depthmap' - that is, a heightmap of an object but not seen from its top but from its front. For example, consider the following object as shown on the image. The height map is shown on the left. The corresponding depth map would be (as seen from standing at the ...
[Question] [ Given a rectangle, a start point, and an end point, find any path from start to finish that avoids the rectangle. ## Example Suppose you were at \$(1.5, -1.5)\$ and you needed to get to \$(2, 4)\$. However, there is a rectangle with upper left corner \$(1, 3)\$ and bottom right corner \$(4, 1)\$ in you...
[Question] [ The [mid-autumn festival](https://en.wikipedia.org/wiki/Mid-Autumn_Festival) has begun! Unfortunately, all my mooncakes were stolen -- they're getting too expensive for small folk such as myself, and I fear I won't be able to eat any this year! So I turn to you for help. Would you be able to make me so...