text
stringlengths
180
608k
[Question] [ I was looking around on the web and I found this Google Code Jam Puzzle. I really liked it so I decided to post it here. > > ### New Lottery Game > > > The Lottery is changing! The Lottery used to have a machine to > generate a random winning number. But due to cheating problems, the > Lottery h...
[Question] [ This is a simple one: create the shortest browser script to change every appearance of force on a web page into horse. This script needs to be able to be pasted into the console and work on most modern browsers. You must replace **all** occurences of the word force and conjugates of the word force (f...
[Question] [ Objective: * Write one program that outputs sourcecode for another program that outputs words. General information: * Any programming language. Rules: 1. Your programs should not take any input. (from user, filename, network or anything). 2. The generated program sourcecode must not be in the same pr...
[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/2223/edit). Closed 1 year ago. [Improve this question](/posts/2223/edit) *...
[Question] [ Write the shortest code to find the remainder when an input number N is divided by 2^M. You cannot use /,\* and % operator. ``` Input Specification Number of test cases followed by a pair of integers on each line. Sample Input 1 150 6 Sample Output 22 Limits 1<T<1000 1<N<2^31 1<B<31 Time Limit 1 Sec ...
[Question] [ [Emmet](https://emmet.io/) is a text-editor and IDE plugin for writing HTML code using much fewer keypresses. You might think of it like a code-golfing HTML preprocessor. Its syntax is based on CSS selectors. Your challenge is to [code-golf](/questions/tagged/code-golf "show questions tagged 'code-go...
[Question] [ # Special String We call a binary string \$S\$ of length \$N\$ special if : * substring \$S[0:i+1]\$ is lexicographically strictly smaller than substring \$S[i+1:N]\$ for \$ 0\leq i\leq N-2\$, > > Note: \$ S[a:b] \$ is substring \$S[a]S[a+1]...S[b-1]\$ > > > Given a binary string \$T\$ of length ...
[Question] [ ## Challenge: Given an integer \$n\$, guaranteed to be \$\geq2\$ and [a power of 2](https://oeis.org/A000079), we are going to draw multiply boards either side-by-side or below one another, where the first has dimensions of \$n\$ by \$n\$; the second \$\frac{n}{2}\$ by \$\frac{n}{2}\$; the third \$\f...
[Question] [ When you export data in JSON from Facebook, the multi-byte Unicode characters are broken. Example Unicode characters and their representation inside JSON: ``` '\u00c2\u00b0' : '°', '\u00c3\u0081' : 'Á', '\u00c3\u00a1' : 'á', '\u00c3\u0089' : 'É', '\u00c3\u00a9' : 'é', '\u00c3\u00ad' : 'í', '\u00c3\u0...
[Question] [ ## Challenge 1. Choose any number of languages. Call this set `L`. 2. Write a program so that running it in any language in L produces an interpreter for a **different** language in `L`. Each language in `L` must have **exactly one** interpreter for it. This is to prevent, for example, [Nothing](http...
[Question] [ # Introduction `git diff` is a great way to export patches of the source code, and its outputs are colorized if you don't pass extra arguments to it. However, when you want to review the exported file with colored output, it would be pretty hard. [colordiff](https://stackoverflow.com/a/8800636/138547...
[Question] [ We've all seen the pictures captioned "How many squares are in this image? 98% will not get this right!" Well, here's your chance to laugh at that 98%. ## Input A rectangular block made of only 2 characters. In a general form, this is defined by *m* lines, each containing *n* characters. Example: ```...
[Question] [ [Robbers post](https://codegolf.stackexchange.com/q/152242/66833) A ***[riffle shuffle](https://en.wikipedia.org/wiki/Shuffling#Riffle)*** is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to rif...
[Question] [ The goal is to get all combinations of hold'em starting hands (every two card combination) in the shortest amount of code. A hold'em hand is two distinct cards dealt from a standard deck of **52** cards, with deal-order being irrelevant, as such there are `52*51/2 = 1326`, hands. There is also a comm...
[Question] [ # Problem Given input `a` where a is a grid of characters in any input format as long as it has only one element for each 'block' of the output. And input `b` where b is a grid of numbers the same size as input `a`. There are two types of road, a 1 represents a stone road marked by `@` and a 2 repres...
[Question] [ # Introduction Inspired by [Dyalog Ltd.](http://www.dyalog.com/)'s 2016 student competition. [The challenge there](http://www.dyalog.com/student-competition.htm) is to write *good* APL code, but this is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") and it is open to a...
[Question] [ ***My PPCG holiday is over :D*** ## Intro Fractional time is `the year + (the value (minute of year) / number of minutes in the year)`. ## Example calculation *You should assume that February always has 28 days and the year is always 365 days long.* Let's say we want to convert the time: `17:34 3rd M...
[Question] [ Fred is a quasi-friendly guy, but in reality he is mean. Because of this, Fred lives alone in a small apartment in Los Altos, CA. Fred is so mean because he is very particular about water. He, therefore, needs your help with figuring out what his water bill is. Your job is to write a function or pro...
[Question] [ There have been some tax rate calculator problems here that depend on defined rates (specifically US federal rates), but none that have done it for arbitrary lists. Your task is to build a program or function that will take an arbitrary list of [marginal tax brackets](https://en.wikipedia.org/wiki/Ta...
[Question] [ A common optimization to save space in binaries is to merge string literals where one literal is the suffix of another. For instance, a binary with the string literals ``` a: foobar b: bar c: barbaz d: foobarbaz e: baz ``` might contain the following string literal pool (`#` representing the `\0`-ter...
[Question] [ Here is a list of [1000 basic English words](http://pastebin.com/wh6yxrqp). Yes, I'm aware that there are only 997 words in the list! It was taken from [Wiktionary](http://en.wiktionary.org/wiki/Appendix:1000_basic_English_words) so blame them! Your task is to write a program that accepts a word and ...
[Question] [ # The Specs * Your program must read the image from one file and write the results to another file, the name of at least the first of which should be taken from the input * You may accept and return any image format or formats, as long as you specify in your answers which ones you are using * An exce...
[Question] [ Because I can't concentrate on any task for more than about 5 seconds, I often find myself breaking up words into a sub-strings, each of which is a different length and doesn't contain any repeated characters. For example, the word "pasta" might be broken up in "past" & "a", "pas" & "ta", or "pa" & "...
[Question] [ ### Objective Find the most expensive path from the top-left of a square grid to the bottom-right such that its total cost is below a given threshold. ### Scenario 1. You are given a square `NxN` grid. 2. You are given a maximum cost. 3. Every cell in the grid has a cost. The top-left cell has cost `...
[Question] [ Your task is to write a program that finds the largest radius that *N* circles can have and still fit inside of a rectangle that is X by Y pixels large. (similar to [this wikipedia article](http://en.wikipedia.org/wiki/Circle_packing_in_a_square)) Your program must find the largest possible radius an...
[Question] [ Given a list of 2d (x, y) coordinates, determine how many unit squares (edge length 1 unit) can be formed using the coordinates. * Input will be an array of 0 or more pairs of coordinates: e.g. in JavaScript: `numofsq([[0,0], [1,0], [1,1], [0,1]])` * No duplicate coordinates in input * Input order...
[Question] [ Good Afternoon Golfgeneers. This is reasonably long and detailed question. Given what it was asking, it needed to be. If you have any questions, please ask them. If there is anything that isn't clear, please alert me to it so I can fix it. This is probably on the tougher side of codegolf. We are buil...
[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/10709/edit). Closed 2 years ago. [Improve this question](/posts/10709/edit)...
[Question] [ In the UTF-8 encoding bytes of the Form `10******` can only appear within multi-byte sequences, with the length of the sequence already being determined by the first byte. When UTF-8 text is split within a multi-byte UTF-8 character sequence, this prevents that the second part of the sequence is wron...
[Question] [ In graph theory a tree is just any graph with no cycles. But in computer science we often use *rooted* trees. Rooted trees are like trees except they have one specific node as the "root", and all computation is done from the root. The *depth* of a rooted tree is the smallest number, \$n\$, such that ...
[Question] [ ## Background **Stick Bomber** is a two-player game I just made up. Initially, some sticks are placed in one or more groups, and the sticks in each group are laid out in a straight line. So a configuration with three groups of 3, 5, and 8 sticks each may look like the following. For conciseness, we c...
[Question] [ ## Introduction Let's draw some regular hexagons formed by hexagonal tiles, marking the vertices of the tiles with dots. Then we will count the number of dots. ``` size 1: 6 dots . . . . . . size 2: 24 dots . . . . . . . . . . . . . . . . . . . . . . . . size 3: 54 dots ...
[Question] [ Deserializing binary trees depth-first is pretty easy, but doing it breadth-first is (hopefully) harder. Your mission, should you choose to accept it, is to do the latter. The input will be a 1-D list of positive integers representing node values and some other consistent value representing the absen...
[Question] [ [Dart](https://www.dartlang.org/) is an object oriented programming language borrowing from both Java and Javascript. What general tips do you have for golfing in Dart? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Dart (e.g. "remove...
[Question] [ # The Game You will be playing an (almost) standard game of [Connect-4](https://en.wikipedia.org/wiki/Connect_Four). Unfortunately, it is a correspondence game and someone has placed black tape on every second row starting from the bottom, so that you cannot see any of your opponent's moves within th...
[Question] [ An office (let's call it "The Office") is going to cut down on wasted time in 2019 by consolidating office birthday parties. Any two people with a birthday between Monday and Friday (inclusive) of the same week will be celebrated with a *Shared Birthday Party* some time that week. People whose birthd...
[Question] [ A certain well-known cable company has a somewhat clumsy 'Search for Program' feature that works through the remote. It takes muchly much button pushing; so, being an admirer of economy of motion, I thought I'd seek out a programmer's help to minimize the number of finger movements I have to make. Th...
[Question] [ **This is Hole-9 from [*The Autumn Tournament* of APL CodeGolf](https://apl.codegolf.co.uk/problems#9). I am the original author of the problem there, and thus allowed to re-post it here.** --- Given a simple (rectangular, non-jagged) Boolean array (of one or more dimensions) return a list of thusly ...
[Question] [ Based on [How high can you count?](https://codegolf.stackexchange.com/questions/124362/how-high-can-you-count) let us give an advantage to the polyglot people. ## Challenge: Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer....
[Question] [ Alice, Bob, Carol, Dave, and Eve are going out for a nice game of golf and need your help to decide in what order they will play. Your program will input some statements, which are defined as a condition, and then one or more optional logical boolean operators followed by another condition. (That's `...
[Question] [ Consider the 74 characters from the [2016 time capsule string](https://codegolf.stackexchange.com/questions/105398/2016-time-capsule-string-how-versatile-is-your-language) (note the leading space): ``` !!!!!#$$%&())))*+...1449:=@@@AHILOQQQTTZ\\^`````````eefmpxy{||||~~~~~~~~~ ``` Your task is to writ...
[Question] [ Write [a program or function](http://meta.codegolf.stackexchange.com/q/2419/8478) that [takes as input](http://meta.codegolf.stackexchange.com/q/2447/8478) three positive integers `x`, `y`, and `a` and [returns or outputs](http://meta.codegolf.stackexchange.com/q/2447/8478) the maximum number of whol...
[Question] [ # The Task Given the positive value of [unix timestamp](https://en.wikipedia.org/wiki/Unix_time) output any of two valid [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time formats: * `YYYY-MM-DDTHH:mm:SS` or, alternatively, * `YYYY-MM-DD HH:mm:SS` You may ignore any [leap seconds](https://en.wik...
[Question] [ ### Introduction When a room has bare, parallel walls, it can create unpleasant repeating acoustic reflections (echoes). A diffuser is a device mounted on a wall which creates a blocky surface of many different heights. This has the effect of breaking up the reflected sound into many smaller reflecti...
[Question] [ This is "programming" at its most fundamental. Build a diagram of (two-wire) NAND logic gates that will take the input wires `A1`, `A2`, `A4`, `A8`, `B1`, `B2`, `B4`, `B8`, representing two binary numbers `A` to `B` from 0 to 15, and return values on the output wires `C1`, `C2`, `C4`, and `C8` repres...
[Question] [ For a given `n` list [prime factorization](https://en.wikipedia.org/wiki/Prime_factorization) of all natural numbers between `1` and `n` in ascending order. For example, for `n` = 10 the output would be: ``` 1: 2: 2^1 3: 3^1 4: 2^2 5: 5^1 6: 2^1 3^1 7: 7^1 8: 2^3 9: 3^2 10: 2^1 5^1 ``` **Requirements...
[Question] [ The following problem is taken from the real world — but indubitably `code-golf`! In this puzzle, the programming language is fixed, and your job is to write the most efficient program in this fixed language. The language has no loops; a program is a straight-line sequence of instructions. Each instr...
[Question] [ ## Background So, nowadays the popular Prisoner's Dilemma variant is the Prisoner's Trilemma, where there are three options. I can easily see that being increased, so I figured > > Why settle for *three* options, when we can have ***INFINITE*** options? > > > Therefore, I created the Floating Poi...
[Question] [ ### Background In [JIS X 0208](https://en.wikipedia.org/wiki/JIS_X_0208) a 94 by 94 map (kuten (区点)) is defined to encode Chinese characters (kanji), phonetic moras (kana) and other symbols. Along with this standard there are 3 different encodings that maintain 1-1 correspondences with the map, namel...
[Question] [ What general tips do you have for golfing in [Smalltalk](http://smalltalk.gnu.org/)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to [Smalltalk](http://smalltalk.org/) (e.g. "remove comments" is not an answer). > > Smalltalk is a pur...
[Question] [ This is my first attempt at a Code Golf question. If it needs obvious edits, please feel free to make them. Below is a description of the basic Dropsort algorithm. > > [Dropsort](http://www.dangermouse.net/esoteric/dropsort.html) is run on a list of numbers by examining the numbers in sequence, begi...
[Question] [ There are 9 main types of numbers, if you categorise them by the properties of their factors. Many numbers fall into at least one of these categories, but a few don't. The categories are as follows: * Prime - no integer divisors other than itself and one * Primitive abundant - A number \$n\$ whose fa...
[Question] [ ## Context Consider square matrices with `n` columns and rows containing the first `n^2` (i.e. `n` squared) positive integers, where `n` is odd. The elements of the matrices are arranged such that the integers `1` through `n^2` are placed sequentially in a counterclockwise spiral starting at the cent...
[Question] [ [Cops post](https://codegolf.stackexchange.com/q/152241/66833) A ***[riffle shuffle](https://en.wikipedia.org/wiki/Shuffling#Riffle)*** is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle...
[Question] [ ## Explanation In this task you'll be given a set of *N* points *(x1,y1),…,(xN,yN)* with distinct *xi* values and your task is to interpolate a polynomial through these points. If you know what Lagrange interpolation is you can skip this section. The goal of a [polynomial interpolation](https://en.wi...
[Question] [ > > Thanks to [FryAmTheEggman](https://codegolf.stackexchange.com/users/31625/fryamtheeggman) for the idea for this second version. > > Version 1 [here](https://codegolf.stackexchange.com/q/131715/70347). > > > Not-so-simple challenge: given a number of cards, build the biggest house of cards...
[Question] [ ## Challenge Make the shortest program to determine if the figures in the input will fit into the space in the input. ## Requirements The input will be in the format of this example: Input: ``` +----+ -- +--+ | +----+ | | | | +--+ | | +---------+ ``` Output: ``` +----+ ...
[Question] [ # Task Given a Boolean matrix, find one (or optionally more) subset(s) of rows which have exactly one True in each column. **You may use any algorithm**, but must support very large matrices, like the last example. # One possible algorithm ([Knuth's Algorithm X](https://en.wikipedia.org/wiki/Knuth%27...
[Question] [ [The Collatz conjecture](http://en.wikipedia.org/wiki/Collatz_conjecture) is a very well-known conjecture. Take a positive integer; if it's even, divide by 2, else, multiply by 3 and add 1. Repeat until you reach `1` or something else happens. The conjecture is that this process always reaches `1`. Y...
[Question] [ Given an input `n`, output the value of the [Fransén-Robinson constant](https://oeis.org/A058655) with `n` digits after the decimal place, with rounding. # Rules * You may assume that all inputs are integers between 1 and 60. * You may not store any related values - the constant must be calculated, ...
[Question] [ Given an input of a string with bytes that may be in either binary, octal, or hex, output the string's ASCII equivalent. Input will be provided in the following format, for example: ``` 501200100001147 ``` which represents ``` 0x50 0o120 0b01000011 0x47 ``` which is equivalent (in ASCII) to ``` PPCG ...
[Question] [ This challenge is based on the idea of [Plouffle's Inverter](https://oeis.org/wiki/Plouffe's_Inverter). Write a program in any language that does the following: * Takes as input a non-negative rational number `X` written in decimal, for example 34.147425. * Returns a mathematical expression using onl...
[Question] [ Given a deck consisting of **N** copies of cards with integer values [**1**,**M**] for a total of **N\*M** cards, compute the probability that a card with the value of **1** is adjacent to a card with the value of **2**. Your solution may be exact or approximated, and it does not need to be the same ...
[Question] [ # Introduction In this challenge, your task is to implement a collection of simple functions that together form a usable mini-library for simple probability distributions. To accommodate some of the more esoteric languages people like to use here, the following implementations are acceptable: 1. A co...
[Question] [ Did you know that [the Euclidean algorithm is capable of generating traditional musical rhythms](http://cgm.cs.mcgill.ca/~godfried/publications/banff.pdf)? We'll see how this works by describing a similar, but slightly different algorithm to that in the paper. Pick a positive integer `n`, the total n...
[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 6 years ago. [Improve this que...
[Question] [ ## Introduction You are the police chief of the NYPD and you have been tasked to position police officers so that all of the streets are patrolled. Your squad is short-staffed, however, meaning that you need to position as little officers as possible. ## Challenge Given a map of blocks, you must retu...
[Question] [ I'm solving task, where: ## Input: A number as an integer. ## Output: The closest greater palindromic prime as an integer. I would appreciate *hints* how to make my solution shorter. Or directions if change of approach would be beneficial. ``` golf=lambda l,r=range:next(x for x in r(10**6)if(x==int(`...
[Question] [ The goal is to read bytes from input encoded in [Code Page 437](http://en.wikipedia.org/wiki/Code_page_437) and output the same characters encoded as UTF-8. That is, bytes should be translated into Unicode codepoints per [this table](http://en.wikipedia.org/w/index.php?title=Code_page_437&oldid=56544...
[Question] [ I just submitted an answer to [this question](https://codegolf.stackexchange.com/q/4665/3862), and then looked about at some news stories about the MegaMillions lottery craze going on right now in the US. [This news article](http://www.washingtonpost.com/national/record-mega-millions-jackpot-had-gamb...
[Question] [ [This problem](http://hs10.spoj.pl/problems/HS10RECT/) (see below) has been given as a High School Programming League code golf challenge. The shortest codes submitted during the contest were: 177 bytes in Ruby, 212 bytes in Python 2.5, 265 bytes in C. Can anyone make it shorter? Other programming la...
[Question] [ Validate a proposed crossword grid. Entries should be full programs that simply test a proposed grid to determine if it meets a set of conditions for making crossword solvers happy. ## Input The input will be the name of a file representing the crossword grid. The input filename may be passed as an a...
[Question] [ `(l, r)` defines a line whose left end is at `l` and the right end is at `r`, on a 1-dimensional space. Given 2 lines `b = (0, bz)` and `f = (i, i + fz)`, `v = (l, r)` is the overlapping part of these lines. When `b` and `f` do not overlap (when `v` cannot have a positive length), `v = (0, 0)`. ``` (...
[Question] [ So, normally, this is a [forbidden loophole](https://codegolf.meta.stackexchange.com/a/1062/98630) to fetch the desired output from an external source. But this challenge is an exception ! In this challenge you will **have** to fetch data from the internet and output it to the SDTOUT. # The task 1. F...
[Question] [ I'm looking for a program such that, given a finite list of strings, can find short regexes to match exactly all of them and nothing else. Since there are multiple languages that express regexes differently, there can correspondingly be multiple regex generators. Each answer must discuss regex genera...
[Question] [ ## Cleaning the dishes In this task, you will be given a bar of soap with a width of 1 or more units. You will also be given a plate, which you will have to clean, using the soap as few times as you can. The plate will be at least 1 character. You will have to output a plate with the 'clean' characte...
[Question] [ *TL;DR for those not interested: Look at the test cases at the bottom. Have a program/function that outputs the 2D list displayed for the given input.* ## Introduction: [On November 15th, 2018 puzzle designer Raphaël Mouflin revealed his Triangularity puzzle.](http://twistypuzzles.com/forum/viewtopic...
[Question] [ Write a program which can encode text to avoid reusing characters, and convert back. Both normal and encoded forms are restricted to a particular character set: the space character with code point 32, the tilde character `~` with code point 126, and all characters between. This is 95 total character...
[Question] [ This is a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge based around defining languages and proving they are Turing complete. This is the robbers' thread. [The cops' thread is here](https://codegolf.stackexchange.com/questions/162290/escap...
[Question] [ My job is stacking pebbles into triangular piles. I've only been doing this for a century and it is already pretty boring. The worst part is that I label every pile. I know how to decompose pebbles into [piles of maximal size](https://codegolf.stackexchange.com/questions/118361/decompose-a-number-int...
[Question] [ I need to call my friends but the buttons of my cordless phone are not working properly. The only buttons I can press are [Up], [Down] and [Call]. [Up] and [Down] can be used to navigate in my recent calls and [Call] can be used to call the selected name. My phone has a list that holds `N` recent cal...
[Question] [ You must make a regex that matches everything except itself. For example, `PPCG` must not match `PPCG`, but must match everything else, like `something`, `PPC`, and `PPCG!`. Surrounding slashes are **not** considered part of the regex in flavors where they are usually part of the syntax. The same is ...
[Question] [ Lets play golf while we golf. # Problem: * Distance to the hole initially is 700m * Each hit to the ball will make it advance to the hole 250-350m, this should be random. * Each hit has a 5% probabilities of going into water, this will make the quantity of hits increase by 1 as a penalty. * When ball...
[Question] [ **TL;DR**: Solve this particular challenge, a robot simulation, by stepping on all of the white pads, and avoiding the gray pads. You can step on a white pad any number of times, as long as you step on each white pad at least once. Solutions in languages like Befunge with a 2D instruction pointer wou...
[Question] [ # The Challenge In this challenge, you are supposed to write a program or function that takes in a String, which will contain the simplified Markdown-like Markup, and outputs the corresponding HTML Markup. --- # The Input You can take input in whatever way you wish to. The `type` of the input should ...
[Question] [ Your goal is to write a full program or function that takes 5 positive integers and a string with an image filename as input `[X1,Y1], [X2,Y2], N, image.jpg` in any reasonable format, where: * First couple `[X1,Y1]` are the top left `X`,`Y` coordinates (`<=20`) of the blue rectangle area in the examp...
[Question] [ Your program has to take a multi-lined string, like this: ``` ############# # # # p # # # ############# ``` `p` is the player and `#` is a block. Now under that in the terminal should be an input line saying: ``` How do you want to move? ``` If the player types `l` he ha...
[Question] [ What general tips do you have for golfing in [Emotinomicon](//conorobrien-foxx.github.io/Emotinomicon/int.html)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Emotinomicon (e.g. "remove comments" is not an answer). Please post one ti...
[Question] [ In this optimization challenge you will write a program that sorts a single array by only comparing elements through asking the user on stdout to input comparison results on stdin. *The below protocol is line-based, so everytime you print to stdout or read from stdin it is assumed a newline follows. ...
[Question] [ **This question already has answers here**: [Highly composite numbers](/questions/74487/highly-composite-numbers) (11 answers) Closed 7 years ago. Consider the following table for the function `d(n)`, which calculates the number of factors that `n` is divisible by without a remainder: ``` n ...
[Question] [ # The Challenge Implement **amb** and its sister statement **require** in whatever language you wish. See <http://community.schemewiki.org/?amb> for an example implementation in Scheme. You can rename them to **a** and **r**. **amb** statements select a value passed to it arbitrarily, and **require**...
[Question] [ Given two **arbitrarily** precise *decimal* numbers 0 ≤ *x* < *y* ≤ 1, compute the shortest (in digits) *binary* number *b* such that *x* ≤ *b* < *y*. Output the binary digits of *b* after the [binary point](https://en.wikipedia.org/wiki/Radix_point) as an array or a string of zeroes and ones. Note t...
[Question] [ # Challenge Given a natural number, output it in the ASCII form of Agrippa's number system. # Description I like odd alphabets and numeral systems. My favorite numeral system is one given by [Heinrich Cornelius Agrippa](http://www.esotericarchives.com/agrippa/agripp2b.htm). It gives a succinct way to...
[Question] [ The Champernowne Constant is the irrational number 0.1234567891011... extending ad infinum. We've done a [question](https://codegolf.stackexchange.com/q/66878/31625) about it before. But this question is about its reciprocal, known as the Inverse Champernowne Constant. This is approximately 8.100000...
[Question] [ ### Introduction Everyone should know IPv6 by now. IPv6 has very long, cumbersome addresses. In 1996 some very intelligent people created a scheme to encode them much better in [RFC 1924](https://www.rfc-editor.org/rfc/rfc1924). For reasons I cannot understand, this hasn't been widely adopted. To hel...
[Question] [ # Introduction Hex is a strategy board game played on a hexagonal grid, theoretically of any size and several possible shapes, but traditionally as an 11×11 rhombus. Other popular dimensions are 13×13 and 19×19 as a result of the game's relationship to the older game of Go. According to the book A Be...
[Question] [ One of the key parts of PNG's compression algorithm is the *Paeth transformation,* which transforms the image in a way that makes it compress better (usually). In this challenge, your task is to write a program to compute a Paeth transformation. The operation of a Paeth transformation is described be...
[Question] [ The Hilbert curves are a class of space-filling fractal curves where every bend in the path is at a right angle and the curve as a whole fills up a square, with the property that sequences of consecutive segments are always displayed as contiguous blocks. Traditionally, the curve is drawn as a series...
[Question] [ This challenge is based on some new findings related to the [Collatz conjecture](http://en.wikipedia.org/wiki/Collatz_conjecture) and designed somewhat in the spirit of a collaborative [polymath project](http://michaelnielsen.org/polymath1/index.php?title=Main_Page). Solving the full conjecture is re...
[Question] [ Create the shortest function to print a [magic square](http://en.wikipedia.org/wiki/Magic_square) of given size. A magic square is a NxN matrix of distinct numbers and the sum of each row, column and diagonal is equal to a constant. A magic square of size 4 is: ``` 07 12 01 14 02 13 08 11 16 03 10 05...