text stringlengths 180 608k |
|---|
[Question]
[
Output this exact text:
```
1 i
12 hi
123 ghi
1234 fghi
12345 efghi
123456 defghi
1234567 cdefghi
12345678 bcdefghi
123456789abcdefghi
12345678 bcdefghi
1234567 cdefghi
123456 defghi
12345 efghi
1234 fghi
123 ... |
[Question]
[
Inspired by Silicon Valley's "three-comma club" scenes, like [this one](https://www.youtube.com/watch?v=rIB5HEcZBs8), in this challenge you'll be telling ten people the "comma club" to which they each belong.
If you're unfamiliar with the term "comma club," let me explain: you're in the one-comma club ... |
[Question]
[
You are given a string. Output the string with one space per words.
# Challenge
Input will be a string (not `null` or empty), surrounded with quotes(`"`) sent via the `stdin`. Remove leading and trailing spaces from it. Also, if there are more than one space between two words (or symbols or whatever), ... |
[Question]
[
A [\$k\$-hyperperfect number](https://en.wikipedia.org/wiki/Hyperperfect_number) is a natural number \$n \ge 1\$ such that
$$n = 1 + k(\sigma(n) − n − 1)$$
where [\$\sigma(n)\$](https://en.wikipedia.org/wiki/Divisor_function) is the sum of the divisors of \$n\$. Note that \$\sigma(n) - n\$ is the [prop... |
[Question]
[
## Rövarspråket
[Rövarspråket](http://en.wikipedia.org/wiki/R%C3%B6varspr%C3%A5ket) is a word game played by Swedish children, from the books about Kalle Blomkvist by Astrid Lindgren.
The basic rules are as follows (from Wikipedia):
* Every consonant (spelling matters, not pronunciation) is doubled, an... |
[Question]
[
Your task is to implement a floor function in as few bytes as possible.
A floor function is a function that takes a real number and returns the largest integer less than or equal to the input.
Your program should support both positive and negative inputs. Since it is provably impossible to support all ... |
[Question]
[
Write a program that groups a string into parentheses cluster. Each cluster should be balanced.
### Examples :
```
split("((())d)") ➞ ["((()))"]
split("(h(e(l)l)o)(w(o)r)l(d)(w)h(a(t)(s)u)p") ➞ ["((()))", "(())", "()", "()", "(()())"]
split("((())())(()(()()))") ➞ ["((())())", "(()(()()))"]
```
Input m... |
[Question]
[
In the alternating Fibonacci sequence, you first start with `1` and `1` as usual.
However, instead of always adding the last two values to get the next number, you alternate starting with adding, and every other time you subtract instead.
The sequence starts like this:
```
1
1
2 # 1 + 1
-1 # 1 - 2... |
[Question]
[
**This question already has answers here**:
[Incrementing Numbers, Over Multiple Sessions](/questions/11056/incrementing-numbers-over-multiple-sessions)
(23 answers)
Closed 7 years ago.
In a programming language of your choice, write a full program that, when run, prints a positive integer N and... |
[Question]
[
## Background
The number 1729 is the Hardy-Ramanujan number. An amazing property of it was discovered by S. Ramanujan (who is widely regarded as the greatest Indian mathematician1), when G.H. Hardy paid a visit to him in a hospital. In Hardy's own words:
>
> I remember once going to see him when he wa... |
[Question]
[
Inspired by the recent craze over another two character language, [`;#`](https://codegolf.stackexchange.com/questions/121921/make-a-interpreter)
**Intro**
According to [community consensus](https://codegolf.meta.stackexchange.com/questions/2028/what-are-programming-languages/2073#2073), acceptable answ... |
[Question]
[
## Explanation
A perfect shuffle is where a deck of cards is split exactly in half and the cards from each pile are alternately interleaved. The original bottom cards and the original top card must be preserved after a perfect shuffle.
After 8 perfect shuffles, a standard 52 card deck returns to its or... |
[Question]
[
---
The scenario: You are a software designer working for a gov't-run company that designs license plates for cars and other vehicles. You've been asked to develop software that generates license plates. Before you got to work, your bosses laid down these ground rules.
---
# A license plate cannot cont... |
[Question]
[
Given an array of letters in the range 'a' to 'o', compute how to construct the array by successively inserting the letters in alphabetical order. You will always start the insertion with a base array of all the 'o's that are in the array to be reconstructed.
# Examples
Let the input array be:
```
['o'... |
[Question]
[
Given a base as input, output all pan-digital numbers. A number is pan-digital if it includes every digit in that base at least once, possibly multiple times. Every number is considered to contain an infinite number of leading 0s.
[sequence](/questions/tagged/sequence "show questions tagged 'sequence'"... |
[Question]
[
## Introduction:
*I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard) and transformed them into challenges. Most of them are still in the sandbox, and I'm not sure yet... |
[Question]
[
We've all seen the signs on motels telling us if there's a vacancy or not:

Typically, these will permanently have the letters of **VACANCY** lit up, and have the letters of **NO** lit up if there isn't any room in the motel.
# The challenge
The average motel in ... |
[Question]
[
Believe it or not, the [Sex Bob-ombs](http://scottpilgrim.wikia.com/wiki/Sex_Bob-omb) have become a world famous band and are currently on world tour! As their [bookkeeper](http://en.wikipedia.org/wiki/Bookkeeping) you must oversee their day to day finances and provide regular reports.
Every few weeks ... |
[Question]
[
# Objective
You are to write a program that receives an integer `n` as input (from the command line), and embeds itself (the program) `n` directories down the directory tree. Example with `n=5`:

The folder names may be whatever you wish. The on... |
[Question]
[
We define \$R\_n\$ as the list of remainders of the Euclidean division of \$n\$ by \$2\$, \$3\$, \$5\$ and \$7\$.
Given an integer \$n\ge0\$, you have to figure out if there exists an integer \$0<k<210\$ such that \$R\_{n+k}\$ is a permutation of \$R\_n\$.
## Examples
The criterion is met for \$n=8\$, ... |
[Question]
[
>
> based off my previous challenge, [this](https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80) wikipedia article, and a Scratch project
>
>
>
Your task: given `i`, calculate \$\pi\$ till `i` terms of the Gregory-Leibniz series.
The series:
$$\pi=\frac{4}{1}-\frac{4}{3}+\frac{4}{5}-\frac{4}{7... |
[Question]
[
In my [previous bioinformatics challenge](https://codegolf.stackexchange.com/questions/194297/mutate-my-dna-sequence), I asked you to mutate a DNA sequence. This time, I'd like you to evaluate how likely a mutation, or a series of mutations, is.
The two types of substitutions are [transitions and trans... |
[Question]
[
Given one line that consists of only letters, process as following:
* You maintain a string that's empty at the beginning.
* If the next input character is in the string, remove it from the string.
* If the next input character isn't in the string, append it to the string.
Output the final state of the... |
[Question]
[
In probability theory, a Bernoulli variable is a random variable which has a single parameter \$p\$, and is equal to 1 with probability \$p\$, and 0 with probability \$1-p\$.
In this challenge, there are a bunch of independent Bernoulli variables with parameters \$p\_1, p\_2, ... , p\_n\$, and their XO... |
[Question]
[
# AND THE WINNER IS....
>
> Command Master's "Ball Pulling"!
>
>
>
Note: Competition is over, but more submissions are welcome!
Ball game is a game I invented where two players start with 100 energy each. Every turn, each player independently chooses an amount of energy to spend. Whoever spends mo... |
[Question]
[
## Introduction:
Inspired by [the Puzzling-stackexchange post with the same name](https://puzzling.stackexchange.com/q/31679/13190), which I've answered four years ago:
>
> Can you create a perfectly valid English sentence, which makes perfect sense, but which contains the word "**and**" in it, five t... |
[Question]
[
## Generator functions
*This gives the context for why this challenge came to life. Feel free to ignore.*
Generator functions are a nice way of encoding the solution to a problem of combinatorics. You just write some polynomials, multiply them and then your solution is the coefficient of one of the ter... |
[Question]
[
The unique-disjointness matrix ( UDISJ(n) ) is a matrix on all pairs of subsets of `{1...,n}` with entries $$ U\_{(A,B)}=\begin{cases}
0, ~ if ~ |A\cap B|=1\\
1, ~ otherwise
\end{cases} $$
Or a bit less mathematical, it is the 2n times 2n matrix with a `0` in all entries where both indices have exactly... |
[Question]
[
Given a list of the integers from \$1\$ to some \$n\$, give the minimum number of adjacent swaps required to put the list in ascending order.
You will receive a list as input and should output a non-negative integer. You may if you wish choose to expect a list of the integers from \$0\$ to \$n\$ instea... |
[Question]
[
You probably all know the [7-segment display](https://en.wikipedia.org/wiki/Seven-segment_display) which can display among other things all digits from \$0\dots 9\$:
[](https://i.stack.imgur.com/Dcp8o.png)
# Challenge
We only cons... |
[Question]
[
## Background
It's well known in mathematics that integers can be put into a one-to-one correspondence with pairs of integers.
There are many possible ways of doing this, and in this challenge, you'll implement one of them *and* its inverse operation.
## The task
Your input is a positive integer `n > 0... |
[Question]
[
I use "suffix" loosely here to mean "any sub-string that follows the prefix".
"Prefix" here means the START of a word, where a word's start is defined as either after a space or from the first character of the input text (for the first word). A "prefix" in the middle of a word is ignored.
E.g. if your ... |
[Question]
[
Inspired by a real-life scenario, which I have asked for an answer to here: <https://superuser.com/questions/1312212/writing-a-formula-to-count-how-many-times-each-date-appears-in-a-set-of-date-ran>
Given an array of timespans (or startdate-enddate pairs), output a count of how many timespans cover eac... |
[Question]
[
### Introduction
As an example, let's take the number `7`. We then duplicate this and place 7 spaces in between. We get this:
```
7_______7
```
After that, we are going to decrease the number, until there are no spaces left. We get the following for the number 7:
```
7_______7
6543210
```
Then, we... |
[Question]
[
Write a program or function that outputs/returns the first 10000 prime-indexed prime numbers.
If we call the nth prime `p(n)`, this list is
```
3, 5, 11, 17, 31, 41, 59 ... 1366661
```
because
```
p(p(1)) = p(2) = 3
p(p(2)) = p(3) = 5
p(p(3)) = p(5) = 11
p(p(4)) = p(7) = 17
...
p(p(10000)) = p(104729)... |
[Question]
[
This was inspired by [Apply gravity to this matrix](https://codegolf.stackexchange.com/questions/235493/apply-gravity-to-this-matrix)
Your challenge is to input a matrix with non-negative one-digit integers and drop down the 1's down 1 column, the 2's down 2 columns, the 3's down 3 columns, and so on. ... |
[Question]
[
from [Wikipedia](https://en.wikipedia.org/wiki/Smooth_number#Powersmooth_numbers), a number is called B-powersmooth if all prime powers \$p^v\$ that divide the number satisfy \$p^v \leq B\$. B-powersmoothness is important, for example, for Pollard's p-1 factorization algorithm.
## Task
your task is to ... |
[Question]
[
As it turns out, Python allows for `1j for` to be [compressed](https://codegolf.stackexchange.com/a/207126/68261) to `1jfor`. However, `jfor` sounds like `xnor`. Since all similar-phonic phrases have *something* in common, there must be some property shared between `jfor` and `xnor`.
If we look at the ... |
[Question]
[
Given an input of a single positive integer, output the "cross-alternate sum"
that corresponds to that integer.
Take the example of the input `n=5`. To find the cross-alternate sum, first
create a square grid of width and height `n` that, reading from left to right
and top to bottom, starts at `1` and ... |
[Question]
[
Given as input a list of positive integers, your task is to determine if every integer present has exactly two neighbors in the list. The neighbors of a integer \$x\$ are the distinct integers that appear next to an \$x\$ anywhere in the list. For example in the list:
```
[1,3,4,4,3,2,1]
```
The number... |
[Question]
[
# Objective
Given a string with single Unicode vulgar fraction, parse it to a rational number.
# Valid inputs
A valid input is one of:
* `¼` U+00BC; one quarter
* `½` U+00BD; one half
* `¾` U+00BE; three quarters
* `⅐` U+2150; one seventh
* `⅑` U+2151; one ninth
* `⅒` U+2152; one tenth
* `⅓` U+2153; on... |
[Question]
[
In [set theory](https://en.wikipedia.org/wiki/Set_theory), a set is an unordered group of unique elements. A pure set is either the empty set \$\{\}\$ or a set containing only pure sets, like \$\{\{\},\{\{\}\}\}\$.
Your challenge is to write a program that enumerates all pure sets, in some order of you... |
[Question]
[
The aim is to trim elements in from the ends of a list, depending on if they are in a second list of "falsey" results.
For example, if the first list is `[-1, 1, 2, 0, -1, 3, -1, 4, -1, -1]` and the second is `[-1]`, then we would remove all leading and trailing `-1`s from the first input, but not any ... |
[Question]
[
A donut distribution (for lack of a better term) is a random distribution of points in a 2-dimensional plane, forming a donut-like shape. The distribution is defined by two parameters: the radius `r` and spread `s`, in which the distance to the origin follows a normal (Gaussian) distribution around `r`... |
[Question]
[
## Description
Your input is a list of integers \$[a\_1, \dots, a\_n]\$.
A **magic triplet** is a triplet \$(a\_i, a\_j, a\_k)\$ of values from this list, such that
* the indices \$\{i, j, k\}\$ are all distinct,
* the values are in ascending order (\$a\_i \leq a\_j \leq a\_k\$), and
* the sum of two o... |
[Question]
[
In Elixir, (linked) lists are in the format `[head | tail]` where **head** can be anything and **tail** is a list of the rest of the list, and `[]` - the empty list - is the only exception to this.
Lists can also be written like `[1, 2, 3]` which is equivalent to `[1 | [2 | [3 | []]]]`
Your task is to ... |
[Question]
[
**Inputs:**
Two single digits (let's call them `m` and `n`) and two chars (let's call them `a` and `b`) in your input format of choice.
**Output:**
For the walkthrough, pretend `m=2, n=5, a='a', b='b'`.
Your output will be a string built from your four inputs. Let's call the string `result`, with value... |
[Question]
[
The **[Fibonacci word](https://en.wikipedia.org/wiki/Fibonacci_word)** is a sequence of binary strings defined as:
* \$F\_0 = \$ `0`
* \$F\_1 = \$ `01`
* \$F\_n = F\_{n-1} F\_{n-2}\$
The first few Fibonacci words are:
```
0
01
010
01001
01001010
0100101001001
010010100100101001010
...
```
Each of these... |
[Question]
[
aka. implement an easier version of [05ab1e's canvas element](https://codegolf.stackexchange.com/questions/96361/tips-for-golfing-in-05ab1e/175520#175520).
# Description
The canvas element is used to draw ASCII lines on the screen.
The (easier version of the) canvas element takes a list of integers a... |
[Question]
[
Common words should still be avoided to be used as passwords. This challenge is about coding a very simple program that munges a given password (**M**odify **U**ntil **N**ot **G**uessed **E**asily).
**Input**
A word, which is a string written in the alphabet `abcdefghijklmnopqrstuvwxyz`. It does not m... |
[Question]
[
I am 2/3 twins with my brother, i.e. born on the same day of the same month but twelve years later. When I was 5, he was 17, both primes; the last pair of ages we can reasonably count on is [71, 83] with both of us being alive and able to celebrate this coincidental jubilee.
## Task
Create a code that... |
[Question]
[
Your program/function should
* output exactly one integer
* output **any** integer with positive probability
* output an integer greater than 1.000.000 or less than -1.000.000 with at least with 50% probability.
Example outputs (all must be possible):
```
59875669123
12
-42
-4640055890
0
2014
12
24
-71... |
[Question]
[
Given a positive integer \$n\$ output the integers \$a\$ and \$b\$ (forming **reduced** fraction \$a/b\$) such that:
$$\frac a b = \prod ^n \_{k=1} \frac {p^2\_k - 1} {p^2\_k + 1}$$
Where \$p\_k\$ is the \$k\$ th prime number (with \$p\_1 = 2\$).
Examples:
```
1 -> 3, 5
2 -> 12, 25
3 -> 144, 325
... |
[Question]
[
Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for details.
The story continues from [AoC2016 Day 2](https://adventofcode.com/2016/day/2), Part 2.
---
You finally figure out the bathroom code (on the weird diamond-shaped key... |
[Question]
[
# Challenge
Given the name of a PPCG member, output their PPCG ID number. If the user does not exist, you may report an error or return any non-positive number. If there are multiple members with this name, you may choose to output only one ID or all of them.
# Test Cases
```
"musicman523" -> 69054
"De... |
[Question]
[
### Your task
Given a numerical string or integer \$\ge 0\$ (which may have leading zeros), convert it to letters using the below rules.
### Rules
Loop through the digits:
* If the digit is `0` or `1`, combine it with the next digit and output that letter of the alphabet (0-indexed).
* If the digit is ... |
[Question]
[
Given a multi-line string as input containing characters `"|"`, `"_"` and `" "` (space), count the number of cells it contains.
A cell is the following structure of 3 characters by 2 lines:
```
_
|_|
```
That is, an underscore on one line (the characters to its right and left don’t matter), and `"|_|"... |
[Question]
[
For the purpose of this challenge, a Prime Power of a Prime (PPP) is defined as a number that can be defined as a prime number to the power of a prime number. For example, 9 is a PPP because it can be represented as 3^2. 81 on the other hand is not a PPP because it can only be represented as 3^4, and 4... |
[Question]
[
In mathematics, the factorial, shortened "fact" of a non-negative integer **n**, denoted by **n!**, is the product of all positive integers less than or equal to **n**. For example, **5!** is **1 \* 2 \* 3 \* 4 \* 5 = 120**
The factorial of **0** is **1**, according to the convention for an empty produ... |
[Question]
[
# Introduction
This question is inspired by this great [question](https://codegolf.stackexchange.com/questions/266255/finding-the-power-sandwich).
# Challenge
Given a number \$N>0\$, output the largest integer \$a^b\$ that is smaller or equal to \$N\$, and the smallest integer \$c^d\$ that is greater o... |
[Question]
[
Given two strings, find the translation table ([substitution cipher](https://en.wikipedia.org/wiki/Substitution_cipher)) between the two, if the translation is not possible, output false. The answer must be minimized and created from left-to-right. The first character to be translated between words mus... |
[Question]
[
Given a multidimensional, rectangular array and a list of dimensions, such as:
```
[ [1, 2],
[3, 4] ]
[3, 4]
```
Your challenge is to extend the matrix to the dimensions given in the list.
To extend an array to a length in a single direction, simply repeat its elements; for example, if we want to ext... |
[Question]
[
To be able to challenge the Elite-4 of top programmers, you need to show your badges first, that qualify you as a potential programmer-master. However, there's a twist. Once you show a badge, it is collected, which means you can't re-show it. So better come prepared! There are `n` badge collectors, eac... |
[Question]
[
# Quine Relay!
A quine relay of order \$n\$ is a series of programs \$P\_1\dots P\_n\$ in **distinct** languages such that each program \$P\_i\$ outputs \$P\_{i+1}\$ and \$P\_n\$ outputs \$P\_1\$.
For example, a 2-quine relay can be seen here:
### Ruby → Perl 6:
[This Ruby program](https://tio.run/##Ky... |
[Question]
[
*There have been a lot of prime-/prime factorization-related challenges recently, so I thought it might be interesting to go the other way.*
Given:
* a positive integer `n`, and
* a non-empty list of positive integers `f`
write a full program or a function to find the smallest integer `i` such that `i ... |
[Question]
[
It's 2050, and people have decided to write numbers in a new way. They want less to memorize, and number to be able to be written quicker.
For every place value(ones, tens, hundreds, etc.) the number is written with the number in that place, a hyphen, and the place value name. "zero" and it's place v... |
[Question]
[
To get this sequence I just made up, which will subsequently be referred to as TSIJMU, consider the harmonic series:
\$ \frac{1}{2} + \frac{1}{3} + \frac{1}{4} ...\$
But what if you only add a term if it doesn't make the sum so far over 1, and otherwise subtract? Let's see an example here, starting at ... |
[Question]
[
# The challenge
Given point and a path of points, say whether or not the point is in the polygon that is created by the path.
Also return `true` if the point is on an edge of the polygon.
# Input
A list of pairs of integers.
The first 2 integers represent the point.
The remaining pairs (3rd and 4th, 5t... |
[Question]
[
### Challenge:
Output the 'integer-digits' of one of the following six arithmetic-tables based on the input:
- addition (`+`);
- subtraction (`-`);
- multiplication (`*`);
- division (`/`);
- exponentiation (`^`);
- modulo operation (`%`).
### Rules:
* What do I define as 'integer-digits': ... |
[Question]
[
**Write a function f(n,k) that displays the k-dimensional countdown from n.**
A 1-dimensional countdown from 5 looks like
```
54321
```
A 2-dimensional countdown from 5 looks like
```
54321
4321
321
21
1
```
Finally, a 3-dimensional countdown from 5 looks like
```
54321
4321
321
21
1
4321
... |
[Question]
[
This challenge is simple, given a decimal number, convert to binary, and calculate the sum of the sub-strings of the binary number, whose length is shorter than the original number. Here is an example:
```
Input:
11
Binary:
11 -> 1011
Substrings:
101 = 5
011 = 3
10 = 2
01 = 1
11 = 3
... |
[Question]
[
# Appended Numbers Game
Write a function/program that takes 2 integer parameters *integer parameters or integer variables*, a start number, and a max iterations count. The code should perform the following game example to construct a new number, and repeat until the number is a single digit left. eg.
`... |
[Question]
[
* Take a line of input (function arguments or stdin, [etc.](https://codegolf.meta.stackexchange.com/q/2447/90614)).
* Remove comments in it, where a comment starts and ends with `"`.
* Do not remove comments in string literals, which start and end with `'`. String literals do not contain escapes, becau... |
[Question]
[
**In anticipation of [MathJax being temporarily disabled](http://chat.stackexchange.com/transcript/message/21046348#21046348), the rendered MathJax in this question has been replaced with images. You are still welcome to post answers but you'll have to view the rendered MathJax on [another site](https:... |
[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 9 years ago.
[Improve this quest... |
[Question]
[
### Background
In 1960, the [11th General Conference on Weights and Measures](https://physics.nist.gov/cuu/Units/international.html#:%7E:text=The%20International%20System%20of%20Units,G%C3%A9n%C3%A9rale%20des%20Poids%20et%20Mesures) defined the Système International d'Unités (SI) Units which scientists... |
[Question]
[
Given an integer \$N\$, print or return integers \$a\$, \$b\$, and \$c\$ that satisfy all of the following conditions, if such integers exist:
* \$a \times b + c = N\$
* \$a\$, \$b\$, and \$c\$ are all prime
* \$a > b > c\$
If no valid combination of integers exist, you should return nothing, 0, None, ... |
[Question]
[
In one of our projects at work, we recently discovered a particularly large method for generating a 6 character string from a 15 character alphabet. A few of us claimed "I bet we can get that in one line" which started a little internal game of code golf.
Your task is to beat us, which I have no doubt ... |
[Question]
[
Gears transfer different amount of speeds, depending on the size of the meshed gear.
[](https://i.stack.imgur.com/RSumE.gif)
Jack has a machine, that rotates a Gear Train. but you don't know the speed of the last gear.
Luckily, You are a great code golf... |
[Question]
[
While moving, I broke my lamp. Now, I need a new one. It's your job to make me a lamp! I'm not sure what size I want, though I know I want a squiggly one.
Your program/function must take in a number input, and print out a lamp with that many squiggles/bumps.
**Examples:**
Input:`2`
Output:
```
/--\
()... |
[Question]
[
**This question already has answers here**:
[Generate a pronounceable word](/questions/11877/generate-a-pronounceable-word)
(35 answers)
Closed 2 years ago.
In the English language, a surefire way to make a pronounceable nonsense letter combination is to make it entirely out of consonant-vowel p... |
[Question]
[
If you like, write a program which sorts cities according to the rules of city name game.
* Each name of the city should start from the last letter in the previous city name. E.g. `Lviv -> v -> Viden -> n -> Neapolis -> s -> Sidney -> y -> Yokogama -> a -> Amsterdam -> m -> Madrid -> d -> Denwer`
* In ... |
[Question]
[
.Net Technology is an incredible framework with marvellous functionalities, and among all of them, the most important one obviously stands out:
[](https://i.stack.imgur.com/YANCl.png)
Yep, your simple task is create a program that when it ... |
[Question]
[
We all know how binary conversion works: the sequence of bits
$$ b\_1, b\_2, ..., b\_{n-1}, b\_n $$
encodes the number
$$ b\_1 \times 2^{n-1} + b\_2 \times 2^{n-2} + ... + b\_{n-1} \times 2^1 + b\_n \times 2^0 $$
This gives an unambiguous representation when we limit all bits \$ b\_i \$ to be only `0` ... |
[Question]
[
## Background
[Slowsort](https://en.wikipedia.org/wiki/Slowsort) is an in-place, stable sorting algorithm that has worse-than-polynomial time complexity. The pseudocode for Slowsort looks like this:
```
procedure slowsort(A[], i, j) // Sort array range A[i ... j] in-place.
if i ≥ j then
... |
[Question]
[
### Input:
Two integers: one negative, one positive.
### Output:
On the first line output lowest to highest. On the second line we've removed the highest and lowest numbers and [sign-changed](https://en.wikipedia.org/wiki/Additive_inverse) all individual numbers. On the third line we've removed the hig... |
[Question]
[
Given `n` (the number of players), `t` (the threshold value), and `s` (the secret), output the `n` secrets generated by [Shamir's Secret Sharing algorithm](https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing).
## The Algorithm
For the purposes of this challenge, the computations will be done in **G... |
[Question]
[
## Explanation
The **edit distance** between two strings is a function of the minimum possible number of insertions, deletions, or substitutions to convert one word into another word.
Insertions and deletions cost 1, and substitutions cost 2.
For example, the distance between `AB` and `A` is 1, because... |
[Question]
[
# Introduction
I have an **even** number of bottles, all of different sizes. Unfortunately, I only know the size of the smallest bottle: **300ml**.
I also know the following:
* Half of the bottles are twice the size of the other half, meaning that the smallest small bottle and the smallest large bot... |
[Question]
[
### Challenge
Given an IPv4 `address` in dotted-quad notation, and an IPv4 `subnet` in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#IPv4_CIDR_blocks), determine if the `address` is in the `subnet`. Output a distinct and consistent value if it is in the `subnet`, and a se... |
[Question]
[
Write a program or function that takes in positive integers `a`, `b` and `c`, and prints or returns `a/b` to `c` decimal places, using the operations +-\*/% [add, subtract, multiply, divide, modulate] on the positive integers: you can use all that your language allows, but not on floating point numbers... |
[Question]
[
# Challenge
Determine how many integer lattice points there are in an [ellipse](https://en.wikipedia.org/wiki/Ellipse)
$$\frac{x^2}{a^2} + \frac{y^2}{b^2} \leq 1$$
centered at the origin with width \$2a\$ and height \$2b\$ where integers \$a, b > 0\$
.
**Input**
The Semi-major \$a\$ and Semi-minor \$b\... |
[Question]
[
I define mousetails's sequence as follows:
* If the nth element of the sequence is q, then n+1 must appear q times in the sequence
* The sequence is weakly monotonically increasing (eg. no lower number may follow a higher number)
* f(1)=1
I'll show an example of how this works:
* the first element is 1... |
[Question]
[
**Problem**
Consider a square 3 by 3 grid of non-negative integers. For each row `i` the sum of the integers is set to be `r_i`. Similarly for each column `j` the sum of integers in that column is set to be `c_j`.
The task is to write code to enumerate all possible different assignments of integers t... |
[Question]
[
The graph of the modulo operation (\$y = x \mod k\$) looks like this:
[](https://i.stack.imgur.com/FSjQG.png)
This is a very useful function, as it allows us to create "wrapping" behavior. However, it is very cumbersome when I want to ... |
[Question]
[
Write a program or a function that takes two non-empty lists of the same length as input and does the following:
* uses elements of first list to get numerators,
* uses elements of the second list to get denominators,
* displays resulting fractions after simplification `(2/4=>1/2)`, separated by "+"s,
... |
[Question]
[
# Introduction
A xenodrome in base *n* is an integer where all of its digits in base *n* are different. [Here](https://oeis.org/search?q=Xenodromes) are some OEIS sequences of xenodromes.
For example, in base 16, `FACE`, `42` and `FEDCBA9876543210` are some xenodromes (Which are `64206`, `66` and `1836... |
[Question]
[
A guitar fretboard diagram looks like this:
```
0 1 2 3 4 5 6 7 8 9 10 11 12 <- Fret number (0 means it's open)
|-E--F--F#-G--G#-A--A#-B--C--C#-D--D#-E
|-B--C--C#-D--D#-E--F--F#-G--G#-A--A#-B
|-G--G#-A--A#-B--C--C#-D--D#-E--F--F#-G
|-D--D#-E--F--F#-G--G#-A--A#-B--C--C#-D
|-A--A#-B--C--C#-... |
[Question]
[
**The formula**
Take for instance the number 300
* The prime factors of 300 are `[2, 3, 5]` (unique numbers that are
factors of 300 and prime)
* Squaring each of those numbers will give
you `[4, 9, 25]`
* Summing that list will give you `4 + 9 + 25 = 38`
* Finally subtract that sum (38) from your origi... |
[Question]
[
**Your goal**: to write a piece of code that will result in the classic result of "Hello, world!" being printed to STDOUT or equivalent.
**Rules**: Code must be entirely in printing ASCII. All code must be functional - removal of any single counting character must change the result or cause the code to... |
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.