text stringlengths 180 608k |
|---|
[Question]
[
*This is a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge. For the robbers thread, go [here](https://codegolf.stackexchange.com/q/109951/42963).*
This challenge involves two [OEIS](https://oeis.org/) sequences chosen by the cops -- **S1**, **... |
[Question]
[
Write a program or named function that will output or return the sequence up to the `n`th integer in the Iccanobif sequence, documented on OEIS as [A014258](https://oeis.org/A014258). Note that only the zeroth element in the sequence (`0`) will be printed if `n` is zero.
The sequence is generated by st... |
[Question]
[
We've already got a [meta-regex-golf problem](https://codegolf.stackexchange.com/q/17718/2180) as inspired by the xkcd comic

But, this regex golf looks fun, too! I want to distinguish between the states of the US and the regi... |
[Question]
[
Halloween is almost here, the holiday after which most people need to wean themselves off a hollow diet of sugar.
Write a program that takes in a positive integer. If the integer is less than 31 (1 through 30), output this ASCII-art jack-o'-lantern, looking to the right as if looking forward to Hallowe... |
[Question]
[
In [Minecraft](http://en.wikipedia.org/wiki/Minecraft), the [default item textures](https://i.stack.imgur.com/mbk6q.png) are all reasonably simple 16×16 pixel images, which makes them seem ideal for [golfing](http://en.wikipedia.org/wiki/Code_golf).
Below are simplified textures of the five "core" diam... |
[Question]
[
This is a code-golf challenge whereby you need to devise a program that acts like a quine or a quine that modifies itself to illustrate machine learning.
# Background
There is a basic artificial intelligence program called 'the pangolin game' which is described [here](https://studentnet.cs.manchester.a... |
[Question]
[
Given the following Python "reference implementation" of non-terminating FizzBuzz:
```
i=1
while True:
if i%15 == 0:
print("FizzBuzz")
elif i%3 == 0:
print("Fizz")
elif i%5 == 0:
print("Buzz")
else:
print(i)
i += 1
```
We can represent its output as a... |
[Question]
[
A Window is an ASCII-art square with odd side length of at least 3, with a single character border around the edge as well as vertical and horizontal strokes in the middle:
```
#######
# # #
# # #
#######
# # #
# # #
#######
```
An MS Window is a window where the border is made only of the char... |
[Question]
[
Write a program that reads a \$n\times n \times n\$ array of binary values which represent an \$n\times n \times n\$ cube, that consists of \$n^3\$ smaller cubes. Each value says whether there is a voxel (small cube) present in the given position or not. The program must output the given array as an AS... |
[Question]
[
There was a challenge to [convert a number to its numeral in English](https://codegolf.stackexchange.com/q/32151/29750), but that was too straightforward. Given a number 0–100, your task is to output the corresponding numeral in French. The French numeral system has a more complex logic behind it compa... |
[Question]
[
We see a lot of challenges here asking for a function to create a sequence from the [OEIS](https://oeis.org/). While these challenges are fun, as a programmer I see an opportunity for automation.
Your challenge is to make a program that takes the index of a sequence (e.g. [A172141](https://oeis.org/A17... |
[Question]
[
Your task is to take a sequence of characters (the music) as input (in a function or program), and print (or return) the music as it would look like in a music box.
You will only receive the characters `ABCDEFG.()` as input, and the input will never be empty. You may also receive the letters in lowerca... |
[Question]
[
Your task is write a program or function that can fill a given rectangle with
prime numbers. The `width` and `height` of the rectangle will be the input. The
output must be a list of `height` strings consisting of `width` digits and
spaces. Each horizontal (left to right) and vertical (top to bottom) d... |
[Question]
[
In the [PPCG](https://codegolf.stackexchange.com/) chatroom the [Nineteenth Byte](https://chat.stackexchange.com/rooms/240/the-nineteenth-byte), using carets `^` (or [carrots](http://meta.codegolf.stackexchange.com/a/7330/26997)) is a way of indicating that you agree with one of the previously made com... |
[Question]
[
## The winner (pretty obviously) is Dennis ♦, who used Jelly with 10 bytes!
This challenge will still be up here, however results won't be taken anymore.
---
The powertrain of a number is a concept by John Conway (who is also notable for making Conway's Game of Life, but that's not the point). It is de... |
[Question]
[
# Santa's Decision:
In this challenge, you will help Santa Claus decide whether somebody on their list has been naughty or nice, and subsequently get `coal` or `toys`.
But unfortunately, Santa is unorganised, in some of his entries, the `naughty`, `nice` and `name` fields are in the wrong order.
## Inp... |
[Question]
[
You are required to write a Hangman solver. Testing against [this](https://gist.github.com/adrianiainlam/10152724) English word list[1], the solver that solves the most number of words wins, with the number of total incorrect guesses being the tie-breaker. All words in the word list will be tested in r... |
[Question]
[
You probably know the game mastermind:
The player tries to guess a code of 4 slots, with 8 possible colors - no duplicates this time.
Let's call those colors A through H, so possible solutions could be ABCD or BCHD.
Each time you place a guess, the game master will respond with two information: how man... |
[Question]
[
I saw [a cool gif](https://i.stack.imgur.com/ZBHdI.gif) of the twin dragon curve made from a square, and wondered what would happen if we started from another base image. So I wrote a program to do this.

I... |
[Question]
[
There are *n* people on a 2D plane. Using distances between them we're going to find their positions. To get a unique answer you must make four assumptions:
1. There are at least 3 people.
2. The first person is at position (0, 0).
3. The second person is at position (x, 0) for some x > 0.
4. The third... |
[Question]
[
This challenge is to score a Cribbage hand. If you don't play Cribbage, you've got some learning to do. We play with a standard poker deck, and a hand consists of four cards plus the "up card". There are two types of hand: normal, and a 'crib hand'.
Cards come in the format `vs` where `v` is one of: `A... |
[Question]
[
Problem 4 in the [2019 BMO, Round 1](https://bmos.ukmt.org.uk/home/bmo1-2020.pdf) describes the following setup:
>
> There are \$2019\$ penguins waddling towards their favourite restaurant. As
> the penguins arrive, they are handed tickets numbered in ascending order
> from \$1\$ to \$2019\$, and to... |
[Question]
[
# Introduction
You're a criminal tasked with stealing some secret plans from the new tech startup Dejavu. You sneak in over the back wall, but find a door that requires a pin to open it. You recognize the make of the lock and know that it takes a 5 digit pin using all numbers from 0 to 4. After each di... |
[Question]
[
If we take a positive integer \$n\$ and write out its factors. Someone can determine \$n\$ just from this list alone. In fact it is trivial to do this since the number is its own largest factor.
However if we take \$n\$ and write only the first half of its factors (factors that are smaller than or equa... |
[Question]
[
In this challenge you will be given an alphabetic string as input. We will define the "anti-string" of a given input to be the string with the case of all the letters inverted. For example
```
AaBbbUy -> aAbBBuY
```
You should write a program that takes a string as input and searches for the longest co... |
[Question]
[
*(related: [one](https://codegolf.stackexchange.com/questions/19912/acrostic-poem-programming), [two](https://codegolf.stackexchange.com/questions/7105/create-an-acrostic), [three](https://codegolf.stackexchange.com/questions/4422/acrostic-polyglot-programming))*
An [acrostic](https://en.wikipedia.org/... |
[Question]
[
As part of a city planning project, you've gotten the assignment of creating a program or function that will display the city skyline, given some input from the architects. The project is only in the startup phase, so a very rough sketch is sufficient. The easiest approach is of course to simply draw t... |
[Question]
[
### Intro
Something I've played around with in recreational mathematics has been construction of a divisor table to visually compare/contrast the prime divisors of a set of numbers. The set of input numbers are across the top as column labels, the prime divisors are on the left as row labels, and a mar... |
[Question]
[
Given a list of strings `s_0, s_1, ..., s_n` find the shortest string `S` that contains each of `s_0, s_1, ..., s_n` as a [substring](http://en.wikipedia.org/wiki/Substring#Substring).
*Examples*:
* `S('LOREM', 'DOLOR', 'SED', 'DO', 'MAGNA', 'AD', 'DOLORE')='SEDOLOREMAGNAD'`
* `S('ABCDE', 'BCD', 'C')=... |
[Question]
[
Write a program (or function) that takes in a positive integer.
If the input is `1`, print (or return) two diamonds neighboring side-by-side, each with a side length of 1 slash:
```
/\/\
\/\/
```
For every input `N` greater than 1, look at the output for `N-1` and for each pair of neighboring diamonds,... |
[Question]
[
This challenge is in honor of the Rookie of the Year category winners of [Best of PPCG 2015](https://codegolf.meta.stackexchange.com/questions/8007/cast-your-vote-for-best-of-ppcg-2015): [muddyfish](https://codegolf.stackexchange.com/users/32686/muddyfish) (for [I'm not the language you're looking for!... |
[Question]
[
Digging around in the depths of your temp folder, you find some compositions for the piano. Unfortunately, these compositions were written with note names and durations only, and you only have access to a text terminal. Therefore, your task is to write a program to display the compositions as ASCII art... |
[Question]
[
Implement the shortest Sudoku solver.
**Sudoku Puzzle:**
```
| 1 2 3 | 4 5 6 | 7 8 9
-+-----------------------
A| 3 | 1 |
B| 6 | | 5
C| 5 | | 9 8 3
-+-----------------------
D| 8 | 6 | 3 2
E| | 5 |
F| 9 3 | 8 | 6
-+-----------------------
G| 7 ... |
[Question]
[
You must write a program that evaluates a string that would be entered into an advanced calculator.
The program must accept input using stdin and output the correct answer. For languages that do no have functions to accept stdin, you may assume the functions `readLine` and `print` to handle these tasks... |
[Question]
[
When I see code-golf entries that knock a few characters off, whittling down the code, I go look at the edit history for a side-by-side diff. See and learn :)
This challenge is to make a program that produces the prettiest animated diffs.
* The input will be any ordered series of text versions.
* The p... |
[Question]
[
Consider all `2^n` different binary strings of length `n` and assume `n > 2`. You are allowed to delete exactly `b < n/2` bits from each of the binary strings, leaving strings of length `n-b` remaining. The number of distinct strings remaining depends on which bits you delete. Assuming your aim is to l... |
[Question]
[
[Ohm's law](https://en.wikipedia.org/wiki/Ohm%27s_law) tells us that the current (I) in amps flowing through a resistance (R) in Ohms when a voltage (V) is applied across it is given as follows:
```
V = I / R
```
Similarly the [power (P) in watts](https://en.wikipedia.org/wiki/Watt#Examples) dissipated... |
[Question]
[
OCTOBER 22 IS [INTERNATIONAL CAPS LOCK DAY](http://capslockday.com)! UNFORTUNATELY, SOME DO NOT RECOGNIZE THE GLORY OF THE ALMIGHTY CAPS LOCK. THEY SAY IT SEEMS "OBNOXIOUS" OR "LIKE SHOUTING" OR SOME NONSENSE. IN ORDER TO CONFORM TO THESE OBVIOUSLY ILLOGICAL AND INANE COMPLAINTS, PLEASE WRITE ME A PROG... |
[Question]
[
[MarioLANG](http://esolangs.org/wiki/MarioLANG) is a two-dimensional programming language where the source code resembles a Super Mario Bros. level. Furthermore, its instruction set is very similar to [Brainfuck](http://esolangs.org/wiki/Brainfuck)'s. This means that MarioLANG is essentially a 2-D Brai... |
[Question]
[
Lets say you saw your friend enter his or her password into their Android phone. You don't remember how they made the pattern but you remember what the pattern looks like. Being the concerned friend that you are you want to know how secure their password is. Your job is to calculate all the ways that a... |
[Question]
[
When I was a kid, there was a "really cool" shortcut to count to 100:
`1, 2, miss a few, 99, 100`
Output the exact string above, in the fewest characters possible, without using these characters: `0`, `1`, `2`, `9`
[Answer]
# JavaScript (ES6), 43 bytes
Browser only.
```
_=>atob`MSwgMiwgbWlzcyBhIGZ... |
[Question]
[
In the C standard library, header names end with a `.h` suffix:
```
stdio.h
```
In C++, those header names are available in an alternative form, with a `c` prefix instead:
```
cstdio
```
Write a function that converts the first form into the second. You can do the conversion in-place, or leave the orig... |
[Question]
[
Implement the classic rock paper scissors.
Conditions:
* user will input 'r', 'p' or 's'
* program will output 'r', 'p' or 's' and the result
* program choice ('r', 'p' or 's') has to be pseudo random (**I'm looking at you Howard**)
* result can be represented with any printable character, there should... |
[Question]
[
An \$n\times n\$ [Latin Square](https://en.wikipedia.org/wiki/Latin_square) is a grid containing exactly \$n\$ distinct values where the values in each row and column are distinct. For example,
$$\begin{matrix}
A & B & C \\
C & A & B \\
B & C & A \\
\end{matrix}$$
is a Latin square as no row or column ... |
[Question]
[
>
> *Inspired by [this](https://chat.stackexchange.com/transcript/message/61463602#61463602) accidental misspelling*
>
>
>
If you could read the title, then you already know what the challenge is about. If not, then I'll tell you. Easy: simply take each word (single space delimited), and swap the p... |
[Question]
[
It's a common problem to navigate in a 2D matrix. We've seen it many times and will see again. So let's help future us and develop the shortest solutions to generate all eight possible steps in a 2D matrix.
## Challenge
Your code must output the following 8 pairs of -1,0,1 in any order:
```
(0,1)
(0,-1... |
[Question]
[
A number is [whole](https://en.wikipedia.org/wiki/Natural_number) if it is a non-negative integer with no decimal part. So `0` and `8` and `233494.0` are whole, while `1.1` and `0.001` and `233494.999` are not.
---
## Input
A floating-point number in the default base/encoding of your language.
For exa... |
[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 8 years ago.
[Improve this quest... |
[Question]
[
We all know that the [Euler's number](//en.wikipedia.org/wiki/E_(mathematical_constant)), denoted by \$e\$, to the power of some variable \$x\$, can be approximated by using the [Maclaurin Series](http://mathworld.wolfram.com/MaclaurinSeries.html) expansion:
$$e^x=\sum\_{k=0}^{\infty}{\frac{x^k}{k!}}=1... |
[Question]
[
### Your task
Given a string of lowercase letters, output the "alphabet checksum" of that string, as a letter.
### Example
Let's say we have the string *"helloworld"*. With `a = 0`, `b = 1`, `c = 2` ... `z = 25`, we can replace all of the letters with numbers:
```
h e l l o w o r l d
7 4 11 ... |
[Question]
[
**Task**
Given a positive integer `n` less than `2^30` specified as input in any way you choose, your code should output a random integer between `0` and `n`, inclusive. The number you generate should be chosen *uniformly at random*. That is each value from `0` to `n` must occur with equal probability... |
[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]
[
Following [this](https://stackoverflow.com/questions/4568645/printing-1-to-1000-without-loop-or-conditionals) popular question, present your solution which prints the numbers 1 to 1000 (all of them, not the string "1 to 1000" verbatim or something funny) in C++ without using any semi-colons. Unlike the... |
[Question]
[
This is taken from [this question](https://stackoverflow.com/questions/55823298/how-do-i-check-if-a-string-is-entirely-made-of-the-same-substring) (with permission ofcourse). I'll quote:
>
> Create a function which takes a string, and it should return true or
> false based on whether the input consis... |
[Question]
[
>
> As of 27/12/20, the challenge is over as no new answers were posted on the 26th. With an astounding 55 points (and 21 answers), the winner is [pppery](https://codegolf.stackexchange.com/users/46076/pppery)!
>
>
> A quick shout out to the top 5 scorers as well:
>
>
> * 1st. [pppery](https://cod... |
[Question]
[
Write a program that takes no input and prints `Hello, World!` to stdout or your language's closest alternative. The catch is that each line in your program must only contain [printable ASCII characters](http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters) and it must be in lexicographical or... |
[Question]
[
# Challenge
This challenge is pretty simple: Output the total number of possible Tweets. Given the fact that \$1{,}114{,}112\$ Unicode characters exist, and Tweets can be up to \$280\$ characters long, we calculate this number like so:
$$\sum\_{l=1}^{280}1{,}114{,}112^l$$
Calculated, this number become... |
[Question]
[
## Summary
We already have a challenge for the [minimal number of characters for Turing completeness](https://codegolf.stackexchange.com/q/110648/48931). But what about the minimal maximum byte?
## Challenge
For a language of your choice, find a subset of characters that allows your language to be [Tur... |
[Question]
[
This is the cops' thread. The robbers' thread [goes here](https://codegolf.stackexchange.com/questions/67757/printing-ascending-ascii-robbers).
Write a program or function consisting only of **printable ASCII characters** (that excludes tab and newline) that outputs at least 5 printable ASCII character... |
[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]
[
# Introduction
Every string has an "alphabet", composed of the characters that make it up. For example, the alphabet of \$abcaabbcc\$ is \${a, b,c}\$. There are two operations you can do with alphabets: getting the alphabet of a string, and seeing if another string has a given alphabet.
# Challenge
Giv... |
[Question]
[
Your challenge today is to take an array, split it into chunks, and add those chunks.
Here's how this works: Your program or function will be given an array of integers `a` and a chunk size `L`. The array should be split into arrays of size `L`, if the array length is not divisible by `L` then the arra... |
[Question]
[
05AB1E has the `£` builtin which, given a list of integers `b` and a string `s`, splits `s` into sublists of lengths equal to the elements in `b`. For example, `[1,2,3,4,1] "hello world"£` produces `["h", "el", "lo ", "worl", "d"]`. Your task is to imitate this behaviour.
Given a list \$L\$ containing ... |
[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/20646/edit).
Closed 2 years ago.
[Improve this question](/posts/20646/edit)
... |
[Question]
[
## Task
You're in charge of making a compass, of sorts.
Imagine your source code as the compass "needle" where running at different orientations produces distinct output.
Supported source code orientations are North, East, South, and West.
## Example
Let's say you have source code:
```
ABCD
J K
WXYZ
`... |
[Question]
[
[Vyxal](https://github.com/vyxal/vyxal) is a stack-based language, meaning that everything operates by popping and pushing values onto a stack. It has a bunch of useful flags, one of which is `r`.
Running a Vyxal program with the `r` flag causes functions to take their elements in reverse order.
For ex... |
[Question]
[
[This challenge](https://codegolf.stackexchange.com/questions/61808/lossy-sorting-implement-dropsort) already describes dropsort. However, I'm kinda lazy and I really only need my array to be a bit more sorted than before, it doesn't need to be sorted *all the way*.
In Drop Sort, we drop every element ... |
[Question]
[
Write a program that will test the primality of a specified number, and give the output as a Boolean value (True is prime). Your prime test can (but doesn't have to) be valid for the number 1.
Here's the catch: your program itself has to sum to a prime number. Convert every character (including spaces... |
[Question]
[
>
> No, not the `^^vv<><>BA` kind of Easter eggs, real Easter eggs that we paint.
>
>
>
Here is an (awfully drawn) egg.
```
__
/ \
/ \
| |
\____/
```
In easter, we paint them with patterns. Like these:
```
__
/--\
/----\
|----|
\____/
__
/%%\
/%%%%\
|%%%%|
\____/
__
/~~\
/~~~~\
|... |
[Question]
[
I've already made this in Python, but it seems that it could be shortened a lot:
```
txt = input("Type something.. ")
c = "#"
b = " "
print(c * (len(txt) + 4))
print(c, b * len(txt), c)
print(c, txt, c)
print(c, b * len(txt), c)
print(c * (len(txt) + 4))
```
So if the user types:
```
Hello World
```
Th... |
[Question]
[
Given no input, output this interesting alphabet pattern in either case (the case has to be consistent) via an [accepted output method](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods):
```
A
AB
ACBC
ADBDCD
AEBECEDE
AFBFCFDFEF
AGBGCGDGEGFG
AHBHCHDHEHFHG... |
[Question]
[
Let's see how good your language of choice is at selective randomness.
Given 4 characters, `A`, `B`, `C`, and `D`, or a string of 4 characters `ABCD` **as input**, output one of the characters with the following probabilities:
* `A` should have a 1/8 (12.5%) chance to be chosen
* `B` should have a 3/8 ... |
[Question]
[
## Task
Your goal, should you choose to accept it, is to write a program, that, given an input string (or array of characters), outputs every possible permutation of the letters in that string. I'm finicky with my output, so it should be sorted alphabetically, with no duplicates.
**Example:**
Input: `b... |
[Question]
[
It seems that many people would like to have this, so it's now a sequel to [this challenge](https://codegolf.stackexchange.com/questions/167106/recover-the-prime-from-the-prime-power)!
**Definition**: a *prime power* is a natural number that can be expressed in the form pn where p is a prime and n is a... |
[Question]
[
# Task
Given an array of positive integers, replace each element with the parity of the sum of the other elements. The array is guaranteed to have **at least** 2 elements.
# Definition
* Parity: whether a number is odd or even.
# Example
For the array `[1,2,3,1]`:
* Replace `1` with the parity of `2+3+... |
[Question]
[
Today's challenge is simple: Without taking any input, output any valid sudoku board.
In case you are unfamiliar with sudoku, [Wikipedia describes what a valid board should look like](https://en.wikipedia.org/wiki/Sudoku):
>
> The objective is to fill a 9×9 grid with digits so that each column, each r... |
[Question]
[
# Input
A calendar year from 927 to 2022.
# Output
You can use any three distinguishable outputs. As an example,
“K” (short for King)
or
“Q” (short for Queen)
depending on which of the two England had in that year. If there was both a King and Queen in that year you can output either.
If there ... |
[Question]
[
# Cops' Challenge
[Robbers' challenge here](https://codegolf.stackexchange.com/questions/245702/whats-the-missing-code-robbers).
>
> It has now been four days since the challenge was posted so all new answers should be marked as **non-competing** in the title. These answers can still be cracked by rob... |
[Question]
[
Convert a string containing digits as words into an integer, ignoring leading zeros.
# Examples
* `"four two"` -> `42`.
* `"zero zero zero one"` -> `1`.
# Assumptions
Submissions can assume that:
1. The input string is comprised of space-separated digit words.
2. All words are valid (in the range "zero... |
[Question]
[
Happy Pi Day everyone! For no reason at all, I'm trying to construct a Monte Carlo estimator of Pi that is as short as possible. Can we construct one that can fit in a tweet?
To clarify, what I have in mind is the typical approach of drawing random points from the unit square and calculating the ratio ... |
[Question]
[
## Description
Given an unsorted array of integers, find the smallest positive integer that does not appear in the array. Your task is to write the shortest code possible to solve this problem.
## Input
A non-empty or empty array of integers, where the integers may be negative, zero, or positive.
## Ou... |
[Question]
[
Given a string which is guaranteed to be either `odd`, `even`, `square`, `cube`, `prime` or `composite`, your program or function must return an integer \$100\le N\le 999\$ which meets this description.
## Rules
* Your code must be deterministic.
* The choice of the integers is up to you. However, the ... |
[Question]
[
This is a version of the recent challenge [Is this number an integer power of -2?](https://codegolf.stackexchange.com/questions/115516/is-this-number-an-exact-power-of-2) with a different set of criteria designed to highlight the interesting nature of the problem and make the challenge more difficult. ... |
[Question]
[
Whoa, whoa, whoa ... stop typing your program. No, I don't mean "print `ABC...`." I'm talking the capitals of the United States.
Specifically, print all the city/state combinations given in the following list
* in any order
* with your choice of delimiters (e.g., `Baton Rouge`LA_Indianapolis`IN_...` is... |
[Question]
[
Given a nonempty list of positive integers \$(x, y, z, \dots)\$, your job is to determine the number of unique values of \$\pm x \pm y \pm z \pm \dots\$
For example, consider the list \$(1, 2, 2)\$. There are eight possible ways to create sums:
* \$+ 1 + 2 + 2 \to +5\$
* \$+ 1 + 2 − 2 \to +1\$
* \$+ 1 ... |
[Question]
[
# Ultrafactorials
The ultrafactorials are a sequence of numbers which can be generated using the following function:
$$a(n) = n! ^ {n!}$$
The resulting values rise extremely quickly.
*Side note: This is entry [A046882](https://oeis.org/A046882) in the OEIS. Also related are the hyperfactorials, a still... |
[Question]
[
This is a Cops and Robbers challenge. This is the robber's thread. The [cop's thread is here](https://codegolf.stackexchange.com/q/188142/31716).
The cops will pick any sequence from the [OEIS](https://oeis.org/), and write a program **p** that prints the first integer from that sequence. They will als... |
[Question]
[
Consider an array `x` such as `[1 5 3 4]` and a number `n`, for example `2`. Write all length-`n` sliding subarrays: `[1 5]`, `[5 3]`, `[3 4]`. Let the *minimax* of the array be defined as the minimum of the maxima of the sliding blocks. So in this case it would be the minimum of `5, 5, 4`, which is `4... |
[Question]
[
Print the dates of all the Sundays in 2017 in the following format : `dd.mm.yyyy`.
Expected Output:
```
01.01.2017
08.01.2017
15.01.2017
22.01.2017
29.01.2017
05.02.2017
12.02.2017
19.02.2017
26.02.2017
05.03.2017
12.03.2017
19.03.2017
26.03.2017
02.04.2017
09.04.2017
16.04.2017
23.04.2017
30.04.2017... |
[Question]
[
A [triangular number](https://en.wikipedia.org/wiki/Triangular_number) is a number that is the sum of `n` natural numbers from 1 to `n`. For example `1 + 2 + 3 + 4 = 10` so `10` is a triangular number.
Given a positive integer (`0 < n <= 10000`) as input (can be taken as an integer, or as a string), re... |
[Question]
[
(*Inspired by [this challenge](https://codegolf.stackexchange.com/q/93005/31957)*.)
Let's say we have a string `ABBCBA`. We can say that there is a rise between `A` and `B`, for `B` follows `A`; we can say that there is a run between `B` and `B`, for nothing changes; and finally we can say there is a f... |
[Question]
[
This was inspired by [Print a Negative of your Code](https://codegolf.stackexchange.com/q/42017/29611) and [Golf a mutual quine](https://codegolf.stackexchange.com/q/2582/29611).
---
Consider a **rectangle** of characters, that meet the following restrictions:
1. Consists solely of [printable ASCII cha... |
[Question]
[
*This is my first question here, so any suggestions in the comments would be appreciated! Thanks ;)*
# Introduction
One very common strategy for the [2048 game](https://gabrielecirulli.github.io/2048/) is *never ever swiping down*. This positions all the big numbers at the top, and the lower ones in th... |
[Question]
[
### Introduction
Let's observe this array: `[3, 2, 4, 1, 1, 5, 1, 2]`.
Each element displays the length of the substring which must be summed up. Let's take a look at the first element of the above array:
```
[3, 2, 4, 1, 1, 5, 1, 2]
^
```
The element at the first index is **3**, so we now take a subs... |
[Question]
[
# Task
Your task is to convert strings like this:
```
abc^d+ef^g + hijk^l - M^NO^P (Ag^+)
```
To strings like this:
```
d g l N P +
abc +ef + hijk - M O (Ag )
```
Which is an approximation to abcd+efg + hijkl - MNOP (Ag+)
In words, raise the characters directly next to carets to the... |
[Question]
[
# Preface
In the well known carol, [The Twelve Days of Christmas](https://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)), the narrator is presented with several gifts each day. The song is *cumulative* - in each verse, a new gift is added, with a quantity one higher than the gift before it.... |
[Question]
[
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/58150/edit).
Closed 8 years ago.
[Improve this question](/p... |
[Question]
[
# Background
*Person of Interest* is a crime drama on CBS, and my favorite TV show, as of late.
The show is about a man named Harold Finch, a billionaire programmer, and his partner John Reese, a special forces veteran and ex-CIA operative. This programmer created a sentient AI called "The Machine" tha... |
[Question]
[
# What is the most frequent word?
Given a sentence, your program must make its way through it, counting the frequencies of each word, then output the most used word. Because a sentence has no fixed length, and so can get very long, your code must be as short as possible.
## Rules/Requirements
* Each su... |
[Question]
[
I have a simple challenge for you this time. Given an array of positive integers **A** (or the equivalent in your language), replace each entry **Ai** with the sum of the next **Ai** elements of **A**, cycling back from the beginning if there are not enough items.
As usual, you can compete in any [prog... |
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.