text
stringlengths
180
608k
[Question] [ Given a permutation, we can define its high-water marks as the indices in which its cumulative maximum increases, or, equivalently, indices with values bigger than all previous values. For example, the permutation \$ 4, 2, 3, 7, 8, 5, 6, 1 \$, with a cumulative maximum of \$ 4, 4, 4, 7, 8, 8, 8, 8 \$ h...
[Question] [ ### Background Here in the UK1, these are the income tax rules: * You get a personal allowance (untaxed) of up to £12,570: + If you earn less than £100,000, you get the full £12,570 as personal allowance + For every £2 over £100,000, your personal allowance goes down by £1 * After the personal allowa...
[Question] [ Given two positive integers **A** and **B**, return the position **p** that *minimises* the number of prime factors (counting multiplicities) of the resulting integer, when **B** is *inserted* in **A** at **p**. For example, given **A = 1234** and **B = 32**, these are the possible insertions (with **p...
[Question] [ Curve stitching is the process of "stitching" together multiple straight lines in order to create a curve, like so: ![Imgur](https://i.stack.imgur.com/fWTBV.jpg) For an explanation of curve stitching, visit [this website](http://nrich.maths.org/5366/index). We will be drawing our curve in the top left ...
[Question] [ # Objective Write a full program that works exactly like the flow chart below. Each output, which is an integer, shall be through `stdout`, followed by a line feed. Each input shall be a line of string fed through `stdin`, and shall be judged to a predicate you choose for branching. The same predicate ...
[Question] [ A manufacturing company wants to print a design on mats of varying dimensions, and they hired you to program a robot to make these mats. The design consists of alternating rings of any 2 symbols on a mat. Below are some sample looks: Column 9 by Row 7 Symbol 1: @ Symbol 2: - Input: `9 7 @ -` ``` @@@@@@...
[Question] [ S. Ryley proved following theorem in 1825: > > Every rational number can be expressed as a sum of three rational cubes. > > > ### Challenge Given some rational number \$r \in \mathbb Q \$ find three rational numbers \$a,b,c \in \mathbb Q\$ such that $$r= a^3+b^3+c^3.$$ ### Details Your submission s...
[Question] [ The challenge, should you accept it, is to determine how much you win in the Bingo Golf Flax Lottery. Based on but not equal to the [BingoFlax lottery](https://www.fdj-gaming-solutions.com/bingo-flax/) The input is two lists of numbers (positive non-zero integers). The first list always contains 24 pot...
[Question] [ Your task is to calculate the amount you have to pay for prescribed medication at a pharmacy in Germany. The amount is simply based on the full price of the item, which will be your input. It is a decimal number with exactly two fractional digits (ex. 5.43). You can assume it's strictly positive. Your ...
[Question] [ The challenge is simple: write a program which takes in some non-empty string \$n\$ consisting of only uppercase and lowercase ASCII letters, and outputs the *code* for a program (in the same language) which takes in no input and outputs \$n\$. However, the code your program generates *must not contain...
[Question] [ **This question already has answers here**: [Golfing Advent of Code 2020, Day 3](/questions/217219/golfing-advent-of-code-2020-day-3) (11 answers) Closed 2 years ago. Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for...
[Question] [ # The language [Splinter](https://esolangs.org/wiki/Splinter) is an esoteric programming language where data is stored in 'splinters'. There are three different types of syntax: * Simple character output: `\character`, outputs a character * Splinter storage: `(splinter name){code}`, stores the code int...
[Question] [ Befunge Chess is an esolang mini-game I invented that is centered around the [Befunge](https://esolangs.org/wiki/Befunge) esolang. The general gist of the game is to make the instruction pointer land on a specific target cell while avoiding the opponent's target cell. Today's challenge isn't to play th...
[Question] [ A [bipartite graph](https://en.wikipedia.org/wiki/Directed_graph) is a graph whose vertices can be divided into two disjoint set, such that no edge connects two vertices in the same set. A graph is bipartite if and only if it is 2-colorable. --- # Challenge Your task is to, given the [adjacency matrix]...
[Question] [ Given two inputs -- one of them a non-empty printable ASCII string (including space, excluding newline), the other being one of two distinct, consistent values of your choice (`1 / 0`, `l / r`, `left / right`, etc.) -- output an ASCII art airplane banner of the string, pointing either left or right. Fo...
[Question] [ The challenge here is to extend an implementation of palindrome given the following as inputs: * `n > 1` and a list `l`. Your program must palindrome the list both vertically and horizontally, that is to say it must first palindrome the list itself, then each element in the list after; or the other way...
[Question] [ # Implement this key cipher ## Goal Use the algorithm (explained in the Algorithm section) to implement a certain cipher. The program must read input from STDIN or the closest available equivalent, use the algorithm to generate the ciphertext and a key. The ciphertext and the key will be written to STD...
[Question] [ The code on this site is rapidly being depleted. We need to invest in renewable strings. So you must write a program that takes a string and converts it into a windmill. # The Challenge Let's take a simple wind-mill string as an example. Take the string `abc`. The *pivot* is the center character, in th...
[Question] [ In this challenge, you are required to shift characters in an inputted string n number of times and output the shifted string # Input Input will first contain a string. In the next line, an integer, which denotes `n` will be present. # Output * If `n` is positive, shift the characters in the string to ...
[Question] [ *(inspired by this [SO question](https://stackoverflow.com/questions/26247602/nested-for-loop-art))* You are given as input a single positive integer *n*. In as few characters as possible, output a rocket in ASCII art with a head, a tail, and a body composed of *n* segments. There should be no trailin...
[Question] [ **Without using strings** (except when necessary, such as with input or output) calculate the nth digit, **from the left**, of an **integer** (in base 10). Input will be given in this format: ``` 726433 5 ``` Output should be: ``` 3 ``` as that is the fifth digit of "726433". Input will **not** contain...
[Question] [ ## The Rules It's time to build a typing speed test in your language of choice! **1**. You provide a file with a dictionary of choice (every 'word' in it must be newline delimited). Pipe it in via `stdin` or provide it's name as a command line argument. ``` a able about above absence ... ``` **2**. Pic...
[Question] [ The [TAK function](https://mathworld.wolfram.com/TAKFunction.html) is defined as follows for integers \$x\$, \$y\$, \$z\$: $$ t(x, y, z) = \begin{cases} y, & \text{if $x \le y$} \\ t(t(x-1,y,z), t(y-1,z,x), t(z-1,x,y)), & \text{otherwise} \end{cases} $$ It can be proved that it always terminates and ev...
[Question] [ Gelatin is a worse version of [Jelly](https://github.com/DennisMitchell/jelly). It is a tacit programming language that always takes a single integer argument and that has 7 (or maybe 16) commands. You are to take in a Gelatin program and its argument and output the result. ## Gelatin Gelatin programs ...
[Question] [ *Credit to Geobits in TNB for the idea* A [post](https://codegolf.stackexchange.com/questions/177390/recursive-multiplication) without sufficient detail recently posited an interesting game: 2 children sit in front of an array of candy. Each piece of candy is numbered 1 to `x`, with `x` being the total...
[Question] [ It seems that any [Simple](https://codegolf.stackexchange.com/questions/101057/inverse-deltas-of-an-array) [Modification](https://codegolf.stackexchange.com/questions/102139/reverse-deltas-of-an-array) of deltas using a consistent function can almost always be done some other [shorter](https://codegolf...
[Question] [ **Task** * The user inputs a sentence - words only. Any input other than letters or spaces, including integers and punctuation, should throw an exception: "Sentence must only use letters". * The output has a pattern, where some words are reversed and others words are normal. * The pattern starts as a n...
[Question] [ You have a swimming pool that is filled to the brim with water. You need to empty it, but you can't think of an efficient method. So you decide to use your red solo cup. You will repeatedly fill the cup all the way and dump it outside the pool. ## Challenge How long will it take to empty the pool? ###...
[Question] [ ## Background The Fibonacci sequence is defined as $$f(1) = 1 \\ f(2) = 1 \\ f(n) = f(n-1) + f(n-2)$$ The Fibonorial, similar to the factorial, is the product of the first \$n\$ Fibonacci numbers. $$g(n) = f(1) \times f(2) \times ... \times f(n-1) \times f(n)$$ The Fibonomial coefficient, similar to th...
[Question] [ ## The Task I guess everybody loves automatic code generation and saving some time during work. You have to create a lot of classes and members during the day and you don't want to create all those `getters` manually. The task is to write a program or function, that generates `getters` for all class me...
[Question] [ ## Challenge > > In this task you have compute the number of ways we can > distribute A balls into B > cells with with every cell > having at-least one ball. > > > The inputs A and B are given in a single line separated by a blank,the inputs are terminated by EOF. You may like to check your solu...
[Question] [ Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details. --- Fen is a magician Elf. He can cast spells on an array of numbers to produce another nu...
[Question] [ # Warning: Contains minor Deltarune Chapter 1 Spoilers Within the [Forest](https://deltarune.fandom.com/wiki/Forest) section of the first chapter of [Deltarune](https://www.deltarune.com/), there are a few puzzles that consist of entering playing-card suits in a certain order to move to the next sectio...
[Question] [ This challenge was inspired by [this tweet](https://twitter.com/ChrisKlerkx/status/1408140074089435140). ## Idea Consider a circle with `n` evenly spaced dots around the perimeter, where each dot has a postive integer value: [![dots](https://i.stack.imgur.com/jS5zN.png)](https://i.stack.imgur.com/jS5zN...
[Question] [ What tips do you have for golfing in Applescript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Applescript (e.g. "remove comments" is not an answer). [Answer] The `of` operator is used to get a property from an object: ``` log wo...
[Question] [ We all know scoring by characters is ripe for abuse. Let's prove this. ## The Challenge Output the following: ``` "m8V}G=D@7G1lAI,v08` #(hNb0A8T!g;==SVaG5~ g"jUF!bmRY(3I@na?2S{ fJVzo/GQYU%ybpfUq3aG Yza[jc,WJ$bP^7r};Da} V-!Z+Nk:`/poc}d/X:G\ sWX{dbAUv6,i]%RG$hRp ),bd+?/{U1tU[;<;u.Nk ZFPIOzJ/HimL!nexc,ls ...
[Question] [ You step into the restroom, and notice that the toilet paper has missing! It occurs to you that someone had *stolen* it. Strangely enough, the first thing you would like to know is the amount of toilet paper the thief stole. ## Task You are given three integers \$ I \$, \$ R \$, and \$ G \$, the detail...
[Question] [ I have a piece of paper whose shape is a regular `n`-gon with side length `1`. Then I fold it through some of its diagonals. What is the area of the shape formed by the (former) edges of the regular polygon? ## Illustration Suppose `n = 8`, i.e. an octagon-shaped paper. Let's name the vertices from A t...
[Question] [ ## Introduction You are stranded on a deserted island with some servants and are hunting for treasure. The longer one searches, the more treasure one finds. The fewer people searching, the more each person finds. Due to limited supplies, the leader has decided that a few people, up to a quarter of the ...
[Question] [ Given an ASCII art with simple closed paths using `|` and `-` (pipes and dashes), output a random point inside the boundary. Eg. given: ``` ---- ---- | |- --- => |12|- --- | | | | |345| |6| ----- --- ----- --- Any point 1-6 should have an equal probability of ...
[Question] [ The standard way to round numbers is to choose the nearest whole value, if the initial value is exactly halfway between two values, i.e. there is a tie, then you choose the larger one. However where I work we round in a different way. Everything is measured in powers of two. So wholes, halves, quarters...
[Question] [ Related: [Deck Names](https://codegolf.stackexchange.com/questions/214938/convert-magic-the-gathering-colours-to-a-colour-based-deck-name) [Friends or Foes](https://codegolf.stackexchange.com/questions/112766/magic-the-gathering-friends-or-foes) [Paying for Spells](https://codegolf.stackexchange.com/qu...
[Question] [ Your goal is to make a function that takes the coordinates of a cell in 2D space and a distance \$r\$ and returns the coordinates of all cells in the input coordinate's von Neumann neighborhood of radius \$r\$. That is, all cells at most \$r\$ away in [Manhattan distance](https://en.wikipedia.org/wiki/...
[Question] [ # Problem: In chess, there is a somewhat well known rule about draw by repetition. If the same position is repeated 3 times (or more) then the player intending to make the move which will cause the this repetition can claim a draw. Sometimes this is an easy task for an arbiter to spot, if the last few ...
[Question] [ A numerical polynomial is a polynomial \$p\$ in one variable with rational coefficients such that for every integer \$i\$, \$p(i)\$ is also an integer. The numerical polynomials have a basis given by the binomial coefficients: $$p\_n = {x \choose n} = \frac{x(x-1)\cdots(x-n+1)}{n!}$$ For instance: \$p\...
[Question] [ # GPA Calculator (GPA = Grade Point Average) You are a stressed out college student during finals week. Instead of studying for your exams coming up, you decide it is best to determine what GPA you will have at the end of the semester. This way you have data to back up your decision of staying up all n...
[Question] [ Manually summing a Cubically cube's faces is tedious and time-consuming, sorta like writing code in Cubically itself. In [Most efficient cubifier](https://codegolf.stackexchange.com/q/133793/61563), I asked you to translate ASCII to Cubically source. One of the answers there uses a cube initialization ...
[Question] [ In the [Thai calendar](https://en.wikipedia.org/wiki/Thai_calendar) the year 2017 corresponds to 2560. The Thai calendar is always 543 years ahead of the Gregorian calendar. Observant coders will note that 2560 is equal to \$2^9 \times 5\$, in other words it has 10 prime factors. This will not happen a...
[Question] [ This is the robbers' thread. For the cops' thread, go [here](https://codegolf.stackexchange.com/questions/64520/find-the-nested-source-codes-cops). # Introduction For this Cops/Robbers challenge, the cops will write output-producing programs and interweave them together. It is the robber's job to pick ...
[Question] [ Inspired by the title of [the *Toggle some bits and get a square* challenge](https://codegolf.stackexchange.com/questions/170281/toggle-some-bits-and-get-a-square). In that challenge you output how many bits should be toggled, in order for the base-10 representation of the binary to become a square n...
[Question] [ Related to [AoC2017 Day 18](https://adventofcode.com/2017/day/18), Part 2. (Anyone want to add Duet to esolangs?) --- **Duet** is an assembly-like language that involves two processes running the same program simultaneously. Each process of Duet operates with 26 registers named `a` to `z`, all initiali...
[Question] [ ## Fluff After taking a look at [deadfish](https://esolangs.org/wiki/Deadfish), I decided it sucked, so I came up with a new (and easier) variant of it: imnotdeadfish. As with its predecessor, there are 4 commands and an accumulator which begins at 0: ``` + # increment the accumulator - # decrement the...
[Question] [ I have a hardware that has a 32-bit input register. The register has the following characteristics: * The 32-bit register consists of eight 4-bit fields. * Each 4-bit field holds a value in **signed-magnitude**; it can hold an integer between -7 and +7 inclusive, including -0 and +0 (signed zeroes). Fo...
[Question] [ ## Introduction In this challenge, your task is to simulate a certain type of elimination game. In the game, the participants stand in a circle, and everyone is holding an integer. On each round of the game, every participant points at the person `n` steps away, if `n` is the number they are holding. I...
[Question] [ *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 choo...
[Question] [ *Dedicated to Martin Gardner, taken from his book* ## Background In the old days, the Slavs had a divination method for finding out whether a girl would get married. The girl would clutch six straws in her hand so that the ends would poke out the top and bottom of her fist. Then her friend would join t...
[Question] [ In this [king-of-the-hill](/questions/tagged/king-of-the-hill "show questions tagged 'king-of-the-hill'") challenge, you will program a bot, consisting of a [python](/questions/tagged/python "show questions tagged 'python'") function of the form ``` def BOTNAME(info, me, round): pass # ... main bod...
[Question] [ Using the matchstick numbers here: [Count the Matchsticks](https://codegolf.stackexchange.com/q/160089/9534) ``` _ _ _ _ _ _ _ _ | | | _| _| |_| |_ |_ | |_| |_| |_| | |_ _| | _| |_| | |_| _| ``` How many matchsticks must be moved and/or remo...
[Question] [ ## Intro You like cats. Naturally, you like cat’s games in tic-tac-toe. So, you’ve come up with a little party trick. You ask someone what square on the board they want you to make a move in. And you ask someone else on which turn they want you to make that move. You also let that person decide whether...
[Question] [ # Introduction [Fischer random chess](https://en.wikipedia.org/wiki/Fischer_random_chess), also known as Chess960 for the 960 valid starting boards, is a variant of chess where each player's pieces are randomly shuffled at the start. As a reminder, each player gets 8 pawns, two rooks, two knights, two ...
[Question] [ Related: [Cleaning up decimal numbers](https://codegolf.stackexchange.com/q/207352/78410) ## Background A **[continued fraction](https://en.wikipedia.org/wiki/Continued_fraction)** is a way to represent a real number as a sequence of integers in the following sense: $$ x = a\_0 + \cfrac{1}{a\_1 + \cfra...
[Question] [ ### Preamble There was a unit test in our codebase which was shuffling a string of length \$52\$ formed from the set of letters \$[A-Z]+[A-Z]\$ and then using the first \$20\$ characters of that shuffled string. It failed quite a while after being written due to no repeated character being present in...
[Question] [ ### Introduction In number theory, we say a number is \$k\$-smooth when its prime factors are all at most \$k\$. For example, 2940 is 7-smooth because \$2940=2^2\cdot3\cdot5\cdot7^2\$. Here, we define a \$k\$-smooth pair as two consecutive integers which both are \$k\$-smooth. An example of 7-smooth pa...
[Question] [ **This question already has answers here**: [Alphabet triangle](/questions/87496/alphabet-triangle) (96 answers) [Print this diamond](/questions/8696/print-this-diamond) (133 answers) Closed 6 years ago. The following is the rhombus sequence. ``` 1 121 12321 1234321 123454321 12345654321 1234...
[Question] [ You may write a program or function that receives an *odd, positive integer* `n`, where `n >= 3`, as either a function argument, command line arguments, or on STDIN (or equivalent for your system), and prints to STDOUT (or system equivalent) an ASCII spiral that spins inward clockwise where the **top**...
[Question] [ The goal is to write a program (anything except explicit brainfuck) which prints [Barney Stinson](http://en.wikipedia.org/wiki/Barney_Stinson)'s best rule: > > New is always better. > > > when interpreted normally, but > > Legen... wait for it... dary! > > > When processed with a Brainfuck inte...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/20920/edit). Closed 7 years ago. [Improve this question](/posts/20920/edit) ...
[Question] [ Given \$x\$ distinguishable balls (say they have different colors), sample with replacement repeatedly until all the balls that have been seen, have been seen at least twice. # Challenge The input is the integer value \$x \geq 2\$. The challenge is to compute the probability that you would have seen al...
[Question] [ # Task Here is an interesting math problem: > > Let's say that there are \$n\$ indistinguishable unlabeled objects in a bin. For every "round", pull \$k\$ objects randomly out of the bin with equal probability, and apply a label on each object (Nothing happens to objects already having a label). Then ...
[Question] [ A followup to [this challenge](https://codegolf.stackexchange.com/q/262486/66833) by [Jeremy Collprav](https://codegolf.stackexchange.com/users/115553/jeremy-collprav), inspired by [DLosc solving this in Regenerate](https://chat.stackexchange.com/transcript/message/63935688#63935688). Some sections cop...
[Question] [ Fastest code is a scoring method on this site where the goal is to write code that is as fast as possible. From the tag wiki: > > The winner of a fastest-code challenge is determined by the runtime performance of the submissions. For fairness, all submissions should be benchmarked on the same machine,...
[Question] [ Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for details. The story continues from [AoC2015 Day 3](https://adventofcode.com/2015/day/3), Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost). --- Sant...
[Question] [ I have a small pill box of \$n\$ slots. (Think of it as a linear one like the image below, but not necessarily having 7 slots.) ![a green daily pill box with the initials of the days of the weeks, starting with S for Sunday, and continuing as M, T, W, T, F, S for the remaining days](https://i.stack.img...
[Question] [ Consider a form of binary where digits can be any of \$1\$, \$0\$ and \$-1\$. We'll still call this "binary" because we convert the digits from base two. For example, $$\begin{align} [1, 0, -1, 1]\_2 & = 1 \times 2^3 + 0 \times 2^2 + -1 \times 2^1 + 1 \times 2^0 \\ & = 8 - 2 + 1 \\ & = 7 \end{align}$$ ...
[Question] [ There's never really been a definitive ASCII-cards challenge AFAIK. So, using the following deck of ASCII cards: ``` .------..------..------..------..------..------..------..------..------..------..------..------..------. |2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||...
[Question] [ # Challenge description In **taxicab metric**, a distance between two points [![enter image description here](https://i.stack.imgur.com/4OjWi.gif)](https://i.stack.imgur.com/4OjWi.gif) is defined as: [![enter image description here](https://i.stack.imgur.com/71YE5.gif)](https://i.stack.imgur.com/71YE5....
[Question] [ You are a young programming geek living with your 2 other best friends. Every week, one of you has to do all the chores of the house and you decide whose turn it is by picking a stick. The one who picks the shortest stick loses and does all the chores. As all of you are programmers and love creating pu...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 9 years ago. [Improve this quest...
[Question] [ A *run ascending list* is a list such that runs of consecutive equal elements are strictly increasing in length. For example `[1,1,2,2,1,1,1]` can be split into three runs `[[1,1],[2,2],[1,1,1]]` with lengths `[2,2,3]`, since two runs are the same length this is **not** a run ascending list. Similarly ...
[Question] [ [Inspired](https://chat.stackexchange.com/transcript/message/60665979#60665979) by @AviFS. Given a string containing brackets, e.g. ``` [xyz]]abc[[def]hij[ ``` You can parse through it with a stack of brackets. When you find an open bracket, push a value to the stack, when you find a close bracket, pop...
[Question] [ ### Information * Given a **non-negative odd** integer (let's call it \$n\$), find the **number of all** possible paths which covers all squares and get from the start to end on a grid. * The grid is of size \$n\$×\$n\$. * The start of the path is the **top left** corner and the end is the **bottom rig...
[Question] [ You have a bunch of cities on a grid which you wish to link up. Roads can be placed on any tile that doesn't contain a city, and connect to all roads or cities adjacent to them, vertically, horizontally or diagonally. Roads can link up via cities, for example ``` C \ C-C ``` is fully linked up. Howe...
[Question] [ Imagine a text file where each csv record may have different numbers of fields. The task is to write code to output how many fields there are in each record of the file. You can assume there is no header line in the file and can read in from a file or standard input, as you choose. You can assume a ver...
[Question] [ In case you missed [Encode Factor Trees](https://codegolf.stackexchange.com/q/150144/62402), here is the definition of a Factor Tree: > > * The empty string is 1. > * Concatenation represents multiplication. > * A number *n* enclosed in parentheses (or any paired characters) represents the *n*th prime...
[Question] [ [\*What is a transmogrifier?](http://calvinandhobbes.wikia.com/wiki/Transmogrifier) In the [C programming language](https://en.wikipedia.org/wiki/C_(programming_language)), there are formations called [digraphs and trigraphs](https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C) that are two and thre...
[Question] [ **This question already has answers here**: [Case Permutation](/questions/80995/case-permutation) (24 answers) Closed 6 years ago. Here's a scenario: A grandmother and grandfather forget what their GMail password is. They know the word, but can't remember which letters are capitals. The challen...
[Question] [ ## Background The [metallic means](https://en.wikipedia.org/wiki/Metallic_mean), starting with the famous [golden mean](https://en.wikipedia.org/wiki/Golden_ratio), are defined for every natural number (positive integer), and each one is an irrational constant (it has an infinite non-recurring decimal ...
[Question] [ Ok, my first golf question. Please be gentle :) I know there's way too many ascii puzzles :P but here we go. The task is simple, use your favorite programming language to print a triangle ripple. The input should be the size of the ripple. Each triangle is evenly spaced out. Basically, you keep adding ...
[Question] [ As you know, the World Cup group stage is over, and from tomorrow the best 16 teams will commence the knockout stage: * Brazil (BRA) * Mexico (MEX) * Netherlands (NED) * Chile (CHI) * Colombia (COL) * Greece (GRE) * Costa Rica (CRC) * Uruguay (URU) * France (FRA) * Switzerland (SUI) * Argentina (ARG) *...
[Question] [ plorcly borglar is a "mod" created by jan Misali for the constructed language toki pona that makes words sound funny. It involves substituting the 14 toki pona letters for funnier versions plus 2 extra rules. The substitutions are: | toki pona letter | plorcly borglar letter | | --- | --- | | m | bl | ...
[Question] [ ## Description Your task is to implement a simple UNIX command parser and file system. Your program will have to implement a file system that can be modified via commands. The starting directory of your file system is an empty root directory `/`, with no subdirectories or files. Your program must be ca...
[Question] [ Consider the following list: ``` expected = [ 'A', 'B', 'AB', 'C', 'D', 'CD', 'ABCD', 'E', 'F', 'EF', 'G', 'H', 'GH', 'EFGH', 'ABCDEFGH', 'I', 'J', 'IJ', 'K', 'L', 'KL', 'IJKL', 'M', 'N', 'MN', 'O', 'P', 'OP', 'MNOP', 'IJKLMNOP', 'ABCDEFGHIJKLMNOP', ... ] ``` Here's one way to look at it - you're learn...
[Question] [ Given an array of non-negative integers, your task is to only keep certain elements of it, as described below. * Let's say the array is `[1, 3, 2, 4, 11, 5, 2, 0, 13, 10, 1]`. * First get the first element of the array, `n`. Keep the first `n` elements and discard the next one (discard the `n+1`th). Th...
[Question] [ A simple FizzBuzz using strings. **Given** * 1 word or phrase (string) * 2 unique characters **Output** The word or phrase with each occurrence of the first character replaced with fizz and each of the second character replaced with buzz **Rules** * The first letter in both Fizz and Buzz must remain ca...
[Question] [ ## Interpret loose ranges [ListSharp](https://github.com/timopomer/ListSharp) is an interpreted programming language that has many features, one of those features is a 1 index based range creator that works like this: You define a range as `(INT) TO (INT)` or just `(INT)` where both or the single int c...
[Question] [ Given a list of paths, output the correct path. Example of path: ``` /\ ----+/ | ``` * `-` and `|` are horizontal and vertical paths. * `/` and `\` are 90° turns. * `+` is treated as a `-` or a `|` depending of the current direction. Paths may go in any direction and a character may be used in ...
[Question] [ Executive summary: test whether an input sequence of integers is "admissible", meaning that it doesn't cover all residue classes for any modulus. ## What is an "admissible" sequence? Given an integer m ≥ 2, the *residue classes modulo m* are just the m possible arithmetic progressions of common differe...
[Question] [ ## Background Consider a round-robin tournament, in which each contestant plays one game against every other contestant. There are no draws, so every game has a winner and a loser. A contestant **A** is a *king* of the tournament, if for every other contestant **B**, either **A** beat **B**, or **A** b...
[Question] [ # Definitions Let `m` and `n` be positive integers. We say that `m` is a *divisor twist* of `n` if there exists integers `1 < a ≤ b` such that `n = a*b` and `m = (a - 1)*(b + 1) + 1`. If `m` can be obtained from `n` by applying zero or more divisor twists to it, then `m` is a *descendant* of `n`. Note ...
[Question] [ Write the shortest program to forecast the weather for the next 7 days The input (from stdin) is the *weekday* and the *season* The output (to stdout) is seven lines *weekday* and the *temperature* in centigrade The weekdays begin on the input weekday The temperatures are random numbers with the range ...