text stringlengths 180 608k |
|---|
[Question]
[
Write a program with length n that outputs another program whose length is the next Fibonacci number after n. The new program must do the same thing - output another program whose length is the next Fibonacci number, etc.
n itself (the original program's length) does not have to be a Fibonacci number... |
[Question]
[
[Balanced ternary](https://en.wikipedia.org/wiki/Balanced_ternary) is a modified version of ternary (base 3), using the three digits `1`,`0` and `-1` (written as `T`) to represent numbers.
The balanced ternary representation of `-n` can be obtained by replacing `1` with `T` and `T` with `1` in the bala... |
[Question]
[
Given two non-negative integers e.g. `27, 96` their multiplication expression would be `27 x 96 = 2592`.
If now each digits is replaced with a symbol, such that
* *two digits are replaced with the same symbol if and only if they are equal*
we could get something like `AB x CD = AECA` or `0Q x 17 = 0Z... |
[Question]
[
In this challenge you will receive a list of pairs of non-negative integers representing a mushroom forest. Each pair represents a mushroom whose center is at that horizontal coordinate. The only part of the mushroom we care about is the cap (the flat bit at the top).
The first integer in each pair rep... |
[Question]
[
You are going to be given a string containing some alphabetic characters along with `[` and `]`. Your task is to split into sections that are enclosed in a "group" created by `[...]` and those that are not. e.g.
```
"absbn[mesl]meslo[eyyis]me"
->
"absbn"
"mesl"
"meslo"
"eyyis"
"me"
```
Super simple rig... |
[Question]
[
In musical notation, groups of notes shorter than one beat are joined together by a line at the bottom called a beam. Here are a few bars of music with the beams highlighted:
[](https://i.stack.imgur.com/zci9B.png)
(Taken from *Second ... |
[Question]
[
Inspired by [this question](https://codegolf.stackexchange.com/questions/75587/zigzagify-a-matrix)
Another way to unroll a 2D image into a 1D string is to use an [Hilbert Curve.](https://en.wikipedia.org/wiki/Hilbert_curve)
There are many version of this curve, depending on the number of iterations use... |
[Question]
[
Consider a permutation of the integer values from `1` to `N`. E.g. this example for `N = 4`:
```
[1, 3, 4, 2]
```
We'll consider this list to be cyclic, such that `1` and `2` are treated as adjacent. One quantity we can compute for such a list is the total squared difference of adjacent values:
```
(1-... |
[Question]
[
## Challenge
Given an integer, `n`, as input where `36 >= n >= 2`, output how many Lynch-Bell numbers there are in base `n`.
The output must be in base 10.
## Lynch-Bell Numbers
A number is a Lynch-Bell numbers if:
* All of its digits are unique (no repetition of digits)
* The number is divisible by ea... |
[Question]
[
A Chinese checkerboard looks like this (based on [this question](https://codegolf.stackexchange.com/q/51003/25180), but this time it has a fixed size):
```
G
. G
G G G
G G . G
B B B B . . Y G . Y . Y Y
B B B . . G . . . Y Y Y
B . B . . . . . Y . Y
B . . .... |
[Question]
[
The Mongolian language has "vowel harmony". In short the vowel harmony means that certain vowels are not allowed to be placed next to each other in a word. This means that suffixes of words have to care about the vowels present in the words they attach to and need to resolve to a vowel that matches the... |
[Question]
[
# Roll for Initiative!
# Introduction
In tabletop games like Dungeons and Dragons, when you begin a battle, all involved parties *roll for initiative*. In DnD 5e, this is `1d20 + DEX + Other bonuses`, where `DEX` is the bonus given by your Dexterity stat. The characters that roll higher numbers go firs... |
[Question]
[
It's August 10th, 2019, but your task still involves Y2K. Weird, right?
Create a program that prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to its output (its source code, because this is a quine variant). When you run that output, the original pr... |
[Question]
[
I know you've always thought about the trials and tribulations of experiencing the joys of life as a web proxy. Honestly, who hasn't? Today you're tasked with realizing this goal (at least a part of it). Website X gets a lot of traffic on the daily and is looking for a PaaS (clearly this refers to Prox... |
[Question]
[
Some people say curiosity killed the cat. Other say it was the box and poison. The RSPCA say Erwin Schrödinger needs to lose the right to own pets.
With animal rights activists outside his house. The ~~cat murderer~~ scientist Schrödinger has finally come up with his greatest invention. A special, radi... |
[Question]
[
You will be given a (possibly empty) string containing brackets (`[{()}]`) and any other characters (`A`-`Z`, `a`-`z`, `0`-`9`, punctuation). You need to check if it adheres to the following rules:
* Non-bracket characters are ignored.
* Every open bracket `[{(` has a closing bracket `)}]`. So `[](` is... |
[Question]
[
Let's play a one-player game called *jump the array*. To play, you only need an array of integers, say `a`. You start at some position `i`, and on each turn, you jump to a new position. On turn `n`,
* if `n` is even, you jump to the absolute position `a[i] mod length(a)`,
* if `n` is odd, you jump to t... |
[Question]
[
The cardinality of the set \$\mathbb Q\$ of rational numbers is known to be exactly the same as that of the set \$\mathbb Z\$ of integers. This means that it is possible to construct a bijection between these sets—a mapping such that each integer corresponds to exactly one rational number, and vice ver... |
[Question]
[
*Golfeek* is the working name of an esolang I'm occasionally working on. One distinctive feature of this language is that each statement is encoded as a sequence of bits rather than a sequence of bytes.
Instead of just showing a long binary sequence, the 'gutter' of the source editor contains a represe... |
[Question]
[
This challenge will have you [count "creatures"](http://cambolbro.com/games/palago/creature-counts/) in the tile game Palago.
>
> A creature is any closed shape that can be formed by Palago tiles of matching colour in a hexagonal grid.
>
>
>
The game Palago consists of tiles like this:
[![Palago ti... |
[Question]
[
The first two MU-numbers are 2 and 3. Every other MU-number is the smallest number not yet appeared that can be expressed as the product of two earlier distinct MU-numbers in exactly one way.
Here are the first 10
```
2, 3, 6, 12, 18, 24, 48, 54, 96, 162
```
## Task
Given a positive number calculate an... |
[Question]
[
Divide the first quadrant (including the positive x-axis, the positive y-axis, and the origin) into 1x1 grids, with each grid labelled by the coordinates of its bottom-left corner, as demonstrated below:

Note that each grid contains its boundaries and its vertic... |
[Question]
[
You know how you get a voicemail message and the person's connection wasn't great, and you're trying to figure out how to call them back, but you're not sure if that was a "5" or an "8" they said?
That's this challenge.
The good news is that the caller read off their number twice, but it's garbled in b... |
[Question]
[
Write a regex that works in at least 2 regex flavors (or versions), and match a different string in each flavor (or version) it is running in.
The strings to be matched in this challenge are the first words of the Ubuntu code names, which are listed below. Your regex has to match from the top of the li... |
[Question]
[
# Alphabetize Integers
For a given set of numbers, put them in alphabetical order when they are spelled out (i.e. 1: one, 2: two, 90: ninety, 19: nineteen). Your code should work for the range `[-999999, 999999]`. Output must have a delimiter between numbers. A space will work, as will a space and a co... |
[Question]
[
Let me tell you about a simple number system. (which I made up just for this challenge)
This system contains the functions `()`, `[]`, `{}`, and `<>`.
## 1. `()`
When `()` is given no arguments, it evaluates to `0`.
When `()` is given one or more arguments, it evaluates to the sum of the arguments.
## ... |
[Question]
[
[Befunge](https://esolangs.org/wiki/Funge-98) is a 2-dimensional programming language, with an instruction pointer (IP).
In Befunge-98, the `;` character tells the IP to skip characters up until the next `;` (Let us call it skipping mode when the IP is skipping characters). Here is an example:
```
"Thi... |
[Question]
[
# Context
From Wikipedia:
A polyomino is a plane geometric figure formed by joining one or more equal squares edge to edge.
one-sided polyominoes are distinct when none is a translation or rotation of another (pieces that cannot be flipped over). Translating or rotating a one-sided polyomino does not c... |
[Question]
[
Very recently, I changed my SE username because I made this account some years ago and wanted to get back into asking questions. However, I’m still planning to post questions and potentially earn votes. We can imagine a site that has some issues dealing with name changes. The problem: given a list of n... |
[Question]
[
# The Challenge
In this challenge, you specify a *source language* `S` and a *target language* `T`. Your task is to write the following program `P` in the language `S`. If a valid program `Q` in the language `T` is given as input to `P`, it will output a valid program `R` in the language `T` which take... |
[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 1 year ago.
[Improve this questi... |
[Question]
[
\$ 1089 \$ is a very special number. To prove why, select any 3-digit number whose first and last digits differ by at least 2. Then, reverse the digits, and take the *difference* of these two numbers. Reverse the digits once more, and *add* these two numbers together. You will get \$ 1089 \$. The magic... |
[Question]
[
# Introduction
[Forte](http://esolangs.org/wiki/Forte) is a very peculiar esoteric language based on the concept of modifying the values of numbers. In Forte numbers are not constants but variables, you can use the `LET` instruction to assign new values to them.
For example, after executing `LET 2=4-1`... |
[Question]
[
You are a foreign trader, hoping to make a profit. There are 5 goods people wish to trade: `A`pricots, `B`oars, `C`anaries, `D`affodils, and `E`arwigs. Starting in the winter, you need to decide what to produce. Then, in the fall, you travel and spend your days trading for a profit.
## Gameplay
You sta... |
[Question]
[
As we learned from the IBM PC AT, [YouTube (see video)](https://www.youtube.com/watch?v=gffS40Djmxc), [Wikipedia (see article)](http://en.wikipedia.org/wiki/Beast_(video_game)), and Sesame Street:
# **The letter `H` is the *most merciless letter of the alphabet*!**
*(Even when actually composed from tw... |
[Question]
[
Given a string, like `potatocarrot`, break it into the smallest number of substrings possible. These substrings can consist either be a single character, or one of a list of words passed as input. For example, if `[carrot, potato]` was the input, the optimal way to break the string up would be `[potato... |
[Question]
[
## Challenge:
Given an ASCII art of a (possibly leaky) bowl consisting of a random distinct non-whitespace and non-`~` character, fill it completely with `~` characters. If the bowl is leaky, fill the bottom row below the bowl and a stream of liquid emerging from that, with the intended amount of `~` i... |
[Question]
[
Consider a linear system of equations, in \$n\$ unknowns, expressed as
$$A \textbf x = \textbf b$$
where \$A \in M\_{n,n}(\mathbb Z)\$ is an \$n \times n\$ matrix of integers, \$\textbf x\$ is a column vector of unknowns \$(x\_1, x\_2, \dots, x\_n)\$ and \$\textbf b = (b\_1, b\_2, \dots, b\_n)\$ is a c... |
[Question]
[
I've been working on this iOS app recently and I encountered a (rather easily solved) problem: How do I determine if my string is comprised only of emojis?
Well, that's your job today!
### Input
A string. If the presence of unicode characters is problematic for you then you may use a different reasona... |
[Question]
[
The inspiration for this code golf puzzle is the [Bridge and Torch problem](https://en.wikipedia.org/wiki/Bridge_and_torch_problem), in which ***d*** people at the start of a bridge must all cross it in the least amount of time.
The catch is that at most two people can cross at once, otherwise the brid... |
[Question]
[
## Introduction
RNA is the less famous cousin of DNA.
Its main purpose is to control the production of proteins in cells through a process called [translation](https://en.wikipedia.org/wiki/Translation_%28biology%29).
In this challenge, your task is to implement a part of this process where the RNA is ... |
[Question]
[
I think the ASCII art questions on PPCG are fun to do, but personally I think it can be pretty hard, especially when the question is tagged as [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'").
I wonder if anyone here might have some tips that will be useful for producing ASC... |
[Question]
[
**Locked**. This question and its answers are [locked](/help/locked-posts) because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
Write a program that generates and prints a [random maze](http://en.wikipedia.org/wiki/Maze_genera... |
[Question]
[
Consider a binary operator \$\*\$ that operates on a set \$S\$. For simplicity's sake, we'll assume that \$\*\$ is closed, meaning that its inputs and outputs are always members of \$S\$. This means that \$(\*, S)\$ is a [magma](https://en.wikipedia.org/wiki/Magma_(algebra))
Let's define some basic ter... |
[Question]
[
# Introduction
I don't see many regex challenges on here, so I would like to offer up this deceptively simple one which can be done in a number of ways using a number of regex flavours. I hope it provides regex enthusiasts with a bit of fun golfing time.
# Challenge
The challenge is to match what I've ... |
[Question]
[
Take two lists of non-negative integers, and output an ASCII-box as it's defined below.
* Corners and intersections are pluses: `+` (ASCII-code 43)
* Vertical lines are bars `|` (ASCII-code 124)
* Horizontal lines are minuses `-` (ASCII-code 45)
The first input list specifies the number of minuses betw... |
[Question]
[
Everyone knows the old minesweeper game that shipped with Windows XP. It's a simple grid with a 9x9 matrix of cells containing either a number (indicating how many mines are adjacent to it) or a mine.
[](https://i.stack.imgur.com/kpVkm... |
[Question]
[
Write a program that takes in a standard [truecolor](https://en.wikipedia.org/wiki/Color_depth#True_color_.2824-bit.29) image and a single 24-bit [RGB](https://en.wikipedia.org/wiki/RGB_color_model#Color_depth) color (three numbers from 0 to 255). Modify the input image (or output a new image with the ... |
[Question]
[
**Leaderboard - JIT Compiled (Lower is better)**
>
> 1. es1024 - 81.2 points (including a working compiler!)
> 2. Kieth Randall - 116 points
> 3. Ell - 121 points
>
>
>
**Leaderboard - Interpreted (Lower is better)**
>
> 1. Martin Büttner - 706654 points (somewhere around 2 hours).
> 2. criptych -... |
[Question]
[
Researchers recently discovered an interesting bee colony that lives in an
infinite field of honeycomb:
[](https://i.stack.imgur.com/1B983.png)
Each cell can house a bee or not. In fact, the lives of those creatures
appear to be a bit ... chaotic. It ... |
[Question]
[
A binary matrix represents a shape in the plane. 1 means a unit square at that position. 0 means nothing. The background is 0.
For example, the array `[[0,1,0],[0,0,1],[1,1,1]]` represents the following shape:
```
o----o
|////|
|////|
o----o----o
|////|
|////|
o-... |
[Question]
[
As you most probably now, there are 2339 solutions to pentomino puzzle in a 6x10 grid. There are different labeling schemes for the 12 pentominoes, two of them are shown on the image below:
[](https://i.stack.imgur.com/pjRVg.png)
Image... |
[Question]
[
### Input:
Two strings without newlines or whitespaces.
### Output:
Both input strings on separate lines, with spaces where necessary† for one of the two strings. And a third line with the characters `A`, `R`, `M` and , representing *added*, *removed*, *modified*, and *unchanged*.
† We add spaces to ei... |
[Question]
[
The task is to find a non-trivial factor of a composite number.
Write code that finds a non-trivial factor of a composite number as quickly as possible subject to your code being no more than 140 bytes long. The output should just be the factor you have found.
Your code can take input and give output i... |
[Question]
[
You must write a program or function that, when given a *nonempty* string **S** of **N** printable ASCII characters†, outputs a program that will exit with exit code **C**, where **C** is the ASCII codepoint at position 0 in **S**. This program you write will additionally output a program **P**, such t... |
[Question]
[
A [sestina](https://en.wikipedia.org/wiki/Sestina) is a format of poem that follows an interesting pattern that we can generate. It has six stanzas of six lines each, where the last words of each line in the first stanza make up the line endings in each successive stanza, rotated in a set pattern. (The... |
[Question]
[
# Definition
According to [Wikipedia](https://en.wikipedia.org/wiki/Cooke_and_Wheatstone_telegraph):
>
> The Cooke and Wheatstone telegraph was an early electrical telegraph system dating from the 1830s invented by English inventor William Fothergill Cooke and English scientist Charles Wheatstone. It ... |
[Question]
[
For this challenge, you will be given an absolute path, and a "new" path (which can be absolute or relative), and you need to return the final path.
For example, if your current directory was `/var/tmp/test`:
`my_dir` or `my_dir/` should return `/var/tmp/test/my_dir`
`../../my_dir` should return `/var/... |
[Question]
[
### Overview
[**Pearls** (or Masyu)](http://en.wikipedia.org/wiki/Masyu) is a logic game played on a grid. There are black and white pearls placed on the grid. The object is to form a *single, closed loop* that travels through each pearl using only straight line segments and right angles.
There are som... |
[Question]
[
In this task you have to write a program that reads a regular expression and generates another program that outputs whether an input string is accepted by that regular expression. The output must be a program written in the same language as your submission.
# Input
The input is a regular expression *r*... |
[Question]
[
Given a list of words and a grid of letters, find all the words in the grid and remove any letters which are not part of any of the words. The words could be forwards, backwards, up, down or diagonal. You may assume that no word in the list will occur in more than one place in the grid.
Input will alwa... |
[Question]
[
For the purposes of this challenge, we define a postfix [regex](https://en.wikipedia.org/wiki/Regular_expression) dialect with alphabet `{1, 0}` and the following operations:
* `1` and `0` match themselves literally.
* `_` matches the empty string.
* `!` always fails (i.e. it does not match anything).
... |
[Question]
[
Your task: given an integer `n`, generate an embedded hexagon pattern following the below rules, to the nth depth.
An embedded hexagon has the basic shape of this: (`n=0`)
```
__
/ \
\__/
```
Embedded Hexagons `n=1` and `n=2`:
```
____
/ \ \
/\__/ \
\ /
\____/
________
... |
[Question]
[
### Introduction
Of course, we've got a lot of [sequence](/questions/tagged/sequence "show questions tagged 'sequence'") challenges, so here is another one.
The Kimberling sequence ([A007063](http://oeis.org/A007063)) goes as following:
```
1, 3, 5, 4, 10, 7, 15, 8, 20, 9, 18, 24, 31, 14, 28, 22, ...
`... |
[Question]
[
<https://en.wikipedia.org/wiki/Losing_chess>
This is basically [Chess Tournament](https://codegolf.stackexchange.com/questions/37251/chess-tournament), but for antichess ;)
Antichess is one of the many [chess variants](https://en.wikipedia.org/wiki/List_of_chess_variants) that have been invented. The g... |
[Question]
[
# The Problem
I have a bunch of regular expressions that I need to use in some code, but I'm using a programming language that doesn't support regex! Luckily, I know that the test string will have a maximum length and will be composed of printable ASCII only.
# The Challenge
You must input a regex and ... |
[Question]
[
(The word frame in the following text does not mean an actual frame, it is used as a placeholder for an undefined time unit)
# The task
Imagine you have a keyboard layout with only letters like so:
```
q w e r t y u i o p
a s d f g h j k l
z x c v b n m
```
Whenever you press a key, for example `f`,... |
[Question]
[
# Inspired by, and in memory of, our beloved genius,
[](https://www.dyalog.com/news/131/420/John-Scholes.htm)
# [R.I.P.](http://johnscholes.rip/)
He [invented](https://dyalog.tv/Dyalog18/?v=y33XDD6ANt0 "Dfns - Past... |
[Question]
[
# Challenge
Origami (folding paper) is a creative form of art. As far as I know, master of Origami prefers square paper. Let's start from beginning - convert a rectangular paper to a square one.
So the paper is divided into squares. We remove the biggest square which shares one shorter edge with the cu... |
[Question]
[
**EDIT: I will be accepting an answer Monday, 2/15/2016. May the bytes be ever in your favor!**
In his ["Print the N-Bonacci Sequence" challenge](https://codegolf.stackexchange.com/questions/70476/print-the-n-bonacci-sequence?noredirect=1#comment172535_70476), @DJMcGoathem describes the N-bonacci seque... |
[Question]
[
## The size of the moon mystery
I am sure you have heard that the moon changes its size. When you're in love and you're lucky, the moon is almost twice in size compared to normal situations. Some people say the reason is the atmosphere which acts as a lens. Others think that it is only a matter of comp... |
[Question]
[
After [@MartinBüttner](https://codegolf.stackexchange.com/users/8478/martin-b%C3%BCttner) achieved [exactly 10,000 reputation](http://chat.stackexchange.com/transcript/message/16950428#16950428), we now have three full rows of 10k users on the [users page](https://codegolf.stackexchange.com/users?tab=R... |
[Question]
[
In Chess, it's possible for the game to end after 4 moves (2 each) with a [Fool's Mate](http://en.wikipedia.org/wiki/Fool's_mate).
Your goal is to find the Fool's Mate of [Halma](http://en.wikipedia.org/wiki/Halma): the 2-player game of Halma that minimises the number of turns played.
There are over 10... |
[Question]
[
Generate a 4x12 grid of letters / spaces:
Each die should appear precisely once, location randomly chosen. Locations should be approximate a uniform random permutation of the dice. Display a random (again, approximately uniform) face of each die. Left-justify the face in the 3-character window. For exa... |
[Question]
[
## Background
A **staircase polyomino** is a polyomino made of unit squares whose shape resembles a staircase. More formally, a staircase polyomino of size \$n\$ is defined as follows:
* A staircase polyomino of size 1 is a single unit square.
* A staircase polyomino of size \$n\$ is the same as that o... |
[Question]
[
For the purpose of this question a meandering curve is one that follows the general direction from left to right, but makes repeatedly n+1 turns at 90 degrees to the left and then n+1 turns to the right (for n>0).
In fact the meander itself will have `n` segments.
The turns are denoted with `+`.
The wi... |
[Question]
[
A cyclic number is a number of "n" digits that when multiplied by 1, 2, 3,...n, results in the same digits but in a different order.
For example, the number 142,857 is a cyclic number since 142,857 x 2 = 285,714, 142,857 x 3 = 428,571, 142,857 x 4 = 571,428, and so on. Given an integer input, determine... |
[Question]
[
## Background
On this site, we occasionally have questions requiring programs to be "radiation hardened"; this means that the program has to be able to survive the deletion of one or more bytes, no matter which bytes are deleted.
As is common for tasks that frequently get set in programming challenges,... |
[Question]
[
**The Challenge**
Given the two uppercase hexadecimal strings (both 6 characters long, XXXXXX and YYYYYY) representing RGB values (ranging from `000000` to `FFFFFF` inclusive), and a positive non-zero integer N, display a linear transition of the N+2 colors generated from XXXXXX to YYYYYY that would re... |
[Question]
[
The seam carving algorithm, or a more complex version of it, is used for content-aware image resizing in various graphics programs and libraries. Let's golf it!
Your input will be a rectangular two dimensional array of integers.
Your output will be the same array, one column narrower, with one entry re... |
[Question]
[
A near-repdigit number is a positive integer where all the digits are the same, except one. For example 101 and 227 are near-repdigits. A near-repdigit prime is a near-repdigit that is also prime. For example:
101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373... |
[Question]
[
In November 2019, Alon Ran published a particularly lovely sequence in the OEIS, [A329126](https://oeis.org/A329126):
>
> \$a(n)\$ is the lexicographically earliest string of digits which yields a multiple of \$n\$ when read in any numeric base.
> `1, 110, 101010, 111100, 100010001000100010, 1111110, ... |
[Question]
[
This challenge is about creating these neat "green spray paint" patterns: (more pictures below)
[](https://i.stack.imgur.com/yV9Cp.png) [](https://i.stack.imgur.com/U1avD.png) [\$ of integers \$k\_i \geqslant 2\$ such that \$k\_1 \cdot k\_2 \cdot ... \cdot k\_m = n\$ and $$k\_1 | k\_2 \text{ , } k\_2 | k\_3 \text{ , } \ldots \text{ , }k\_{m-1}|k\_m.$$
Here \$a|b\$ means \$b\$ is a multiple of \$a... |
[Question]
[
I recently had a problem to solve at work where I had two lists: a master list, and a smaller list that contains a subset of the items in the master list potentially in a different order. I needed to reorder the master list in such a way that the items in the subset would appear in the same order witho... |
[Question]
[
[Abbreviate that US state!](https://codegolf.stackexchange.com/questions/122896/abbreviate-that-us-state/122925?noredirect=1#comment304738_122925) was fun, but we learnt that efficiently abbreviating US state names is hard with the current system. Let's come up with an alternative state code scheme for... |
[Question]
[
**Background**
The [Schläfli Symbol](https://en.wikipedia.org/wiki/Schl%C3%A4fli_symbol) is a notation of the form {p,q,r,...} that defines regular polytopes and tessellations.
The Schläfli symbol is a recursive description, starting with a p-sided regular polygon as {p}. For example, {3} is an equilat... |
[Question]
[
The [VIC cipher](https://en.wikipedia.org/wiki/VIC_cipher) is one of the most complicated pencil and paper ciphers ever devised. Used in the 1950s by Soviet spy Reino Häyhänen, codenamed "VICTOR", its main principle is security through obfuscation; a *lot* of obfuscation.
Your task is to write a progra... |
[Question]
[
**Problem**
One day, you boss walks up to you and tells you he needs to know the time. He still insists after you pointing at the clock directly above your head, and confesses he has a severe case of [dyscalculia](https://en.wikipedia.org/wiki/Dyscalculia), which causes him to not even be able to see n... |
[Question]
[
Given a string with a multiple people's investment data, find out how much profit/loss they recorded.
The string only contains capital and lowercase letters, like this:
```
AABaBbba
```
Each letter represents a person - a capital letter means buy, a lowercase letter means sell. The price of the stock ... |
[Question]
[
The cofactor matrix is the transpose of the [Adjugate Matrix](https://en.wikipedia.org/wiki/Adjugate_matrix). The elements of this matrix are the [cofactors](https://en.wikipedia.org/wiki/Minor_%28linear_algebra%29) of the original matrix.
The cofactor [ (OEIS sequence [A005153](http://oeis.org/A005153)) iff all smaller positive integers can be represented as sums of distinct divisors of `n`.
For example, `18` is a practical number: its divisors... |
[Question]
[
The book Green Eggs and Ham by Dr. Seuss is famous for only having 50 different words in the entire story of the book.
Your task is to create a sequence of keystrokes that will result in the entire text of Green Eggs and Ham when applied to an empty file in the [vim](http://www.vim.org/) text editor, s... |
[Question]
[
There is a well-known theorem that [any permutation can be decomposed into a set of cycles](http://en.wikipedia.org/wiki/Permutation#Notation). Your job is to write the shortest possible program to do so.
## Input:
Two lines. The first contains a number `N`, the second contains `N` distinct integers in... |
[Question]
[
There is a game called *Get Home* that is played on the a chess board. In this game there is a single piece that is moved by both players in turns. There are some rules to how the piece can be moved. On a turn a player must make one of the following moves for positive **n**.
* **n** spaces up
* **n** s... |
[Question]
[
Given an input of a list of days of the week, output the shortest sorted
representation of the list.
The format of the input is a string consisting of one or more of the
two-character substrings `Su` (Sunday), `Mo` (Monday), `Tu` (etc.), `We`, `Th`,
`Fr`, and `Sa`. The input may not necessarily be give... |
[Question]
[
You should write a program or function which receives the volume of a bowl and the volume of the water in it as input and outputs or returns an ASCII representation of a bowl with water in it with the desired volumes.
A bowl has the following structure:
```
\ /
\___/
```
The bowl has at least on... |
[Question]
[
## Challenge
Write a function or program which takes a positive decimal number, call it *A*, and output two positive numbers, *B* and *C*, such that:
* *A* == *B* bitxor *C*
* *B* and *C* must not contain any of the digits 0, 3 or 7 in its decimal representation.
## Examples
```
>>> decompose(3)
1, 2
>... |
[Question]
[
As you may very well know python has lists. As you might not know these lists can contain themselves.
```
a = []
a.append(a)
```
[Python 2](https://tio.run/nexus/python2#@5@oYKsQHcuVqJdYUJCal6KRqPm/oCgzr0Qh8T8A "Python 2 – TIO Nexus")
[Python 3](https://tio.run/nexus/python3#@5@oYKsQHcuVqJdYUJCal6KRqPm... |
[Question]
[
We will be implementing division for arbitrarily large integers.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'").
**The task is to write a program or function that implements arbitrary precision integers and Division on them.**
**Note that many things that might mak... |
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.