text stringlengths 180 608k |
|---|
[Question]
[
In any programming or scripting language *x*, write a program that takes a valid brainfuck sourcecode from stdin and output, to stdout, the sourcecode of a program, written in language *x*, that would output the exact same thing as the brainfuck program would do.
Your program must work for any valid b... |
[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]
[
The [Matoran Alphabet](https://bionicle.fandom.com/wiki/Matoran_Alphabet) is the alphabet used by many of the characters in the Bionicle universe.

Your challenge is to create a program or function that takes a string as input and creates an image... |
[Question]
[
Given some positive integer \$n\$ generate all derangements of \$n\$ objects.
### Details
* A derangement is a permutation with no fixed point. (This means in every derangement number \$i\$ cannot be in the \$i\$-th entry).
* The output should consist of derangements of the numbers \$(1,2,\ldots,n)\$ (... |
[Question]
[
Determine the length of a UTF-8 byte sequence given its first byte. The following table shows which ranges map to each possible length:
```
Range Length
--------- ------
0x00-0x7F 1
0xC2-0xDF 2
0xE0-0xEF 3
0xF0-0xF4 4
```
Notes on gaps in the table: 0x80-0xBF are continuation bytes, 0... |
[Question]
[
Despite having 17 questions tagged [anagrams](/questions/tagged/anagrams "show questions tagged 'anagrams'"), we still don't have this question, so here it is.
## Your Task
You must write a program or function that, when receiving a string, prints out all possible anagrams of it. For the purposes of th... |
[Question]
[
The [Eulerian number](https://en.wikipedia.org/wiki/Eulerian_number) `A(n, m)` is the number of permutations of `[1, 2, ..., n]` in which exactly `m` elements are greater than the previous element. These are also called *rises*. For example, if `n = 3`, there are 3! = 6 permutations of `[1, 2, 3]`
```
... |
[Question]
[
A man lives in the north-west corner `(0, 0)` of a town with height `h` and width `w` . Everyday he walks from his home to the border `(?, w)` or `(h, ?)`. In the following example, the man goes to `(3, 3)` today.
```
(0, 0) +--+ + + . (0, 4)
|
+ +--+--+ .
... |
[Question]
[
Consider the following triangle.
```
1
23
456
7891
01112
131415
1617181
92021222
324252627
2829303132
33343536373
839404142434
4454647484950
51525354555657
585960616263646
5666768697071727
37475767778798081
```
As you probably noticed, the first row is of length 1, and each row thereafter is 1 digit lo... |
[Question]
[
### Motivation
In [this](https://codegolf.stackexchange.com/questions/133767/element-wise-string-multiplication) challenge your task was to multiply two strings, this naturally introduces a way to take the square root of a string.
### How does it work?
Given a string (for example `pub`) the first thing... |
[Question]
[
Terence Tao [recently proved](http://terrytao.wordpress.com/2012/02/01/every-odd-integer-larger-than-1-is-the-sum-of-at-most-five-primes/) a weak form of Goldbach's conjecture! Let's exploit it!
Given an odd integer `n > 1`, write `n` as a sum of up to 5 primes. Take the input however you like, and giv... |
[Question]
[
While at work I spotted a nice and simple challenge.
The job was to stock products in cargo units with a certain capability.
Since an order can have various batches, coming in sequence from the production, we usually make a list of the pieces of those batches distributed in each cargo to make sure noth... |
[Question]
[
# The challenge:
Given four coordinates, each in x y form, your job is to find out whether or not the given coordinates form a rectangle, and output a truthy/falsey.
## Rules:
* For the sake of simplicity, squares, lines (two identical pairs of coordinates) or dots (all four of the coordinates are the ... |
[Question]
[
[Husk](https://github.com/barbuz/Husk) is a quite new golfing language, created by PPCG users [Leo](https://codegolf.stackexchange.com/users/62393/leo) and [Zgarb](https://codegolf.stackexchange.com/users/32014/zgarb). It has begun being more and more competitive, often staying close or even beating la... |
[Question]
[
# Background
It can be shown that for any integer `k >= 0`, `f(k) = tan(atan(0) + atan(1) + atan(2) + ... + atan(k))` is a rational number.
# Goal
Write a complete program or function which when given `k >= 0`, outputs `f(k)` as a single reduced fraction (the numerator and denominator are coprime).
# T... |
[Question]
[
Sometimes a long absolute path, in e.g. a command-line parameter to a linux tool, can be shortened, using current working directory as reference:
```
$ pwd
/home/heh
$ cat /home/heh/mydir/myfile
my stuff
$ cat mydir/myfile
my stuff
```
In this challenge, you should make a function or a program that rec... |
[Question]
[
## Background
I have a collection of "weekday socks", which are seven pairs of socks labeled by the days of the week.
When I wash my socks, they end up in a pile, and I must arrange them into the correct pairs before putting them into the closet.
My strategy is to pull one random sock from the pile at ... |
[Question]
[
**Task:**
Make a program that leaves a comment on this question. The content should be `1234567890123456`.
**Edits:**
1. You may leave your usernames and passwords as `U` and `P` if you are
using username and password. (if applicable)
2. No URL Shorteners (if applicable)
3. You may not use the browser... |
[Question]
[
This is a fairly simple question. According to [this random website I found — Web Archive](http://web.archive.org/web/20161121045247/http://www.regentsprep.org:80/regents/math/algtrig/ATT3/referenceAngles.htm), a reference angle is `the acute angle formed by the terminal side of the given angle and the... |
[Question]
[
For the purposes of this challenge a *substring* \$B\$ of some string \$A\$ is string such that it can be obtained by removing some number of characters (possibly zero) from the front and back of \$A\$. For example \$face\$ is a substring of \$defaced\$
\$
de\color{red}{face}d
\$
This is also called a ... |
[Question]
[
(No, not [this](https://codegolf.stackexchange.com/questions/70432/mutually-fill-in-the-blanks) nor [any of these](https://codegolf.stackexchange.com/search?q=fill+in+the+blanks))
Given a string and a list of strings, fill in the all blanks in the input string with corresponding strings.
## Input/Outpu... |
[Question]
[
*Inspired by [this](https://stackoverflow.com/questions/38162862/invert-list-of-lists-of-indices/38162896) StackOverflow post.*
# Introduction
Bob's job is to create spreadsheets and organize them. The way he organizes them is known to very few except for Bob, but he creates a list of each of the sprea... |
[Question]
[
Your task is to take an input `n` and output element `n` of the Rummy Sequence, a sequence which I made (looking on OEIS will not help you).
# Definition
Each element of the Rummy Sequence is a set of truthy or falsey values. Ex.: `[true, false]`.
The steps to producing a member of the Rummy Sequence a... |
[Question]
[
## Background
Given an [elementary cellular automaton](https://en.wikipedia.org/wiki/Elementary_cellular_automaton) rule number like, for example, 28 = `00011100`…
[](https://i.stack.imgur.com/Kp6M2.png)
* We can swap \$\color{red}{\text{the... |
[Question]
[
For this challenge, a slice of a string is defined as an upper and lower index that can "cut" a piece of a string. All characters from the string in the range `[start, end)` (or `[start, end]` if you don't speak practlang) are part of that slice. If the upper index exceeds the string's length, the over... |
[Question]
[
Your task is to make a program or function that takes a nonnegative integer (or a different convenient format to represent it) that represents an angle measure in degrees from 0 to 180 (inclusive) as input and outputs every possible time (in hours and minutes; no seconds) on an analog clock where the m... |
[Question]
[
Say I have a pile of boxes:
```
AAA
BBB
```
I can create it in two steps:
```
BBB
↓
(empty)
---
AAA
↓
BBB
```
But with this:
```
AB
BA
```
I need three steps:
```
A
↓
(empty pile)
---
BB
↓
A
---
A
↓
B
BA
```
# Your challenge
Given a pile of boxes, output the minimum number of steps needed to cre... |
[Question]
[
# Goal
Write a program or function that returns the day of the week for a date, eg.
```
01/06/2020 -> Mon
```
However, it's unknown if the date is in the format mm/dd/yyyy or dd/mm/yyyy. If you can be certain of the day of the week, return it. If there is uncertainty, return an error.
```
02/07/2020 ... |
[Question]
[
In 1946 Erdos and Copeland proved that [a certain number](http://en.wikipedia.org/wiki/Copeland%E2%80%93Erd%C5%91s_constant) is a [normal number](http://en.wikipedia.org/wiki/Normal_number), i.e. the digits in its decimal expansion are uniformly distributed.
Users will input a sequence of digits and yo... |
[Question]
[
This challenge is an extension of '[Golf a mutual quine](https://codegolf.stackexchange.com/questions/2582/golf-a-mutual-quine)'.
Using three languages of your choice, create a third order [Ouroboros](http://en.wikipedia.org/wiki/Ouroboros) program.
That is, in language A, write a program pA which outp... |
[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 quest... |
[Question]
[
*inspired by [thejonymyster's idea](https://chat.stackexchange.com/transcript/message/61968948#61968948)*
## Rules
This challenge is about finding languages that are very suitable for one task but quite the opposite in the other. The two tasks share a theme, but Task 1 is designed to be number-oriented... |
[Question]
[
Inspired by the fourth problem from [BMO2 2009](http://bmos.ukmt.org.uk/home/bmo2-2009.pdf).
Given a positive integer *n* as input or a parameter, return the number of positive integers whose binary representations occur as blocks in the binary expansion of *n*.
For example, 13 -> 6 because 13 in binar... |
[Question]
[
Write a non-empty program or function that when called outputs a single value, 1 or 0, and when called
multiple times, the output numbers produce the binary representation of your program's source code
(in the same code page from which your code is compiled/interpreted).
For instance, if your source co... |
[Question]
[
***Note:** This is inspired by [this question by **@Willbeing**](https://codegolf.stackexchange.com/questions/115007/perfect-license-plates) where task was to count the number of perfect plates of a certain length, but it's slightly different.*
---
We call ***a perfect licence plate*** that plate whose... |
[Question]
[
(Meaning: Convert English to Bleet)
We have praised goats as god for years now.
But if we can't translate English to 'Bleet', the Goat God's language, we cannot communicate with them.
So, to communicate with them, we have researched the activities of goats, and retrieved this pattern, which is the core... |
[Question]
[
A brace string is defined as a string consisting of the characters `*()[]` in which braces match correctly:
```
[brace-string] ::= [unit] || [unit] [brace-string]
[unit] ::= "" || "*" || "(" [brace-string] ")" || "[" [brace-string] "]"
```
This is a valid brace-string:
```
((())***[]**)****[(()... |
[Question]
[
Write a program or a function that outputs the integer number of answers this question has. Your solution should still work as more answers are added.
Languages that run in a browser may be run from the js console while on this page. Otherwise, you'd probably have to download this page. Multi-language ... |
[Question]
[
Given the size of the chess board and initial position of the knight, calculate the probability that after `k` moves the knight will be inside the chess board.
Note:
* The knight makes its all 8 possible moves with equal probability.
* Once the knight is outside the chess board it cannot come back ins... |
[Question]
[
I was told that using the `cmp` function can be [very useful in code-golf](https://codegolf.stackexchange.com/a/49773/31716). But unfortunately, Python 3 doesn't have a `cmp` function.
So what's the shortest equivalent of `cmp` that works in python 3?
[Answer]
Python 3 does not have `cmp`. For gol... |
[Question]
[
## Summary
The task is to navigate the Mars rover and tell its final coordinates and direction.
# Input:
## First input:
First your program must take the input which will be in the following format:
```
[X-Coordinate],[Y-Coordinate],[Direction]
```
The direction must be: `N` or `S` or `E` or `W` (Start... |
[Question]
[
## Fast and Golfiest Cops Thread
Welcome to the first season of **Fast and Golfiest**, a cops-and-robbers challenge! I designed this challenge to encourage competitive coding for efficiency (fastest algorithm) to become more popular on the site.
The rules are simple. The cops must choose a problem from... |
[Question]
[
Today (or tomorrow, depending on your timezone, by the time of posting) is the birthday of the great mathematician and physicist [Leonhard Euler](https://en.wikipedia.org/wiki/Leonhard_Euler). To celebrate his birthday, this challenge is about one of his theorems in geometry.
For a triangle, we define ... |
[Question]
[
The Steenrod algebra is an important algebra that comes up in algebraic topology. The Steenrod algebra is generated by operators called "Steenrod squares," one exists for each positive integer i. There is a basis for the Steenrod algebra consisting of "admissible monomials" in the squaring operations. ... |
[Question]
[
**Task**
Given a letter (A, B, C), and a number (0-10), output the size of the matching standard paper size (Series A and B) or the matching standard envelope size (C series) in millimetres in the format `aaaa x bbbb` where `aaaa` and `bbbb` are the width and height measurements in millimetres as per I... |
[Question]
[
## Input
You are given a 2D map with balls and ground in it.
It looks like this:
```
1 5 2
3
4
__________________________
```
Each number is a ball, and the `_` is ground level. The underscore `_` character is not allowed in any other line than ground level line... |
[Question]
[
Write some code that acts as a cat program. That is, to input a string and output it as is. But the normal reversion of your code must output the normal reversion of the input string. And the visual reversion of your code must output the visual reversion of the input string.
The normal reversion is the... |
[Question]
[
Recently, the [PPCG design](https://github.com/vihanb/PPCG-Design) leaderboard has been having [some trouble](https://github.com/vihanb/PPCG-Design/issues/16) parsing answer **html headers**.
In this challenge you'll be taking your own shot at parsing answer headers.
---
## Example Test Cases
These **... |
[Question]
[
The challenge is to find the shortest implementation of the game of life in 3D ([example](http://gameoflife.samuellevy.com/)). These are the rules:
Cells (in this case, cubes) with only 1 or less neighbours die, as if by lonliness.
If exactly 5 cells surround an empty cell, they breed and fill it.
... |
[Question]
[
[But Is It Art?](https://esolangs.org/wiki/But_Is_It_Art%3F) is an esolang created by [ais523](https://codegolf.stackexchange.com/users/76359/ais523), where one step is break the program into orthogonally connected "tiles":
```
A BBBB
A B B
AA CC
A CC
```
Each separate letter shows a different tile. I... |
[Question]
[
[Conways' Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves according to rules indefinitely. Those rules are:
* Any live ce... |
[Question]
[
# Problem
Let's define a generalized [Cantor set](https://en.wikipedia.org/wiki/Cantor_set) by iteratively deleting some rational length segments from the middle of all intervals that haven't yet been deleted, starting from a single continuous interval.
Given the relative lengths of segments to delete ... |
[Question]
[
Inspired by this [unassuming StackOverflow question](https://stackoverflow.com/questions/48702999/in-java-8-whats-an-elegant-way-to-remove-certain-duplicate-words-from-a-string/).
The idea is simple; given a String and an array of Strings, remove any instances of words in the array (ignoring case) from... |
[Question]
[
You are to write a sequence of 10 programs `p1 p2 ... p10` that satisfy the following properties:
* `pK` prints `pK+1` for `K` from 1 to 9
* `p10` prints `p10`
* When the first `K` programs are concatenated, the resulting program `p1...pK` prints `p1...pK`.
* Each program `pK` must be larger in byte si... |
[Question]
[
## Executive summary
Given input `k`, find a partition of integers `1` to `n` into `k` sum-free subsets for the largest `n` you can within 10 minutes.
## Background: Schur numbers
A set `A` is *sum-free* if its self-sum `A + A = { x + y | x, y in A}` has no elements in common with it.
For every positiv... |
[Question]
[
**Challenge**
Given a number of seconds past midnight, output the smallest angle between any two hands on a clock face, using as few bytes as possible.
You may assume that the number of seconds is always less than 86400.
Angles may be represented in degrees or radians.
A reference solution is at: <http... |
[Question]
[
You should write a program or function which receives a list of distinct integers as input and outputs or returns the number of occurrences of the input numbers in the following upside-down number pyramid.
Starting from the original list in every step we create a new one with the maximal values of ever... |
[Question]
[
## The Task
* You are given a mutable string that matches `[a-z]+( [a-z]+)*`.
* You must mutate it into the string which contains the same words, but in reverse order, so that "hello there everyone" becomes "everyone there hello".
* You are not permitted to use more than a constant amount of additional... |
[Question]
[
The parentheses on my keyboard are all worn out, and I want to avoid using them as much as possible. Your challenge is to balance a line containing parentheses by adding them in before and after each line.
This is similar to TI-Basic's automatic parentheses and string closure (i.e. `Output(1, 1, "Hello... |
[Question]
[
The following is an unfolded milk carton:
```
+-----+-\|/-+-----+-\|/-+-+
| | / \ | | / \ | |
+-----+/---\+-----+/---\+-+
| | | | | |
| | | | | |
| | | | | |
+-----+-----+-----+-----+-+
\ / \ / \ / \ /
\_/ \_/ \_/ \_/
```
T... |
[Question]
[
For a 2 dimensional array we will define the elements in either the first row or the last column to be the largest "J-Bracket" of the array. For example in the following array elements in the J-bracket are highlighted:
\$
\begin{bmatrix}
\color{red}{\underline 1} & \color{red}{\underline 2} & \color{re... |
[Question]
[
[Very related](https://codegolf.stackexchange.com/questions/181708/would-this-string-work-as-string?noredirect=1&lq=1)
You're given a piece of ASCII art representing a piece of land, like so:
```
/‚Äæ\
__/ ‚Äæ\_
\_/‚Äæ\
\
```
Since an overline (`‚Äæ`) is not ASCII, you can u... |
[Question]
[
Swap encoding is an encoding method where you iterate through a string, reversing sections of it between pairs of identical characters.
### The basic algorithm
For each character in the string:
Check: Does the string contain the character again, after the instance you found?
If so, then modify the stri... |
[Question]
[
!!!Batch is another derivative of the Windows Batch programming language, its wiki is [here](https://esolangs.org/wiki/!!!Batch)
Your challenge is to create an compiler/translator that reads a !!!Batch program and returns a Windows Batch program.
In !!!Batch each token braced in two question marks like... |
[Question]
[
### Introduction
A double-castle number™ is a positive integer number that has a pattern of $$\underbrace{a\cdots a}\_{m\text{ }a\text{s}}b\underbrace{a\cdots a}\_{m\text{ }a\text{s}}b\underbrace{a\cdots a}\_{m\text{ }a\text{s}}\underbrace{a\cdots a}\_{n\text{ }a\text{s}}b\underbrace{a\cdots a}\_{n\tex... |
[Question]
[
# Background
The [traveling salesman problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem) (TSP) asks for the shortest circuit that visits a given collection of cities. For the purposes of this question, the cities will be points in the plane and the distances between them will be the usu... |
[Question]
[
## Challenge and origin
On Stack Overflow a popular question is: [How to convert byte size into human readable format in java?](https://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java) The most up voted answer has a quite nice method for doing this, but t... |
[Question]
[
Mission is simple. Just output number 2015 as QR code and write it to file named `newyear.png` in PNG format. Code must be valid any day, so maybe you shall not use current year.
QR code as text looks like this:
```
# # # # # # # # # # # # # # # # # #
# # # # #
# ... |
[Question]
[
You should all be familiar with the [Conway sequence (a.k.a. 'look-and-say'-sequence)](https://en.wikipedia.org/wiki/Look-and-say_sequence) by now:
```
1
11
21
1211
111221
312211
etc
```
You can also start by any arbitrary number as starting point. Let `f(s)` be the next element of the s... |
[Question]
[
# Description
The Caesar cipher is a cipher, where every letter in the alphabet will be rotated by a secret number.
If the rotation is \$7\$, then `a` -> `h`, `g` -> `n`, `v` -> `c` and `z` -> `g`.
Today, we're playing Caesar's Cipher with ASCII chars, (0-127 inclusive).
So, with rotation \$7\$, `b` ... |
[Question]
[
# Challenge
Inspired by [this](https://www.youtube.com/watch?v=HY_OIwideLg) video.
As you may know, a palindrome is a word that is spelled the same forward as it is backward. The word "PULP" is not a palindrome, but when translated into Morse Code (with the spacing between letters removed), "PULP" beco... |
[Question]
[
[You run a political website](https://projects.fivethirtyeight.com/2018-midterm-election-forecast/house/), and have determined that [people have a better intuitive understanding](https://fivethirtyeight.com/features/the-media-has-a-probability-problem/) when the chance of winning or losing an election ... |
[Question]
[
### Background
Based on a game my four-year-old got from his rabbi.
The "goal" is to "find" the letters in a given order, e.g. `aecdb`. You are given a stack of letter cards, e.g. `daceb`. You can only search through the stack in the order given, albeit cyclically. When you meet a letter you need, you ... |
[Question]
[
The Pi function is an extension of the factorial over the reals (or even complex numbers). For integers *n*, *Π(n) = n!*, but to get a definition over the reals we define it using an integral:
[](https://i.stack.im... |
[Question]
[
## Introduction
Consider a sequence of integers \$f\$ defined as follows:
1. \$f(2) = 2\$
2. If \$n\$ is an odd prime, then \$f(n) = \frac{f(n-1) + f(n+1)}2\$
3. If \$n = p\cdot q\$ is composite, then \$f(n) = f(p)\cdot f(q)\$
It's not very hard to see that \$f(n) = n\$ for every \$n \ge 2\$, and thus ... |
[Question]
[
# Bailey–Borwein–Plouffe Iterations
We've seen a few pi challenges on PPCG, but none that specifically dictate the algorithm you should be using. I'd like to see implementations of the [Bailey–Borwein–Plouffe algorithm](https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula) in an... |
[Question]
[
Your task is to write 2 functions/programs. They may share code.
The first function must, given a string and a character, output a new string that does not contain that character.
The second function must, given the string from the previous function and the excluded character, reconstruct the original ... |
[Question]
[
A palindrome is a word which is spelled the same backwards and forwards. For example, "racecar" is a palindrome as is "redder". A double palindrome is a palindrome whose halves are also palindromes. For example, "abbabba" is a double palindrome, as the half "abba" is also a palindrome. Similarily, "aba... |
[Question]
[
Natural numbers ≡ \$\mathbb{N}≡\{0,1,2,...\}\$
The submission can be either a program or a function, both cases will henceforth be referred to as "function".
The task is to golf the shortest function \$\mathbb{N}^n→\mathbb{N}\$, i.e. a function that maps \$n\$ natural numbers (with \$n>0\$ being a numb... |
[Question]
[
I'm a musician, and I need more polyrhythms in my life!
A polyrhythm occurs in music (and in nature) when two events (claps, notes, fireflies flashing etc.) are occurring at two different regular intervals. The two kinds of event happen a different number of times in the same interval.
If I tap with my... |
[Question]
[
When you search something on google, within the results page, the user can see green links, for the first page of results.
In the shortest form possible, in bytes, using any language, display those links to stdout in the form of a list. Here is an example, for the first results of the stack exchange qu... |
[Question]
[
*inspired by [Longest Increasing Substring](https://codegolf.stackexchange.com/q/173586/78410)*
## Task
Given a list of non-negative integers, output the length of its longest alternating subsequence.
An *alternating sequence* is a sequence of numbers which alternates between strictly increasing and st... |
[Question]
[
A perfect number is a positive integer whose sum of divisors (except itself) is equal to itself. E.g. 6 (1 + 2 + 3 = 6) and 28 (1 + 2 + 4 + 7 + 14 = 28) are perfect.
A **sublime number** (OEIS [A081357](http://oeis.org/A081357)) is a positive integer whose count and sum of divisors (including itself) a... |
[Question]
[
## Challenge
Generate the 2D sequence of bits of [A141727](https://oeis.org/A141727). (Allowed I/O methods explained at the bottom.)
```
1
1 0 1
1 0 0 1 0
1 0 1 0 1 0 0
1 0 0 1 1 0 1 1 1
1 0 1 0 0 0 0 0 1 1 0
1 0 0 1 0 ... |
[Question]
[
# Introduction
Given this visualization of a playing field:
```
(0,0)
+----------------------+(map_width, 0)
| A |
|-----+-----------+----|
| D | W | B |
|-----+-----------+----|
| C |
+----------------------+(map_width, map_height)
(0, map_height)
```
T... |
[Question]
[
Specifically, [Conway's PRIMEGAME](https://oeis.org/wiki/Conway's_PRIMEGAME).
This is an algorithm devised by John H. Conway to generate primes using a sequence of 14 rational numbers:
```
A B C D E F G H I J K L M N
17 78 19 23 29 77 95 77 1 11 13 15 15 55
-- ... |
[Question]
[
Sometimes it really is a struggle to convert Cartesian coordinates `(x,y)` to Polar coordinates `(r,phi)`. While you can calculate `r = sqrt(x^2+y^2)` quite easily, you often need some distinction of cases when calculating the angle `phi` because `arcsin`,`arccos` and `arctan` and all other trigonometr... |
[Question]
[
Since I've been seeing more [><>](http://esolangs.org/wiki/Fish) submissions floating around lately, I thought it might be a good idea to have a tips page.
Please stick to one tip per post, unless they are closely related.
[Official Python interpreter](https://gist.github.com/anonymous/6392418)
[Offici... |
[Question]
[
Welcome to the world of compiler golf. Your task is to write a program that generates another program to play a variant of FizzBuzz on spec.
# Your compiler
Write a compiler that generates variants of the FizzBuzz program to spec. The spec of this variant is expressed in the form of an array of integer... |
[Question]
[
## Introduction
Dice 10,000 is a dice game which can be played with 6 dice and something to write. Players roll the dice multiple times a turn and gain a score at the end of it. The player who reaches 10,000 point first wins the game. Calculating the score of one roll is your job in this challenge.
[... |
[Question]
[
In arithmetic, an [n-smooth number](https://en.wikipedia.org/wiki/Smooth_number), where n is a given prime number, is mathematically defined as a positive integer that has no prime factors greater than n. For example, 42 is 7-smooth because all its prime factors are less than or equal to 7, but 44 is n... |
[Question]
[
This is my pet emoji, Billy:
```
-_-
```
Emojis don't like to be in the rain, so Billy is sad... Let's draw him an umbrella to make him feel better!
```
/\
/ \
/ \
-_-
```
This is good, he is entirely covered by his umbrella! Here is an example where only part of him is covered:
```
/\
/ \... |
[Question]
[
In [Gödel, Escher, Bach](http://en.wikipedia.org/wiki/G%C3%B6del,_Escher,_Bach), Douglas Hofstadter introduces an integer sequence which is commonly referred to as the figure-figure sequence:
```
2, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, ...
```
You may enjoy working out... |
[Question]
[
## Background
A [one-time pad](http://en.wikipedia.org/wiki/One-time_pad) is a form of encryption that has been proven impossible to crack if used properly.
Encryption is performed by taking a plaintext (comprised of only letters A-Z) and generating a random string on the same length (also only letters... |
[Question]
[
Given the following input to the program:
1. List of block start characters
2. List of block end characters
3. A string to format
format the string with the blocks delimited by the two character sets indented.
Formatting is done with two spaces per level and the parentheses are placed as shown in the e... |
[Question]
[
Let's define a function \$f\$ which, given a positive integer \$x\$, returns the sum of:
* \$x\$
* the smallest digit in the decimal representation of \$x\$
* the highest digit in the decimal representation of \$x\$ (which may be the same as the smallest one)
For instance:
* \$f(1)=1+1+1=3\$
* \$f(135)... |
[Question]
[
Write a program or function that fulfills the following
* Scores less than 101 bytes under normal [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules
* Takes no input1 and always outputs a single integer.
* Every integer is a possible output.
Your score will be the probab... |
[Question]
[
\$GF(9)\$ or \$GF(3^2)\$ is the smallest [finite field](https://en.wikipedia.org/wiki/Finite_field) whose order isn't a prime or a power of two. Finite fields of prime order aren't particurlarly interesting and there are already challenges for \$GF(2^8)\$ ([link](https://codegolf.stackexchange.com/ques... |
[Question]
[
You are to create a program which, when given a positive integer \$n\$, outputs a second program. This second program, when run, must take a second positive integer \$x\$ and output one of two distinct values depending on whether \$x\$ is divisible by \$n\$. Those values must be consistent for a given ... |
[Question]
[
Given a list of jobs, which must be done in order, with each taking a slot to do, how long will it take to perform them all if after doing a job the same job cannot be done for the next two slots (cooling off slots)? However, a different job can be assigned in this cooling off slots.
**For example,**
`... |
Subsets and Splits
Python Q&A Count
Counts the number of questions and answers related to Python in the dataset, providing insight into the prevalence of Python content.