text
stringlengths
180
608k
[Question] [ Draw this Ascii coffee cup: ``` o o o __________ / \__ | J | \ | A | | | V | | | A |__/ \__________/ ``` Brownie points for coffee-script or java :) Shortest code in bytes, function or program, trailing newline or white space is acceptable, drink up...
[Question] [ A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which t...
[Question] [ [Related](https://codegolf.stackexchange.com/questions/246025/average-ignorant-sets-of-integers). Given a list of 3 or more positive integers, remove every number X for which there is another number Y in the list and the average of X and Y is also in the list. In other words, if X, Y, and the average o...
[Question] [ This one comes from a real life problem. We solved it, of course, but it keeps feeling like it could have be done better, that it's too lengthy and roundabout solution. However none of my colleagues can think of a more succinct way of writing it. Hence I present it as code-golf. The goal is to convert ...
[Question] [ **Input:** A positive integer `n=p^q` where `p` and `q` are [prime](https://www.mathopenref.com/prime-number.html). **Output:** Output the result of `q^p` **Test cases (in, out):** ``` 4, 4 8, 9 25, 32 27, 27 49, 128 121, 2048 125, 243 343, 2187 1331, 177147 3125, 3125, 16807, 78125, 823543, 823543 1...
[Question] [ For an integer `n` that satisfies `n > 0`, write its value as a right-descending path based on its binary representation. # Rules * The first (most significant) set bit is always in the top-left corner. * When the next bit is set (a `1`), draw a character ("filled") on the next line in the same column ...
[Question] [ Write a function that takes as input a set of integers (can be a list, array or any other container with distinct numbers), and outputs the list of all its permutations. **Python (95 chars)**: ``` p=lambda s:s and sum(map(lambda e:map(lambda p:[e]+p,p(filter(lambda x:x!=e,s))),s),[]) or [[]] ``` It'd b...
[Question] [ Your task is to write a program, function or snippet (yes, snippets are allowed) that simply outputs an integer. *However*, you must be able to separate your submission into prefixes that *also* produce distinct integers. You cannot use any bytes that have appeared in previous prefixes. For example, we...
[Question] [ Given an integer `N` as input, output the `N`th permutapalindromic number. A permutapalindromic number is a strictly positive integer such that there is at least one permutation of its digits that results in a palindrome (i.e. a number that is its own reverse). For example, `117` is a permutapalindromi...
[Question] [ Given a string as input, output the US state whose capital it is if it is a state capital, the capital of the state if it is a state, or `Arstotzka` if it is neither. Examples: ``` Austin -> Texas Alaska -> Juneau The Nineteenth Byte -> Arstotzka ``` All the capitals and their respective states: ``` Ba...
[Question] [ Given two positive numbers `N >= 2` and `N <= 100` create a matrix which follows the following rules: * First Number starts at position `[0,0]` * Second Number starts at position `[0,1]` * Third number goes below First Number (position `[1,0]`) * Following numbers goes in "slash" direction * Range of n...
[Question] [ ## Definition and Rules A *golfy array* is an array of integers, where each element is *higher than or equal to* the arithmetic mean of all the previous elements. Your task is to determine whether an array of positive integers given as input is golfy or not. * You do not need to handle the empty list. ...
[Question] [ ### Introduction Let's observe the following sequence (non-negative integers): ``` 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ... ``` For example, let's take the first **three** numbers. These are `0, 1, 2`. The numbers used in this sequence can be ordered in **six** different ways: ``` 012 12...
[Question] [ Given an integer \$N\$, you must print a \$N\times N\$ integer involute with the numbers increasing in a clockwise rotation. You can start with either 0 or 1 at the top left, increasing as you move towards the centre. ## Examples ``` Input => 1 Output => 0 Input => 2 Output => 0 1 3 2 Input => 5 Outp...
[Question] [ Given an array of integers. Find out its longest sub-array (contiguous subsequence) whose sum is 0. The sub-array for output *may* be an empty array. ## Input Input an array of integers. ## Output Output the longest zero sum sub-array. If there are multiple such arrays, output any one of them. ## Outpu...
[Question] [ So this is my first challenge on this site. The challenge is to take in an input integer \$n\$, which will be positive, and print, in ascending order (\$1\$ to \$n\$, **including n**), the output of \$i^{(n-i)}\$ (where \$i\$ is the current integer). # Example Given the input 5, the program will print...
[Question] [ # Challenge Your task is to encode an integer as a string of [ASCII](https://codegolf.meta.stackexchange.com/a/5869/82619) characters, then successfully decode it after said string has been randomly shuffled. You will write two [programs/functions](https://codegolf.meta.stackexchange.com/q/2419/82619),...
[Question] [ Consider, for a given positive integer \$k\$, the sequence \$(a, a+1, a+2, ..., a+k)\$, where \$a\$ is some positive integer. Is there ever a pair \$a, k\$ such that for each element \$a+i\$ in the sequence, either \$\gcd(a, a+i)\$ or \$\gcd(a+i, a+k)\$ are greater than 1? This was investigated by [Ala...
[Question] [ # Introduction A while ago a lost SO user posted a question here and its now been deleted but I think it would make a good challenge so here it goes... # Challenge Write a full program or function that takes two strings and checks whether any permutation of the first string is a sub-string of the secon...
[Question] [ Write a program or function with no input that prints or returns this string of [24-hour](https://en.wikipedia.org/wiki/24-hour_clock) and [12-hour](https://en.wikipedia.org/wiki/12-hour_clock) times: ``` 00:00 12:00am 01:00 1:00am 02:00 2:00am 03:00 3:00am 04:00 4:00am 05:00 5:00am 06:00 6:00am ...
[Question] [ Given an image, output the [width in pixels of a full vertical section]1 (if one exists). If no vertical section exists, output `0`. Input may be provided as a local file or a nested array. If you choose to take input as a nested array, white pixels should be represented by a truthy value while non-whi...
[Question] [ Given a string containing some parentheses and some other ASCII printable characters, like this: `(abc((123))(k))` your task is to remove any sets of parentheses that are redundant. A set of parentheses is redundant if: 1. It encloses another set of matching parentheses, like `ab((123))`, or 2. It encl...
[Question] [ **Explanation:** Last year in math class, on homework we would occasionally get these extremely simple, although equally annoying questions called diamond puzzles. These were basically questions where we would be given a sum, and a product then were asked to find the two numbers which when multiplied g...
[Question] [ The Binary Sierpinski Triangle sequence is the sequence of numbers whose binary representations give the rows of the Binary Sierpinski Triangle, which is given by starting with a 1 in an infinite row of zeroes, then repeatedly replacing every pair of bits with the xor of those bits, like so: ``` f(0)= ...
[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 3 years ago. [Improve this quest...
[Question] [ Now that I'm thoroughly addicted to Code Golf, it's probably about time that I try to pick up a few golfing languages. Given that I play almost exclusively in JavaScript, [Japt](https://github.com/ETHproductions/japt) seems like the logical language to start with. I'll be diving into the documentation ...
[Question] [ [Related](https://codegolf.stackexchange.com/q/257458/119451). Given a positive integer \$n\$, output all integers \$b\$ (such that \$1<b<n-1\$) where \$n\$ can be written as the sum of any number of consecutive powers of \$b\$. **Example:** Let's say \$n=39\$. \$3^1+3^2+3^3\$ \$= 3 + 9 + 27\$ \$...
[Question] [ You are to write a program which outputs a single positive integer \$n\$. The integer may have leading zeros and whitespace, and/or trailing whitespace. Then, choose a positive integer \$m > 1\$. When the program is repeated exactly \$m\$ times, it should output \$m \times n\$ (and only \$m\times n\$)....
[Question] [ You are given a list of at least two positive integers as input. The challenge is to find such a position of a cut that minimizes the absolute difference between the sums of the two parts (to the left and to the right of it). The position should be given as the index of the first element after the cut....
[Question] [ [Inspiration](https://codegolf.stackexchange.com/q/59299/43319). ### Task Reverse runs of odd numbers in a given list of 2 to 215 non-negative integers. ### Examples `0 1` → `0 1` `1 3` → `3 1` `1 2 3` → `1 2 3` `1 3 2` → `3 1 2` `10 7 9 6 8 9` → `10 9 7 6 8 9` `23 12 32 23 25 27` → `23 12 32...
[Question] [ It's very simple: Your program or function should generate the following text: ``` Elizabeth obnoxiously quoted (just too rowdy for my peace): "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG," giving me a look. ``` ## Fine print You may write a [program or function](https://codegolf.meta.stackexchange.com...
[Question] [ A date can be represented by an unsigned integer as such: YYYYMMDD. What you need to do, is write the shortest program or function that figures out the most recent date whose number was divisible by a given number `n` (including today's date) and then returns that date in the format showed above. If th...
[Question] [ Given an input integer `n > 1`, output an ASCII-art octagon with side lengths composed of `n` characters. See examples below: ``` n=2 ## # # # # ## n=3 ### # # # # # # # # # # ### n=4 #### # # # # # # # # # # # # # # # # ...
[Question] [ My first code golf question post! Hope u like it ;-) The task is simple. Write either an stdin-stdout program or a function. Input is a 2D array which contains only either characters or the integer `0`. You are allowed to replace the integers with the character `'0'` or `null` instead in any language (...
[Question] [ Given a positive integer nesting level `n` and string `s` of printable ascii characters( to `~`, output a program which, when run in the same language, outputs a program which outputs a program . . . which outputs the string `s`. A total of `n` programs should be generated, all of which should be run i...
[Question] [ A digit word is a word where, after possibly removing some letters, you are left with one of the single digits: ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT or NINE (not ZERO). For example, BOUNCE and ANNOUNCE are digit words, since they contain the digit one. ENCODE is not a digit word, even though ...
[Question] [ A sculptor is tasked to creating icicle sculptures for the new museum in Greenland. He has been given specifications by his boss, which consists of two numbers: [s, m] or size and melt. Size *must* be an odd number. He was given some photos of real icicles: ``` vvvvv [5, 0] vvv v vvvvvvv [7, 0] vv...
[Question] [ This is the cops' thread. For the robbers' thread, click [here](https://codegolf.stackexchange.com/questions/99472/quine-anagrams-robbers-thread). ### Cops' Task * First, write a quine in a language of your choosing. * Next, scramble the quine. Make sure to do this well as the robbers will be trying to...
[Question] [ Given a list \$X\$ of 2 or more integers, output whether, for all \$n\$ such that \$0 \leq n < length(X)-2\$, there exists a pair of equal integers in \$X\$ separated by exactly \$n\$ elements. In other words: output whether, for all overlapping slices/windows of the input, there exists at least one sl...
[Question] [ **The input:** As an example, take a list containing a number of bits (in this case, 32): ``` 11000010000100111011000011001011 ``` We can calculate a simple [checksum](https://en.wikipedia.org/wiki/Checksum) of this data by dividing it into evenly sized blocks, and taking the XOR of each of them. For e...
[Question] [ A *digit addition generator* of an integer `n` is any integer `x` that satisfy the equation `x + s(x) = n`, with `s(x)` being the sum of the digits of `x`. (We will work under base 10 for convenience.) For example, a digit addition generator for `29` would be `19`, because `19 + (1 + 9) = 29`. Some num...
[Question] [ 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 e...
[Question] [ Inspired by [Create a binary wall](https://codegolf.stackexchange.com/questions/135323/create-a-binary-wall) Given a list of positive integers, we can write them out all above each other like so, for `[2, 6, 9, 4]` as an example: ``` 0010 0110 1001 0100 ``` We can imagine this as a wall: ``` ..#. .##. ...
[Question] [ Help! My **[Completely Automated Lights From Darks Separator V3001.01](http://i.ebayimg.com/00/s/NTEyWDUxMg==/z/E1MAAOSwr81UPxrD/$_1.JPG)** broke! :( # Guidelines --- ## Task Write a program that will take an input of an array (or a list in some languages) of any amount of strings that are either the l...
[Question] [ Given a string, reverse it interleavingly. Here's how to do it for `abcdefghi` and `abcdefghij`, 0-indexed: 1. Separate the chars at even indices from the chars at odd indices: ``` a c e g i b d f h a c e g i b d f h j ``` 2. Reverse the chars at odd indices: ``` a c e g i h f d b a c e g i j h...
[Question] [ This problem is "inspired" from a question that was originally asked on [Quora](https://www.quora.com/unanswered/How-should-one-find-the-maximum-deviation-from-a-given-number-of-consecutive-integers) (not for code golfing). I just want to make it a challenge for you guys (and my first problem submissio...
[Question] [ If you place a knight on any square of a chessboard, what is the smallest amount of steps to reach every position? **Rules** * It is an 8 by 8 board. * The knight starts at an arbitrary position, taken as input. * The knight moves 2 squares in one direction and 1 square in the other, for example, a kni...
[Question] [ Given an input `n`, your program or function must output the smallest positive integer `k` such that `n` rounded to the nearest multiple of `k` is greater than `n`. ### Example. Given an input `20`, the output value should be `3`: * The nearest multiple of `1` is `20`, which is **not** greater than `2...
[Question] [ Your challenge is to minify [Brainfuck](http://esolangs.org/wiki/Brainfuck) code, according to these rules: * Remove anything that is not one of `+-><[].,`. * For any group of consecutive `+` or `-` characters, if the amount of `+`s and `-`s is the same, remove them. * Do the same as above, but with `...
[Question] [ Inspired by [this question](https://codegolf.stackexchange.com/questions/66202/product-over-a-range) by [@CᴏɴᴏʀO'Bʀɪᴇɴ](https://codegolf.stackexchange.com/users/31957/c%E1%B4%8F%C9%B4%E1%B4%8F%CA%80-ob%CA%80%C9%AA%E1%B4%87%C9%B4). Taken from the question: > > Your task is simple: given two integers a...
[Question] [ Inspired by [Find the largest fragile prime](https://codegolf.stackexchange.com/questions/41648/find-the-largest-fragile-prime). By removing at least 1 digit from a positive integer, we can get a different non-negative integer. Note that this is different to the `Remove` function in the linked question...
[Question] [ In honor of [Star Wars day](http://en.wikipedia.org/wiki/May_the_fourth), write a program to display the following text, scrolling like the [Star Wars opening crawl](http://en.wikipedia.org/wiki/Star_Wars_opening_crawl): ``` It is a period of civil war. Rebel spaceships, striking from a hid...
[Question] [ ## Background [**Elias omega coding**](https://en.wikipedia.org/wiki/Elias_omega_coding) is a universal code which can encode positive integers of any size into a stream of bits. Given a positive integer \$N\$, the encoding algorithm is as follows: 1. Start with a single zero in the output. 2. If \$N=1...
[Question] [ In the US, clothing size sometimes has rough designations like M, L, XXL, etc. The US designation of the "men's jacket" category depends on the height of the person. So, in this challenge, you should implement this conversion, which is defined by the following table, taken from [this site](https://www....
[Question] [ The difference list of a list of integers is the list differences of consecutive members. For example the difference list of ``` 1, 3, 2 ,4 ``` is ``` 2, -1, 2 ``` Your task is to take as input a difference list and output what the difference list would look like if the original list were sorted. For e...
[Question] [ ## Presented in honor of [APL as an interactive tool turning 50 this year](http://www.dyalog.com/50-years-of-apl.htm) ### [Background](http://www.jsoftware.com/papers/APLQA.htm) > > [Ken [Iverson]](https://en.wikipedia.org/wiki/Kenneth_E._Iverson) presented his paper *[Formalism in Programming Languag...
[Question] [ On that challenge you have to solve that challenge. # Contest is over! Check the end of the question **Specs:** 1. Write the smallest code (Any language\*). 2. The score of an answer is the sum of: * Code length **without whitespace**. * Number of answers using that same language squared. * Length o...
[Question] [ # Task Given a positive integer `n`, draw the corresponding rocket. # Examples From `n = 1` to `4` the rockets are below. For your program's output, the trailing newline after a rocket is optional. ``` | / \ *---* | o | | o | *---* /_\ | / \ / \ *-----* | o o | | o o | | o o | | o o | *----...
[Question] [ * Alice (A) and Bob (B) decided to have a battle. * Each combatant has 10 health. * They take turns to roll a 6 sided die for damage. * That damage is removed from their opponent's health. * In the end either Alice or Bob, will vanquish their foe. --- Show me how the battle went. Outputting these codes...
[Question] [ A positive integer **x** is a square triangle number iff there are two different positive integers, **y** and **z**, which are smaller than **x** such that all of the sums **x + y** **x + z** **y + z** are perfect squares. For example 30 is a square triangle number because **30 + 6 = 62** **30 + 19 = 7...
[Question] [ The RGB color value `#00FF00` is a rather important one: it is used to make movies, TV shows, weather announcements, and more. It is the famous "TV green" or "green screen" color. ## The Challenge Your task is to write a program that takes two input images, both in PNG format (or in your image library'...
[Question] [ Given a number **n**, generate the first **n** columns of this pattern: ``` # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ################################ ... ``` The height of the col...
[Question] [ **Input:** A list/array of integers for which each item is in the range of `2-36`. **Output:** The sum of the integers (as base 10), where each next integer is in the base of the previous value (starting with a regular base 10). **Example:** Let's say we have an input like this: `[4, 12, 34, 20, ...
[Question] [ **Recursively prime-encoded integers** Consider \$11681169775023850 = 2 \times 5 \times 5 \times 42239 \times 5530987843\$. This isn't a nice prime factorisation, as \$42239\$ and \$5530987843\$ make it difficult to store this factorisation in a small manner. Being primes, we can't then factorise them,...
[Question] [ [Inspiration.](https://chat.stackexchange.com/transcript/message/42442315#42442315) Given (by any means): * A two-argument (or single argument consisting of a two-element list) [black box function](https://codegolf.meta.stackexchange.com/a/13706/24877), `f: ℤ+ × ℤ+ → ℤ+` (input and output are 1, 2, 3,…...
[Question] [ Consider a **permutation** of the integers `1`, ..., `n`, such as this one for `n = 6`: ``` [5,2,4,3,6,1] ``` If you view the permutation as a mapping from `[1,2,3,4,5,6]` to `[5,2,4,3,6,1]`, the permutation can be decomponsed into disjoint **cycles**. A cycle is a subset of elements that map to each o...
[Question] [ ## Challenge: Given a list of multi-line strings, overlap them (in the top-left) and output the result. **Example:** Input: `["aaaa\naaaa\naaaa\naaaa","bb\nbb\nbb","c"]` Output: ``` cbaa bbaa bbaa aaaa ``` ## Challenge rules: * Input-format is flexible. You are allowed to get the input as a 2D list o...
[Question] [ Let's get back to basics! * Your code, a complete program or function, must convert the official Unicode name of a printable Basic Latin character into the corresponding character. For example, for the input `LOW LINE` your code must output `_`. * You only need to take a single character name as input...
[Question] [ ## Similar figures Two rectangles are *similar* if the ratios of their sides are the same. Consider these two rectangles; a rectangle 5 lines tall and 11 chars wide: ``` =========== =========== =========== =========== =========== ``` and a rectangle 10 lines tall and 22 chars wide: ``` ================...
[Question] [ Your input is an array of numbers: a [permutation](https://en.wikipedia.org/wiki/Permutation) of \$\{1, 2 \dots n\}\$ for some integer \$n \geq 2\$. How many times must you repeat this list before you can "pick out" the numbers \$[1, 2 \dots n]\$ in order? That is: find the lowest \$t \geq 1\$ so that ...
[Question] [ **Input** Integers a1, a2, a3, b1, b2, b3 each in the range 1 to 20. **Output** ``` True if a1^(a2^a3) > b1^(b2^b3) and False otherwise. ``` ^ is exponentiation in this question. **Rules** This is code-golf. Your code must terminate correctly within 10 seconds for any valid input on a standard desktop ...
[Question] [ ## Introduction: Inspired by these two SO questions (no doubt from the same class): [print the elements in the subarray of maximum sum without adjacent elements java](https://stackoverflow.com/q/55691215/1682559) and [Maximum sum of non adjacent elements of an array, to be printed](https://stackoverflo...
[Question] [ Given two positive integers `a` and `b`, output the frequency distribution of rolling a `b`-sided die `a` times and summing the results. A frequency distribution lists the frequency of each possible sum if each possible sequence of dice rolls occurs once. Thus, the frequencies are integers whose sum eq...
[Question] [ ## Input None ## Output 52 cards. No duplicates. Cards are represented as their unicode characters, e.g. 🂹. The [Unicode codepoints](http://unicode.org/charts/PDF/U1F0A0.pdf) follow the following format: * The first three digits are `1F0`. * The next digit is `A`, `B`, `C`, or `D` for spades, hearts...
[Question] [ **Updates: Time limit removed. You must be able to describe output - see new rule.** A [pangram](http://en.wikipedia.org/wiki/Pangram) is a sentence that uses every letter in the alphabet at least once, such as: > > *[The quick brown fox jumps over the lazy dog.](http://en.wikipedia.org/wiki/The_quick...
[Question] [ Good Afternoon, Your goal is to, in the least amount of source code bytes, recreate any of Piet Mondrian's 'Composition' paintings (for instance, [Composition #10](https://i.stack.imgur.com/MnYZx.jpg)). The recreation can either use the actual colors, or replace it with the appropriate colours from the...
[Question] [ Your job is to write a program that takes a number N as input and outputs all 2-by-N mazes that are solvable. Output format can be in the form of any two distinct values representing wall and empty - I use `x` and `.` here but you can use anything. You can have a matrix, array, string, ascii art, whate...
[Question] [ 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 a...
[Question] [ **Let's count...** Count up to 2 and back to 1 Count up to 4 and back to 1 Count up to 6 and back to 1 ... ok you got it... put all these together and you'll get the following sequence ``` {1,2,1,2,3,4,3,2,1,2,3,4,5,6,5,4,3,2,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,2,3...} ``` **Challenge** Given an i...
[Question] [ # The Art of Word Shaping Given a binary matrix and a string of letters, replace all 1's in the matrix, moving from top to bottom and from left to right within each row, with the letters of the string. Once the letters have been formed into the shape of the matrix, print the matrix, replacing 0's with ...
[Question] [ Create a program, that outputs a hello world string ("Hello world", "Hello, World" etc.), and source code. Output is written to stdout or equivalent. Hello world string is embedded in the source code. For example, the output for might be ``` (some source code here)hello world(some source code here) ```...
[Question] [ Your task, if you choose to accept it, is to write a program/function that accepts an integer \$N\$ as input. The program/function should output/return a list of the first \$N\$ prime numbers. But here's the catch: you are not allowed to use *prime characters* in your code. A prime character is a chara...
[Question] [ Given an input integer `n >= 10`, output the average of all deduplicated rotations of the integer. For example, for input `123`, the rotations are `123` (no rotation), `231` (one rotation) and `312` (two rotations). The average of those is `(123 + 231 + 312) / 3` or `222`. As another example, take `492...
[Question] [ In [The Settlers of Catan](https://en.wikipedia.org/wiki/Catan) board game, there are five resource types: Brick, Log, Ore, Wheat, and Sheep. Building a settlement costs a Brick, a Log, a Wheat, and a Sheep. However, you can also trade in four identical resources to get a resource of a different type. ...
[Question] [ # Objective Write a program or function that checks if a variable name is valid and output 1 or `True` if it is valid, 0.5 if it is valid but starts with an underscore (\_), and 0 or `False` if it is not valid. # Rules * A variable name in most languages is valid if it begins with an underscore or lett...
[Question] [ You are given the RGB values of a color. Your task is simple: to calculate the hue, in the simplest definition. Say the channels with highest, middle and lowest value are X, Y, Z (which are either red, green or blue) and their values are x, y, z. The hue of this color is (h(X)-h(Y))\*(1 + (x-y)/(x-z))/...
[Question] [ This is supposed to be a code golf challenge on the simpler end of the spectrum. But I figured it could be nice to bring out some micro-optimisation here. There are [three basic types of DVI connectors](http://en.wikipedia.org/wiki/Digital_Visual_Interface): DVI-A (analog), DVI-D (digital) and DVI-I (i...
[Question] [ ><>, or Fish, is a two-dimensional esoteric programming language where the instruction pointer (IP) toroidally moves around the codebox, wrapping when it hits an edge. ><> has four basic movement instructions - `<`, `>`, `^`, and `v`, which respectively mean to change the IP's direction to left, right,...
[Question] [ The [Cantor function](https://en.wikipedia.org/wiki/Cantor_function) is continuous everywhere and constant [almost everywhere](https://en.wikipedia.org/wiki/Almost_everywhere), but has an average slope of 1: [![fncantor](https://i.stack.imgur.com/cauCV.png)](https://i.stack.imgur.com/cauCV.png) The fun...
[Question] [ ## Challenge Given an image of the sky, you must output the cloud cover in oktas. The image supplied will be an image file (the type is up to you) and the output should be to STDOUT. ## Oktas In meteorology, an okta is a unit of measurement used to describe the amount of cloud cover at any given locati...
[Question] [ The goal of this challenge is to take a positive integer `n` and output (in lexicographic order) all sequences \$S = [a\_1, a\_2, ..., a\_t]\$ of distinct positive integers such that \$\max(S) = n\$. For example, for an input `n = 3` your program should output the following eleven sequences in the foll...
[Question] [ Write a program or function that takes in the following input in a reasonable format of your choice: * Two positive integers W and H that define the width and height of the image you'll be generating. * Two RGB colors C1 and C2 that will be used to color the image. * A list of 3-tuples of the form `(r,...
[Question] [ I'm tired, but I can't seem to fall asleep. Help me count sheep. Given an input N (positive integer), make N sheep jump over an ascii fence, like the sample below. Only one frame should be displayed at once: ``` o |-| ──|-|── 0 ``` --- ``` o|-| ──|-|── 0 ``` --- ``` o |-| ──|-|── 0 ``` --- ```...
[Question] [ ### Introduction XOR is a digital logic gate that implements an exclusive or. Most of the times, this is shown as `^`. The four possible outcomes in binary: ``` 0 ^ 0 = 0 0 ^ 1 = 1 1 ^ 0 = 1 1 ^ 1 = 0 ``` This can also be seen as addition modulo 2 in binary. In decimal, we need to convert the decimal t...
[Question] [ *Your challenge*: The code must print "Hello, World!" and nothing else. *Your restrictions*: Your program must satisfy these requirements: 1. The program must be a pangram. * It must use every character in printable ASCII, or, if you chose a particularly strange language, characters which are stored a...
[Question] [ Given *N* decanters (0 < *N* < 10) with that can hold *C0* ... *CN-1* liters (0 < *C* < 50) and a goal *G* liters, please determine if it is possible to reach that goal using only the following actions: * Fill a decanter * Empty a decanter * Pour from one decanter to another until the one being poured ...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 7 years ago....
[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/1/edit). Closed 7 years ago. [Improve this question](/posts...
[Question] [ [Related](https://codegolf.stackexchange.com/questions/19450/enlarge-ascii-art) Given a piece of ascii art and a factor to enlarge it by, which will always be an odd number >1, replace each character with the corresponding ascii-art, resized to fit on a grid the size of the input number: | Character | ...
[Question] [ Let's define a sequence of positive integers. We will define the value of the sequence at every even index to be double the previous term. The odd indices of the sequence will be smallest positive integer not yet appearing in the sequence. Here are the first couple terms. ``` 1,2,3,6,4,8,5,10,7,14,9,18...