text stringlengths 180 608k |
|---|
[Question]
[
This code challenge will have you compute the number of ways to reach \$n\$ starting from \$2\$ using maps of the form \$x \mapsto x + x^j\$ (with \$j\$ a non-negative integer), and doing so in the minimum number of steps.
(Note, this is related to [OEIS sequence A307092](https://oeis.org/A307092).)
##... |
[Question]
[
Given a word consisting of lowercase letters only, do the following:
1. For each letter, get the prime factorization of its position in the alphabet.
2. For each prime factor, *p*, draw a diamond of side length *p* and stick the letter in the middle of the diamond.
3. The biggest diamond is in the midd... |
[Question]
[
You must use one language to write programs that perform the following nine tasks, **in any order you want**.
* Convert an inputted number from base 10 to base 36.
+ Sample input: `1000`
+ Sample output: `RS` (output must be upper case)
* Convert each character in a string to its base 10 decimal ASCI... |
[Question]
[
*This is a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge. Answer here if you are a cop (crossword maker), answer the [companion question](https://codegolf.stackexchange.com/q/40305/26997) if you are a robber (crossword solver). You may take ... |
[Question]
[
# Rolling a 1x1x2 block
This challenge is inspired by the game Bloxorz. Like that game, there is a 1x1x2 block, which may be moved on a square grid in any of the four cardinal directions. It moves by rotating 90 degrees about one of its edges which is touching the ground. Initially, the block is standi... |
[Question]
[
Programming Puzzles and Code Golf has graduated from beta. Soon we will get a custom site design, and with that the reputation boundaries for privileges will go up. A lot of users will lose privileges on the site. So your task is to write a program that tells us how much extra reputation we'll need to ... |
[Question]
[
The [one-dimensional version of this problem](https://codegolf.stackexchange.com/questions/2563/fill-in-the-lakes) was pretty easy, so here's a harder 2D version.
You are given a 2D array of land heights on standard input, and you have to figure out where the lakes will form when it rains. The height m... |
[Question]
[
## Input
An array that can contain arrays or positive, consecutive, ascending integers. The arrays can have any number of arrays inside of them, and so on and so forth. No arrays will be empty.
## Output
This array simplificated
## How to simplificate an array
We will use the array, `[1, [2, 3], [[4]],... |
[Question]
[
**Input:** You will be passed a string containing a single english word. All letters will be lowercase, and there will be no non-alphabetic characters in the string.
**Output:** You will return an integer from 1 to 7 representing how many syllables you think are in the word.
**Scoring:** Your program w... |
[Question]
[
## Background
You are a rich executive of a software empire. Your time is worth a lot of money. As such, you must always travel in the most efficient route possible. However, as an executive, you spend a lot of time participating in important phone calls. It is paramount that you never drop calls, so y... |
[Question]
[
### Definitions:
* A triangle is considered a ***right triangle*** if one of the inner angles is exactly 90 degrees.
* A number is considered ***rational*** if it can be represented by a ratio of integers, i.e., `p/q`, where both `p` and `q` are integers.
* A number `n` is a [***congruent number***](ht... |
[Question]
[
An addition chain is a sequence of integers starting with 1, where every integer other than the initial 1 is a sum of two previous integers.
For instance, here's an addition chain:
```
[1, 2, 3, 4, 7, 8, 16, 32, 39, 71]
```
Here are the sums that make it an addition chain:
```
1 + 1 = 2
1 + 2 = 3
1 + 3... |
[Question]
[
# Intro
Reverse and add is as simple as it sounds, take `n` and add it to its digits in reverse order. (e.g. 234 + 432 = 666).
If you apply this process repeatedly some numbers will eventually hit a prime number, and some will never reach a prime.
# Example
I currently have
11431 rep.
```
11431 is not... |
[Question]
[
This is a king of the hill challenge for Dots and Boxes (aka Pen the Pig). The game is simple, on your turn just draw a line on an empty fence. Every time you complete a square you get a point. Also, since we are playing by **championship rules**, if you complete at least one square on your turn you ge... |
[Question]
[
To mark the anniversary of [World IPv6 day](http://en.wikipedia.org/wiki/World_IPv6_Day_and_World_IPv6_Launch_Day), the Internet Society has published a campaign to [Turn Off IPv4 on 6 June 2014 for One Day](http://www.internetsociety.org/deploy360/blog/2013/12/campaign-turn-off-ipv4-on-6-june-2014-for... |
[Question]
[
The [Four fours puzzle](http://en.wikipedia.org/wiki/Four_fours) is a popular recreational mathematical puzzle that involves using exactly four 4s (and no other number) and a defined set of operations to reach every number from 0 to a given maximum.
In this version, the only following operators are all... |
[Question]
[
[SE Sandbox Link](https://codegolf.meta.stackexchange.com/a/20479/80214), [Codidact Sandbox Link](https://codegolf.codidact.com/articles/279223)
Inspired by [this video.](https://www.youtube.com/watch?v=9p55Qgt7Ciw&ab_channel=Numberphile)
Given a positive integer, draw its Cistercian representation as ... |
[Question]
[
What is a home prime?
For an example, take HP(4). First, find the prime factors. The prime factors of 4 (*in numerical order from least to greatest, always*) are 2, 2. Take those factors as a literal number. 2, 2 becomes 22. This process of factoring continues until you reach a prime number.
```
number... |
[Question]
[
# Generate me a QFP chip!
[From the sandbox!](http://meta.codegolf.stackexchange.com/a/10619/60951)
QFP is a type of form factor for an electrical component where pins come out the sides of a chip. Here are is a picture of a typical QFP component:
[. The initial post was separated per request by [Martin Ender](https://codegolf.stackexchange.com/questions/105258/generate-a-padovan-spiral#comment255895_105258)
## Introduction
... |
[Question]
[
Everyone knows that the news is boring. *Really boring*. Unless if it's about Politicians and their scandals. That is fun! But alas, Politicians can commit only so many scandals. So, I am employing you to make the news more interesting.
**Objective** Given an HTML snippet, perform all the substitutions... |
[Question]
[
# Challenge
You will be given an input string, anywhere the word `"Lemon"` is found it should be converted to `"Lemonade"` *but* the `a`, `d`, and `e` must be borrowed from somewhere else in the sentence.
---
# Example
Example Input:
>
> I found a **lemon** when I was a kid
>
>
>
Example Output:
... |
[Question]
[
Find the max number of Xs you can fit onto a rectangular tic-tac-toe board of length *l* and height *h* without ever having 3 consecutive Xs in a row **diagonally**, horizontally, or vertically.
This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") challenge so shortest... |
[Question]
[
Can you imagine solving the New York Times crossword puzzle without any clues? Maybe not with all of the creativity and new words and phrases appearing in modern crosswords, but with a fixed word list there's some hope. In this challenge, you create a crossword puzzle grid in which this is theoreticall... |
[Question]
[
You are going to participate in a gameshow. One of the challenges works as follows:
* The first room contains a large number of identical balls.
* The second room contains a series of chutes, each of which has a sensor which counts how many balls have been placed in it. A ball which is placed in a chut... |
[Question]
[
You mission today is to invent a text compressor.
# Task
You'll write two functions:
* The **packer** is a function that accepts a string of ASCII characters (U+0000 to U+007F) and outputs a Unicode string (U+0000 to U+10FFFF), containing the fewest characters possible.
* The **unpacker** is a function... |
[Question]
[
I'm building a giant lego robot and I need to generate some particular gear ratios using a set of gears. I have lots of gears with the common lego gear sizes: 8, 16, 24, or 40 teeth. Write a program I can use where I input a gearing ratio and the program tells me what combination of gears I should use ... |
[Question]
[
## The picture:
[](https://i.stack.imgur.com/n1TkD.png)
Sick of the same old grid where the answer is simply a square pyramidal number?
Accept the challenge and write a program that given a positive integer \$n\$ co... |
[Question]
[
The J language has a [very silly syntax for specifying constants](http://www.jsoftware.com/help/dictionary/dcons.htm). I want to focus on one cool feature in particular: the ability to write in arbitrary bases.
If you write `XbY` for `X` any number and `Y` any string of alphanumerics, then J will inter... |
[Question]
[
This challenge is related to [Flipping Pancakes](https://codegolf.stackexchange.com/questions/12028/flipping-pancakes).
You may have heard of [pancake sorting](https://en.wikipedia.org/wiki/Pancake_sorting), where a stack of pancakes is sorted by size by inserting spatula into the stack and flipping al... |
[Question]
[
Given a pattern of squares on a grid, determine if it is possible to create that pattern with non-overlapping dominoes. In case you are not familiar, a domino is a rectangular shape created by joining exactly two squares at their edges.
## Examples
For the pattern on the left, `O` represents an occupie... |
[Question]
[
This is a [fewest-operations](/questions/tagged/fewest-operations "show questions tagged 'fewest-operations'") challenge where the objective is to sort a vector into ascending order using the fewest reversals. Your algorithm can only sort the vector using "sub-vector reversals"1, but it can use other o... |
[Question]
[
Write a program or function that takes a mathematical expression in Morse code as input, and returns the solution in Morse code.
Valid operations are plus: `+` and minus: `_` (underscore). You can assume you will only receive non-negative integer input, and that the result will be non-negative.
The ex... |
[Question]
[
First, some terminology ([source](https://en.wikipedia.org/wiki/Roof#/media/File:Roof_diagram.jpg)):
* A [hip roof](https://en.wikipedia.org/wiki/Hip_roof) is (quoting Wikipedia) "a type of roof where all sides slope downwards to the walls, usually with a fairly gentle slope"
* A slope is a planar surf... |
[Question]
[
Have a look at this ascii art diagram of various boxes:
```
+--------------------------------------------------------------+
| |
| +-------------------------------+ +-------+ |
| | | |... |
[Question]
[
Write the shortest program to turn any piece of ASCII art into an animated snow scene that begins to form from the falling snow (**[non-golfed JavaScript example](http://jsfiddle.net/plstand/GD2Dk/)** last updated 2011-12-19).
**Input specification**:
Your program must accept arbitrary combinations of ... |
[Question]
[
**This question already has answers here**:
[Visualize long addition with ASCII art](/questions/74127/visualize-long-addition-with-ascii-art)
(4 answers)
Closed 7 years ago.
Everyone knows how to add numbers by hand, right?––Well, I hope so, but for anyone who needs a quick reminder:
To add `172... |
[Question]
[
## The task
The [credit rating agencies](https://en.wikipedia.org/wiki/Credit_rating_agency) assign ratings to bonds according to the credit-worthiness of the issuer, and the "Big Three" credit rating agencies use a similar (though not identical) [tiered rating system](https://en.wikipedia.org/wiki/Bon... |
[Question]
[
>
> OH GODS NO!! You can't leave us here with Doorknob! It'll be nethack everywhere! - [1d ago](http://chat.stackexchange.com/transcript/message/22533239#22533239) by [Geobits](http://chat.stackexchange.com/users/51024/geobits)
>
>
>
Well, couldn't disappoint...
## Introduction
*(you can skip this ... |
[Question]
[
I'm a time traveler, and I'm obsessed with the passage of time. I particularly love the moments when the clock hands pass 12, or when I get to flip to the next page of my calendar, or when everyone yells "Happy New Year!"
Please write for me a program to show me how far I am from the last such moment t... |
[Question]
[
You should write a program or function which receives a block of chars represented as a string and outputs or returns a similar string in which the letters adjacent in the alphabet are connected.
A visual example (in the form of `input => output`):
```
b d b d
... |
[Question]
[
## Task
You will be given a set of circles in the plane with their centers on the line **y=0**. It is guaranteed that no pair of circles has more than one common point.
Your task is to determine into how many regions into which the circles divide the plane. A region is an inclusion-maximal contiguous s... |
[Question]
[
This challenge is brought to you by real (and tragic) inspiration. Recently, the number row on my keyboard has been a bit sporadic. The keys `1-9` work sometimes--but other times they have no result. As an avid programmer, this is horrible! (See that exclamation point? That's how you know they're worki... |
[Question]
[
The [Collatz Sequence](https://en.wikipedia.org/wiki/Collatz_conjecture) (also called the 3x + 1 problem) is where you start with any positive integer, for this example we will use 10, and apply this set of steps to it:
```
if n is even:
Divide it by 2
if n is odd:
Multiply it by 3 and add 1
re... |
[Question]
[
# Roguelike pathfinding
Your task will be, given a two-dimensional array of the elements described below, which represents a dungeon, to output or return a single number representing the amount of gold pieces the rogue can collect without waking up any monsters.
The elements of the array are as follows... |
[Question]
[
## Introduction
Every rational number between 0 and 1 can be represented as an eventually periodic sequence of bits.
For example, the binary representation of 11/40 is
```
0.010 0011 0011 0011 ...
```
where the `0011` part repeats indefinitely.
One way of finding this representation is the following.
S... |
[Question]
[
Write a program or function that takes in three integers, a width `w`, a height `h`, and a step count `s`. You will be drawing a non-self-intersecting [random walk](https://en.wikipedia.org/wiki/Random_walk) `s` steps long on a `5*w` by `5*h` pixel image where every 5 by 5 pixel cell is either empty (p... |
[Question]
[
The goal of this challenge is to write a **program** that visualizes a dependency graph in the form of a tree.
While "dependency graph" in this context means nothing more than a directed graph, the visualization method described here works best for graphs describing some dependency relation (as an exer... |
[Question]
[
# The Challenge:
Given any input that can be typed on a keyboard, move the text along by N chars.
Here is the QWERTY keyboard to be used. You can ignore the modifier keys (Shift, Caps, Enter, Delete and Tab). Once you reach one side (for example `|`) loop back round, so `|` goes to `Q` if `N = 1`.
![en... |
[Question]
[
I have bunch of hexagonal rods glued together into an odd sculpture. The rods
are 1 to 99 centimetres (cm) long and 1 square cm in cross-section area. All
rods are glued on a hexagonal face to at least one other rod. The rods are all
aligned at their bottom edge.
After some heavy rain, the sculpture is... |
[Question]
[
Your boss has recently learned of this interesting programming language called [English](http://esolangs.org/wiki/English). He has had this "revolutionary" idea, he wants to code with you to double code production rates! Since he is not a tech savvy, he wants you to write a compiler for it so that he c... |
[Question]
[
When you hammer a set of nails into a wooden board and wrap a rubber band around them, you get a [Convex Hull](http://en.wikipedia.org/wiki/Convex_hull).

Your mission, should you decide to accept it, is to find the [Convex Hull](http:... |
[Question]
[
Sometimes authors will write `(s)he` as a stand in for `she` or `he` and for some reason they don't want to use singular they. This is ok for the nominative but doesn't work so well when you want to write "her or him". You can write `h(er)(im)` which covers both cases but gives two extra "pronouns"
```... |
[Question]
[
## Information
Create a diagonal line given its length (let’s call the variable, say, \$n\$ where \$n > 0\$)
* The diagonal line starts from the top left and goes to the bottom right.
* You **must** use the ASCII character `\` for the line.
* The input number can be given from STDIN or if your program ... |
[Question]
[
It's time for CGCC to demonstrate our musical talent! In this challenge, you're going to compose songs while keeping your byte count as small as possible.
On Day 0, multiple answerers will post a function or program that outputs nothing/an empty string. They will also give a single line that next day's... |
[Question]
[
Your task is to write a program which given an array and a number, you need to split the array into chunks with size is number.
## Rules
Your program will receive an array `A` , as well as a positive integer `n`. The array should then be split into chunks of length `n`, if the length of the string isn'... |
[Question]
[
Let’s take a positive integer such as `123`. We define the shifted auto-sum of this integer as follows:
* 123 has 3 digits. We thus consider 3 copies of 123.
* We stack each copy on top of each other, shifted by 1 digit each time:
```
123
123
123
```
* We pad each copy with `0`s (excluding the las... |
[Question]
[
## Challenge:
The challenge is to determine whether or not a color, given it's name, is one of the colors in the rainbow.
When supplied with a color, your program should output a truthy value if it is a color in the rainbow, and a falsy one otherwise.
## Rules:
1. The possible input options are exhaust... |
[Question]
[
1. Your program should output exactly: `Hello world!!!` with or without linefeed after.
2. Your program should take no input.
3. Sourcecode character distribution must be correct according to:
* The number of **numeric characters** (0-9) must be exactly one fibonacci sequence number.
* The number of ... |
[Question]
[
Given a number n, find x such that x! = n, where both x and n are positive integers. Assume the input n will always be the factorial of a positive integer, so something like n=23 will not be given as input.
Examples: `n=1 -> x=1` (0 is not a positive integer), `n=24 -> x=4`
Shortest code wins.
[An... |
[Question]
[
You will receive an array and must return the number of integers that occur more than once.
```
[234, 2, 12, 234, 5, 10, 1000, 2, 99, 234]
```
This will return 2, since each of `234` and `2` appear more than once.
```
[234, 2, 12, 234]
[2, 12, 234, 5, 10, 1000, 2]
```
The list will never be more than ... |
[Question]
[
# Introduction
I have decided that this Christmas, as a "present" to a friend, I wish to purchase the things described in the classic song "The 12 Days of Christmas". The only problem is, I don't know how to calculate the total price!
# Your Task
Given a list of prices (in order from first to last), ca... |
[Question]
[
As most of you probably know, (byte-addressable) hardware memories can be divided into two categories - *little-endian* and *big-endian*. In little-endian memories the bytes are numbered starting with 0 at the little (least significant) end and in big-endian ones the other way round.
**Fun fact**: Thes... |
[Question]
[
I'm reproducing the second part of the first day of Advent of Code, with [permission from the creator.](https://twitter.com/ericwastl/status/699455417768923137)
Santa is trying to deliver presents in a large apartment building, but he can't find the right floor - the directions he got are a little conf... |
[Question]
[
Continued fractions are expressions that describe fractions iteratively. They can be represented graphically:
$$
a\_0 +\cfrac 1
{a\_1 + \cfrac 1
{a\_2 + \cfrac 1
{\ddots + \cfrac 1
{a\_n}
}
}
}
$$
Or they can be represented as a list of values: \$[a\_0 ; a\_1, a\_2, \dots, a\_n]\$
### The chall... |
[Question]
[
>
> This was one of a series of challenges leading up to Brain-Flak's birthday. Find out more [here](https://hackmd.io/KwRgnARiAcCGAsBaaEBMAGR8DG8Cmis0AZsVhPLOtsWAOzQAmIQA?view).
>
>
>
# Challenge
For this challenge your objective will be to find the very first pair of matching brackets in a fully ... |
[Question]
[
# ...counted!
You will pass your program a variable which represents a quantity of money in dollars and/or cents and an array of coin values. Your challenge is to output the number of possible combinations of the given array of coin values that would add up to the amount passed to the code. If it is no... |
[Question]
[
What I'd like to see is your attempts at writing a kind of "story" that has a fairly easy to read meaning, but also creating a valid code fragment. For example, this (BBC) BASIC code:
```
LET customer = "sober"
REPEAT
INPUT "more beer"
UNTIL customer = "drunk"
```
(based on <http://img.rakuten.com/PI... |
[Question]
[
Your task is pretty simple. Given two floats, bitwise xor the binary representation of them, and output that as a float.
For example,
```
Normal: 16.7472 ^ 123.61 = 7.13402e-37
Binary: 01000001100001011111101001000100 ^ 01000010111101110011100001010010 = 00000011011100101100001000010110
Normal: 2.2 ^ 4... |
[Question]
[
Your task is to turn a square root like this:
```
√12
```
into a form like this:
```
2√3
```
For our purpose, we only need to output the left number here:
```
2
```
## Test cases
```
4 -> 2
9 -> 3
12 -> 2
13 -> 1
108-> 6
```
## Specifications
* You may assume for the input that \$n>0\$. \$n\$ has to ... |
[Question]
[
Making a [versatile integer printer](https://codegolf.stackexchange.com/questions/65641/the-versatile-integer-printer) is nice and all, but writing a single code that prints a lot of different numbers is cumbersome. Wouldn't it be easier to make a script that outputs a number, but also gives you a new ... |
[Question]
[
# Task
Given a string composed of ASCII printable characters, return how many strings could fit the given pattern with character literals and regex-like ranges.
# Pattern string
The pattern string follows this grammar (the | means an option and the \* means 0 or more occurrences of whatever was immedia... |
[Question]
[
Given a string of text, output it as a 'tower'.
Each slice of the string (of the form `0:n`) is repeated `5*n` times, so the first character is repeated 5 times, then the first and the second 10 times, etc.
### Examples:
```
'hello' ->
['h']
['h']
['h']
['h']
['h']
['h', 'e']
['h', 'e']
... |
[Question]
[
This is a code golf version of a similar question [I asked on stack earlier](https://stackoverflow.com/questions/51492374/get-the-point-where-the-replace-occurred-in-a-replace#51493248) but thought it'd be an interesting puzzle.
Given a string of length 10 which represents a base 36 number, increment i... |
[Question]
[
Read two strings from `stdin`.
Output `Yes` if one string is a rotated version of the other.
Otherwise output `No`
**Testcases**
Input
```
CodeGolf GolfCode
```
Output
```
Yes
```
Input
```
stackexchange changestackex
```
Output
```
Yes
```
Input
```
stackexchange changestack
```
Output
```
No
```
... |
[Question]
[
# Problem:
Your task is to write a program that takes as input a height (in meters) and weight (in kilograms), and outputs the corresponding BMI category.
[BMI](https://en.wikipedia.org/wiki/Body_mass_index) is a measure of the ratio of your weight to your height. [It's dated and inaccurate for many pe... |
[Question]
[
Given a string \$ x \$, we say another string \$ y \$ is half of it, if both of the following properties are true:
* \$ y \$ is a (not necessarily continuous) subsequence of \$ x \$ - there exists a strictly increasing sequence \$ a\_i \$ such that \$ y\_i = x\_{a\_i} \$
* Each character appears in \$ ... |
[Question]
[
## Context
After attempting to program in [Grass](https://esolangs.org/wiki/Grass) for the entire morning, you decide to go outside and mow some *real* grass. The grass can be viewed as a string consisting exclusively of the following characters: `wWv`. `w` denotes tall grass which takes \$ 1 \$ unit o... |
[Question]
[
ùñßello all, I hope this finds you well.
There are 118 elements on the Periodic table at the moment, each one corresponds to the number of protons in an atom's nuclei.
Each element also has a 'symbol'. Hydrogen has 'H', Helium has 'He' and so on. I want to know about these!
### Challenge:
Given 1 stri... |
[Question]
[
### Introduction:
Two resistors, `R1` and `R2`, in parallel (denoted `R1 || R2`) have a combined resistance `Rp` given as:
$$R\_{P\_2} = \frac{R\_1\cdot R\_2}{R\_1+R\_2}$$
or as suggested in comments:
$$R\_{P\_2} = \frac{1}{\frac{1}{R\_1} + \frac{1}{R\_2}}$$
Three resistors, `R1`, `R2` and `R3` in para... |
[Question]
[
## Goal:
Create a program to find the smallest file in the current folder.
* File size may be measured in bytes or characters.
* If multiple files have the same size, you can either choose one or display all of them.
* You can assume there will be at least one file in the folder, and no files will have... |
[Question]
[
The challenge today is very simple. The task is to determine the TI calculator for which the submitted datafile was made.
The datafiles always start with a string `**TI`, the version (described below), and other data you can ignore.
Now, the versions you need to recognize are:
```
95* => TI-95
92P => T... |
[Question]
[
Here's a very simple little problem that I don't believe has been asked before.
# Challenge
Write a program or a function that takes in four positive integers that represents the lengths of movable but unbreakable and unbendable straight fences. Output the area of the largest rectangular yard that can ... |
[Question]
[
This is the robber's thread. The [cop's thread is here](https://codegolf.stackexchange.com/questions/112299/cops-crack-the-regex-make-a-snake).
---
A snake matrix is a square matrix that follows this pattern:
3-by-3:
```
1 2 3
6 5 4
7 8 9
```
and 4-by-4:
```
1 2 3 4
8 7 6 5
9 10 11 12
16 1... |
[Question]
[
The **Sixers sequence** is a name that can be given to sequence [A087409](http://oeis.org/A087409). I learned about this sequence in a [Numberphile video](https://youtu.be/OeGSQggDkxI?t=114), and it can be constructed as follows:
First, take the multiples of 6, written in base 10:
`6, 12, 18, 24, 30, 3... |
[Question]
[
Here the first 100 numbers of an easy sequence:
```
0,1,0,2,1,4,3,7,6,11,10,16,15,22,21,29,28,37,36,46,45,56,55,67,66,79,78,92,91,106,105,121,120,137,136,154,153,172,171,191,190,211,210,232,231,254,253,277,276,301,300,326,325,352,351,379,378,407,406,436,435,466,465,497,496,529,528,562,561,596,595,631,6... |
[Question]
[
# The magic music box (MMB)
*This explains the motivation for the challenge, feel free to ignore.*
The magic music box is a word game played by a group of people, where one is the owner of the magic music box and the other people are trying to put words inside the magic music box.
Rules for the game wi... |
[Question]
[
Given a string containing a sequence of ascending consecutive positive integers, but with no separators (such as `7891011`), output a list of the separated integers. For that example, the output should be `[7, 8, 9, 10, 11]`.
To disambiguate the possible outputs, we add the restriction that the output ... |
[Question]
[
Write a function that takes in a string and for each character, returns the distance to the nearest vowel in the string. If the character is a vowel itself, return 0.
Vowels are : `aeiouAEIOU`
For the purposes of this challenge, `y` is not a vowel.
The input will be a string consisting of uppercase and... |
[Question]
[
Write a quine which attempts to invert the case of as many ascii characters in the source code as possible. For example in javascript:
```
(x=function(y){return ('(x='+y+')(x)').toUpperCase();})(x)
```
* Standard quine rules apply.
* The score is given by *number of bytes in the source code* - *number ... |
[Question]
[
### Input:
An integer
### Output:
Sum of the input itself + the length of the input + each individual digit of the input.
```
nr + nr-length + {sum of digits} = output
```
### Examples:
Input: `99`
Output: `99` (nr) `+ 2` (nr-length) `+ (9 + 9)` (digits) → `119`
Input: `123`
Output: `123 + 3 + (1 +... |
[Question]
[
# Challenge :
Count the number of ones `1` in the binary representation of all number between a range.
---
# Input :
Two non-decimal positive integers
---
# Output :
The sum of all the `1`s in the range between the two numbers.
---
# Example :
```
4 , 7 ---> 8
4 = 100 (adds one) = 1
5 = 101 ... |
[Question]
[
Given a string as input, output the string with the following algorithm applied:
```
1. Split the String by " " (find the words): "Hello World" -> ["Hello","World"]
2. Find the vowel count of each component: [2,1] ( ["H[e]ll[o]","W[o]rld"] )
3. For each of the components, output the first n letter wh... |
[Question]
[
**This question already has answers here**:
[Composite Number Sequences](/questions/57264/composite-number-sequences)
(17 answers)
[List of first n prime numbers most efficiently and in shortest code [closed]](/questions/6309/list-of-first-n-prime-numbers-most-efficiently-and-in-shortest-code)
... |
[Question]
[
The [Torian](https://googology.wikia.org/wiki/Torian), \$x!x\$, of a non-negative integer \$x\$ can be recursively defined as
$$
x!0 = x \\
x!n = \prod^x\_{i=1} i!(n-1) = 1!(n-1) \times 2!(n-1) \times \cdots \times x!(n-1)
$$
The Torian is then equal to \$x!x\$ for a given \$x\$. This sequence begins \... |
[Question]
[
Given a standard combination lock like the one in the picture. The way to unlock it is to align the 4 numbers in the code on the combination line. After years of loyal service you have been fired from the lock factory and have decided to exact revenge by not jumbling up the locks before you send them o... |
[Question]
[
Given a string `S` and a list of indices `X`, modify `S` by removing the element at each index of `S` while using that result as the new value of `S`.
For example, given `S = 'codegolf'` and `X = [1, 4, 4, 0, 2]`,
```
0 1 2 3 4 5 6 7 |
c o d e g o l f | Remove 1
c d e g o l f | Remove 4
c d e g ... |
[Question]
[
Write the shortest program possible such that when you combine the first character and every Nth character after it into a new program, the output is N. This must work for N = 1, 2, ..., 16.
Another way to say it is, if you *remove* all the characters from your program *except for* the first one and ev... |
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.