text stringlengths 180 608k |
|---|
[Question]
[
(Note: this is an easier spin-off of my previous challenge [Find the Infinity Words!](https://codegolf.stackexchange.com/questions/96516/find-the-infinity-words), which is a spin-off of my other previous challenge [Find the Swirling Words!](https://codegolf.stackexchange.com/questions/95507/find-the-sw... |
[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/25014/edit).
Closed 5 years ago.
[Improve this question](/posts/25014/edit)
... |
[Question]
[
## Exposition
In this challenge, I am talking about ARM assembly language. [ARM](https://en.wikipedia.org/wiki/ARM_architecture_family) is a 32-bit RISC processor; I'll use instruction set up to architecture v6.
To load a constant ("immediate") value into a register, use
the `MOV` instruction:
```
MOV ... |
[Question]
[
For a 2 dimensional array we will call the elements in either the first row or the last column the "J-Bracket" of the array. For example in the following array elements in the J-bracket are highlighted:
\$
\begin{bmatrix}
\color{red}{\underline 1} & \color{red}{\underline 2} & \color{red}{\underline 4}... |
[Question]
[
### Task
A *reverse checkers* position is a chess position where every piece for one player is on one colour and every piece for the other player is on the other colour. Your task is to find if the given (valid) position meets these criteria.
For example, this position does (click for larger images). E... |
[Question]
[
# The rundown
Create a program that generates an array of random length with random numbers, then apply a series of rules that alter the array. After the rules have been applied, print the sum of the array unless specified otherwise
# Array setup
The array must be a random length between **5 and 10** i... |
[Question]
[
## Background
In the sport of Table Tennis (aka Ping-Pong or Whiff Whaff), two opponents play a sequence of rounds, where each round consists of players hitting a ball back and forth until one player (may or may not be the server) gains a point.
Table Tennis has some [official rules](https://www.pongfi... |
[Question]
[
This problem is about separating a string representing a product identifier into three components.
* The first part consists of upper and lower letters of arbitrary length which represents the warehouse.
* The second part is digits which represents the product number. This part is also of arbitrary le... |
[Question]
[
# Background
The [Copeland–Erdős constant](https://en.wikipedia.org/wiki/Copeland%E2%80%93Erd%C5%91s_constant) is the concatenation of "0." with the base 10 representations of the prime numbers in order. Its value is
```
0.23571113171923293137414...
```
See also [OEIS A033308](https://oeis.org/A033308)... |
[Question]
[
A sequence of integers is a one-sequence if the difference between any two consecutive numbers in this sequence is -1 or 1 and its first element is 0.
More precisely: \$a\_1, a\_2, ..., a\_n\$ is a one-sequence if:
$$\forall k \::\: 1\le k<n, |a\_k-a\_{k+1}| = 1 \\ a\_1 = 0$$
**Input**
* \$n\$ - number... |
[Question]
[
Given a positive integer `n`.
Generate a JSON array (can be a string, or your language's built-in JSON representation as long as we can get valid JSON, (your code does not need to include outputting the string, you can just use the built-in JSON representation)) containing two empty JSON arrays, then, ... |
[Question]
[
# Background
The monkeys need help organizing their defense and have asked you, [Benjamin](https://bloons.fandom.com/wiki/Benjamin_(BTD6)) the code monkey, to create a program that will list all tower upgrade options. Each tower has three unique upgrade "paths", each having a tier represented by a numb... |
[Question]
[
You are [Odysseus](https://en.wikipedia.org/wiki/Odyssey), and are finally free from Calypso (who has kept you captive for many years) after you drugged her while she was sleeping1. You wish to return to your homeland of Ithaca, but the ship you've stolen is a bit damaged and cannot steer. However, you... |
[Question]
[
## Lucky dice rolls
In pen and paper roleplaying games dice are used for various chance calculations. The usual way to describe a roll is \$n\textbf{d}k\$ where \$n\$ is the number of dice and \$k\$ is the number of faces on a die. For example \$3d6\$ means that you need to roll the classical 6-sided d... |
[Question]
[
# The system
Assume [the Earth is flat](https://xkcd.com/1318/) and that it extends infinitely in all directions. Now assume we have one infinitely long train railway and `n` trains in that railway. *All* trains have different speeds and *all* trains are going in the same direction. When a faster train... |
[Question]
[
Let \$A\$ be a positive integer consisting of \$n\$ decimal digits \$d\_1,d\_2,...,d\_n\$. Let \$B\$ be another positive integer.
For the purpose of this challenge, we call \$A\$ a **copycat** of \$B\$ if there exists at least one list of positive integers \$p\_1,p\_2,...,p\_n\$ such that:
$$\sum\_{i=1... |
[Question]
[
[Palindromic dates](http://www.timeanddate.com/date/special-dates.html) are dates that appear as palindromes: the string of digits can be read the same way backwards as forwards. For the North American date format (MM/DD/YYYY), the next few palindromic dates are:
`02/02/2020`
`12/02/2021`
`03/02/2030`
... |
[Question]
[
(This is a variation on [Print a Negative of your Code](https://codegolf.stackexchange.com/questions/42017/print-a-negative-of-your-code), which I enjoyed a lot! Thanks to [Martin Büttner♦](https://codegolf.stackexchange.com/users/8478/martin-b%C3%BCttner) - almost all of this text is his.)
Let's consi... |
[Question]
[
In this challenge, you are given a map of a two-dimensional terrain, viewed from the side. Unfortunately, some parts of the terrain are floating in the air, which means they'll come crashing down. Your job is to predict where they land.
# The Input
Your input is one or more newline-separated strings of... |
[Question]
[
Finding primes is a programming rite of passage and very frequently the first serious program someone creates (usually with trial division).
But primes alone are already worn out. A next far more interesting thing is to get the prime gaps: the so-far-longest gaps between consecutive primes. These are q... |
[Question]
[
Let \$p(x)\$ be a polynomial. We say \$a\$ is a **root of multiplicity \$k\$** of \$p(x)\$, if there is another polynomial \$s(x)\$ such that \$p(x)=s(x)(x-a)^k\$ and \$s(a)\ne0\$.
For example, the polynomial \$p(x)=x^3+2x^2-7x+4=(x+4)(x-1)^2\$ has \$1\$ and \$-4\$ as roots. \$1\$ is a root of multipli... |
[Question]
[
I came across this picture the other day: (Credit to Josep M Batlle I Ferrer)
[](https://i.stack.imgur.com/0W6Yx.png)
Your job is to generate this picture. This graph is generated by repeatedly applying newton's method to the graph of:
$$f(x)=\co... |
[Question]
[
# Background
Famously, the acronym `GNU` stands for `GNU's Not Unix`. [1](https://en.wikipedia.org/wiki/GNU)
It's recursive because, after expanding it once, it still contains the acronym `GNU`, and so must be exanded again:
```
(GNU's Not Unix)'s Not Unix
```
And so on, ad infinitum. Visualizing this,... |
[Question]
[
It is well known that odd primes will appear in Pascal's triangle exactly twice. However, not all numbers that appear exactly twice in Pascal's triangle are prime. We'll call these numbers Pascal primes.
Pascal primes are composite numbers that appear exactly twice in Pascal's triangle. The first few ... |
[Question]
[
The sequence of segmented numbers or prime numbers of measurement ([OEIS A002048](http://oeis.org/A002048)) is the sequence of numbers such that each member is the smallest positive (greater than zero) number that can't be made of a sum of earlier consecutive numbers, with `a(0) = 1`.
### Example
To ca... |
[Question]
[
# Cops' Thread
In this challenge, your goal is to write a function that accepts a integer `N`, and that function will return the first `N` primes. However, you must do this in the *most* characters possible.
* You may use any method you wish to produce the primes.
* You are not allowed to modify your c... |
[Question]
[
Given a positive integer, we can form a new number that's described by its digits taken pairwise (with a leading 0 added for numbers with odd number of digits).
For eg.:
* 1234 can be read as one 2, three 4s - so, the output for 1234 is 2444.
* 643 has an odd number of digits, so a leading zero is add... |
[Question]
[
*This question is inspired by the fact that I love seeing questions with equal vote and answer counts...*
---
So here's a simple [stack-exchange-api](/questions/tagged/stack-exchange-api "show questions tagged 'stack-exchange-api'") challenge for y'all:
**Challenge:**
Given a `codegolf.stackexchange` q... |
[Question]
[
Given 2 integer inputs representing the size of the field, `x` and `y`, output a path through the field.
Example output for `5, 4`:
```
#
#
# ###
### #
```
The whole field is 5 by 4, and there is a path made of hashmarks crossing the field.
The path should always start in the top left corner, ... |
[Question]
[
Given a sequences of events with probabilities between 0.0 and 1.0, generate and derive the probability of each combination occurring. You may presume that a sequence of numbers is provided in whatever construct your chosen language provides.
Here's an example; you may presume that the length of the se... |
[Question]
[
I've enjoyed reading this site; this is my first question. Edits are welcome.
Given positive integers \$n\$ and \$m\$, compute all ordered partitions of \$m\$ into exactly \$n\$ positive integer parts, and print them delimited by commas and newlines. Any order is fine, but each partition must appear ex... |
[Question]
[
*Some time after [this incident](https://codegolf.stackexchange.com/questions/58013/parentheses-into-footnotes)…*
There are [some](http://chat.stackexchange.com/transcript/message/24962500#24962500) of [us](http://chat.stackexchange.com/transcript/message/24962510#24962510) who are against this defilin... |
[Question]
[
If you take a sheet of graph paper and draw a sloped line that goes `m` units right and `n` units up, you cross `n-1` horizontal and `m-1` vertical gridlines in some sequence. Write code to output that sequence.
For example, `m=5` and `n=3` gives:
. Usually the arrangement is done manually, but wouldn't a program help with that? :)
>
>
>
Your program will take 3 inputs:
* The code, as one sing... |
[Question]
[
You're tasked with writing two programs. Program **A** must print out nothing on all inputs *except* when program **B** is input, in which case it should print `1`. Program **B** must print out `1` on all inputs *except* when program **A** is input, in which case it should print nothing.
**Scoring:**
... |
[Question]
[
look! It's an ASCII maze! Soo coolzors, amazeballs and stuff.
```
+-+-----+---+
| | | |
| | ++ | |
| | ++ +-+ |
| | |
+-------+ | |
| | |
+---------+-+
```
But, but, but... it's a pain to work out which direction all the parts of the maze are going. I just want to draw the lay... |
[Question]
[
[Haskell](https://haskell.org "Haskell Language") has this neat(-looking) feature where you can give it three numbers and it can infer an arithmetic sequence from them. For example, `[1, 3..27]` is equivalent to `[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27]`.
That's cool and all but arithmetic s... |
[Question]
[
Given an audio file, determine whether it is encoded in a lossy format or a lossless format. For the purposes of this challenge, only the following formats need to be classified:
* Lossy
+ [AC3](https://en.wikipedia.org/wiki/Dolby_Digital)
+ [AMR](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_aud... |
[Question]
[
# Challenge:
Given a matrix (or 2d array) of 0s and 1s, output the number of steps it takes for Conway's game of life to reach a stable state, or -1 if it never reaches one. A stable state is a state in which no cells are turned on or off each step. The game must run in the given matrix, with the top a... |
[Question]
[
Sometimes when I'm bored, I take some text and fill the "holes" in the letters. But isn't filling the holes the most boring thing you can do? I think we should [automate it](http://xkcd.com/1319/), so we could use our time better.
Standard [code-golf](/questions/tagged/code-golf "show questions tagged ... |
[Question]
[
Write a [Manufactoria](http://pleasingfungus.com/Manufactoria/) program that will accept the empty input tape. But don't do it quickly! I mean, write the program quickly, but don't let it run quickly. The slower the program, the better, as long as it terminates eventually. The example program below tak... |
[Question]
[
Good Evening Golfers!
Your challenge is to completely unsort a series of numbers.
# Input
Exactly 100 integers will be fed to your program. Your program may accept the input either as a file, or via stdin. Each integer will be separated by a newline character.
Those 100 integers will range from the min... |
[Question]
[
In the hovertext of [this xkcd](https://xkcd.com/2637/):
 color model is for the sensing, representation and display of images in electronic systems, such as televisions and computers
>
>
> HSL (Hue Saturation Lightness) is an alternative color model, designed in the 1970s by computer graphics researchers to... |
[Question]
[
Write code to evaluate whether a chain of inequalities is true or false. An example input is the string
`3<=4!=9>3==3`
This is true because each of its components is true:
`(3<=4) and (4!=9) and (9>3) and (3==3)`
**Input:**
A string that represents a chain of one or more inequalities. The allowed comp... |
[Question]
[
**This question already has answers here**:
[Aligning Lines!](/questions/57786/aligning-lines)
(27 answers)
Closed 3 years ago.
Perhaps something like this is here already, but I couldn't find it.
It is not the same as [Aligning Lines!](https://codegolf.stackexchange.com/questions/57786/aligning... |
[Question]
[
## A Bit of Background
The [exterior algebra](https://en.wikipedia.org/wiki/Exterior_algebra) is a central object in topology and physics (for the physics concept cf. [fermion](https://en.wikipedia.org/wiki/Fermion)). The basic rule dictating the behavior of the exterior algebra is that \$yx = -xy\$ (a... |
[Question]
[
Imagine a path made up of `<` and `>` and ending in a `@`, e.g.
```
><>@
```
A walker starts on the left-most cell. He will traverse the path as follows:
* If the walker is on a `@` cell, he's reached the goal and is done.
* If the walker is on a `>` cell, the entire path shifts one step to the right, ... |
[Question]
[
## NOTE
This problem was taken from [this reddit thread](http://www.reddit.com/r/dailyprogrammer/comments/27h53e/662014_challenge_165_hard_simulated_ecology_the/) (spoiler alert!), and I have adjusted it to make it fit with this site's format. All credit goes to reddit user "Coder\_d00d".
In this probl... |
[Question]
[
# Context
In [APL](https://aplwiki.com), trains are tacit sequences of monadic/dyadic functions that can be called with one or two arguments. We'll code something to check if a given train follows the correct structure we need in order to have a sound train.
# Task
Given the sequence of function aritie... |
[Question]
[
Your task is to create a plain hunt (a bell ringing pattern) with *n* bells. An example with 6 bells:
```
123456
214365
241635
426153
462513
645231
654321
563412
536142
351624
315264
132546
123456
```
Each number "bounces" off the side of the grid. [From Wikipedia](https://en.wikipedia.org/wiki/Plain_h... |
[Question]
[
Given a \$n\$-dimensional vector \$v\$ with real entries, find a closest permutation \$p\$ of \$(1,2,...,n)\$ with respect to the \$l\_1\$-distance.
### Details
* If it is more convenient, you can use permutations of \$(0,1,...,n-1)\$ instead. If there are multiple closest permutations, you can output ... |
[Question]
[
Given a single integer `x` where `0 <= x <= 91` output a stack of bottles of beer with that many bottles (and shelves) missing. For simplicity sake I'll only show the first 6 bottles and what it would be for each of the first inputs.
Here's the stack of bottles, each number is the bottle you should rem... |
[Question]
[
[Wise](https://github.com/Wheatwizard/Wise) is a simple bitwise language I designed a while back. It is based around [Python's bitwise operations](https://wiki.python.org/moin/BitwiseOperators). It has several operations most of these are the same or very similar to the equivalent symbol in Python.
* `... |
[Question]
[
In my time on PPCG, I've noticed that quine problems and polyglot problems are quite popular. Also, meta-solutions to problems, that is, scripts which generate a program which is the solution to a problem, tend to get a lot of positive feedback from the community. Therefore, I have created this challen... |
[Question]
[
In [long multiplication](http://mathworld.wolfram.com/LongMultiplication.html), after multiplying the numbers, you are left with the partial products, in this challenge you will output those partial products.
Because long multiplication is long, to compensate your code will need to be as short as possi... |
[Question]
[
# Electron Configurations
Your mission is to accept an element's atomic number as input, and output its [electron configuration](https://en.wikipedia.org/w/index.php?title=Electron_shell&oldid=616749633#List_of_elements_with_electrons_per_shell) (e.g. `2,8,8,2` for calcium).
## Input
An atomic number f... |
[Question]
[
There is a 1x1x1 cube placed on a infinite grid of 1x1 squares. The cube is painted on every side, so it leaves a mark on the grid when it moves.
[](https://i.stack.imgur.com/ZT7cr.jpg)
The sides of the cube are colored 6 distinct colo... |
[Question]
[
A [binary relation](https://en.wikipedia.org/wiki/Binary_relation) on a set \$X\$ is simply a subset \$S \subseteq X \times X\$; in other words, a relation is a collection of pairs \$(x,y)\$ such that both \$x\$ and \$y\$ are in \$X\$. The number of different relations grows quickly with the size of th... |
[Question]
[
>
> In [atomic physics](https://en.wikipedia.org/wiki/Atomic_physic) and [quantum chemistry](https://en.wikipedia.org/wiki/Quantum_chemistry), the **electron configuration** is the distribution of [electrons](https://en.wikipedia.org/wiki/Electron) of an [atom](https://en.wikipedia.org/wiki/Atom) in [... |
[Question]
[
There are many magic squares, but there is just *one* non-trivial magic hexagon, as [Dr. James Grime explained](https://www.youtube.com/watch?v=ZkVSRwFWjy0), which is the following:
```
18 17 3
11 1 7 19
9 6 5 2 16
14 8 4 12
15 13 10
```
As it is done in [Hexagony](https://esolangs.org/wi... |
[Question]
[
**A [strictly non-palindromic number](https://en.wikipedia.org/wiki/Strictly_non-palindromic_number) N is a number that isn't a palindrome in *any* base (in bases 2 to N-2).** These numbers are listed on [OEIS](https://oeis.org/A016038)
For example, the number `19` in base 2,3,4,5,6,...17 is: `10011`,`... |
[Question]
[
What general tips do you have for golfing in Tcl? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Tcl (e.g. "remove comments" is not an answer). Please post one tip per answer.
[Answer]
Use [`lmap`](http://www.tcl.tk/man/tcl8.6/TclC... |
[Question]
[
Chaim Goodman-Strauss, Craig Kaplan, Joseph Myers and David Smith [found](https://cs.uwaterloo.ca/%7Ecsk/hat) the following simple (both [objectively](https://en.wikipedia.org/wiki/Simple_polygon) and subjectively) polygon that tiles the plane, but only aperiodically:
.")
[Zimin words](https://en.wikipedia.org/wiki/Sesquipower) (also called "sesquipowers") are an important idea in the subject of "combinatorics on words". This is because every... |
[Question]
[
## Challenge
For each character of the string except for the last one, do the following:
* Output the current character.
* Followed by randomly outputting from the following list a random number of times between 1 - 5 (inclusive):
+ The current character
+ The next character of the string
+ The swit... |
[Question]
[
**Input:**
An integer.
**Output:**
1. First convert the integer to it's equivalent Roman Numeral.
2. Then convert each capital letter of that Roman Numeral to their ASCII/UNICODE decimal value.
3. And output the sum of those.
**Example:**
```
1991 -> MCMXCI -> 77+67+77+88+67+73 -> 449
^ input ... |
[Question]
[
A [field](https://en.wikipedia.org/wiki/Field_(mathematics)) in mathematics is a set of numbers, with addition and multiplication operations defined on it, such that they satisfy certain axioms (described in Wikipedia; see also below).
A finite field can have pn elements, where `p` is a prime number, a... |
[Question]
[
This challenge is about reading random lines from a potentially huge file without reading the whole file into memory.
**Input**
An integer `n` and the name of a text file.
**Output**
`n` lines of the text file chosen uniformly at random without replacement.
You can assume that `n` is in the range 1 t... |
[Question]
[
You can determine the volume of objects based on a given set of dimensions:
* The volume of a sphere can be determined using a single number, the radius (`r`)
* The volume of a cylinder can be determined using two numbers, the radius (`r`) and the height (`h`)
* The volume of a box can be determined us... |
[Question]
[
# The Task
In this challenge, your task is to draw an ASCII art representation of several stacks of boxes of increasing height.
You are given as input the number of stacks, which is a positive integer.
The first stack contains one box of size `2x2`.
The second stack contains 2 boxes of size `3x3`.
In g... |
[Question]
[
*This is a [repost](https://codegolf.meta.stackexchange.com/questions/24851/repost-word-stays-a-word-after-taking-away-a-letter) of [this](https://codegolf.stackexchange.com/questions/145222/word-stays-a-word-after-taking-away-a-letter-repeat) challenge*
---
# Challenge
There is an old, popular riddle:... |
[Question]
[
## Incremental Game Time Format
### Goal
Incremental games often have a countdown timer expressing the days, hours, minutes and seconds until a task is complete. Depending on the space available, they can be formatted as:
```
2d 13h
23h 59m 48s
14m
3h 0m 0s
```
The goal of this code golf is to write a ... |
[Question]
[
>
> Inspired by [this](https://chat.stackexchange.com/transcript/message/61670136#61670136)
>
>
>
Your task today: given two strings, find the string with the lowest maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to the input strings. For example, using `Steffan`... |
[Question]
[
We are to define the idea of a *fixed list* as follows:
* A **fixed list** is a list of fixed lists.
This definition is recursive so it's useful to look at some examples.
* The empty list `[]` is a fixed list.
* And list of empty lists is a fixed list. e.g. `[[],[],[]]`
* Any list of the above two is a... |
[Question]
[
You are employed as Administrator in charge of Road Maintenance and Planning. The intelligence division of the Agency for Road Maintenance and Planning has come up with a brilliant and not at all inefficient way to take random sample pictures of the roads: missiles with cameras on them.
In this genius ... |
[Question]
[
A half cardinal cyclic quine is a cyclic quine with two states, one perpendicular to the other.
## Rules
You can decide which rotation you want to implement, clockwise or counter-clockwise.
Once rotated, any gaps in your code should be replaced with spaces to preserve the positioning.
Your program must... |
[Question]
[
What is the shortest way we can express the function
```
f(a,b)(c,d)=(a+c,b+d)
```
in point-free notation?
[pointfree.io](http://pointfree.io/) gives us
```
uncurry (flip flip snd . (ap .) . flip flip fst . ((.) .) . (. (+)) . flip . (((.) . (,)) .) . (+))
```
which with a little bit of work can be sh... |
[Question]
[
[Inspiration](https://codegolf.stackexchange.com/q/151176/43319). Posted with [permission](https://codegolf.stackexchange.com/questions/151176/how-many-calendar-facts-are-there-really#comment369485_151176).
# Print one of the possible XKCD calendar "facts":
[ that starts with the unary operation of successor, then continues with the binary operations of addition, multiplication an... |
[Question]
[
Every Brazilian citizen has a national identification number associated with them, named CPF.
This number has 11 digits (formatted as XXX.XXX.XXX-XX) and it's validated by the following (real) algorithm1:
0. Take the 9 most significant digits of the number. Call it ***c***.
1. Multiply the ***n***-th l... |
[Question]
[
Let us consider the following representation of the periodic table.
```
__________________________________________________________________________
| | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|-----------------------------------------------------------------... |
[Question]
[
Here's a pretty common pattern for sorting algorithms:
```
def sort(l):
while not is_sorted(l):
choose indices i, j
assert i < j
if l[i] > l[j]:
l[i], l[j] = l[j], l[i]
```
These algorithms work well because the indices `i` and `j` are chosen carefully, based... |
[Question]
[
What general tips do you have for golfing in Clean? Please post only ideas that can be applied to code golf problems in general, and are at least somewhat specific to Clean.
If you've never heard of Clean, you can find out more [here](http://clean.cs.ru.nl/Clean).
Or, you can join the [chat room](htt... |
[Question]
[
## Challenge:
Given an index integer `n`, either output the `n`'th item in this sequence, or output the sequence up to and including index `n`:
```
25,25,7,28,29,20,21,22,23,14,35,26,7,28,29,20,16,29,12,15,28,21,14,17,30,13,16,29,12,15,28,21,10,6,12,18,15,11,7,13,19,17,13,9,15,21,18,14,10,16,22,19,15,1... |
[Question]
[
Left and right [Riemann sums](https://en.wikipedia.org/wiki/Riemann_sum) are approximations to [definite integrals](https://en.wikipedia.org/wiki/Integral). Of course, in mathematics we need to be very accurate, so we aim to calculate them with a number of subdivisions that approaches infinity, but tha... |
[Question]
[
We all know that whenever a rational number is written in decimal, the result is either terminating or (eventually) periodic. For example, when 41/42 is written in decimal, the result is
```
0.9 761904 761904 761904 761904 761904 761904 761904 ...
```
with an initial sequence of digits `0.9` followed b... |
[Question]
[
[Lost](https://tio.run/#lost) is a 2-D programming language where the start position and direction of the ip are entirely random.
This makes it very difficult to make deterministic Lost programs. However today we are not writing a deterministic program, we are writing an RNG.
Write a Lost program that ... |
[Question]
[
***UPDATE***:
**The gist-files are updated (including new submissions) as the Controller.java did not catch Exceptions (only errors). It does now catch errors and exceptions and also prints them.**
*This challenge consists of two threads, this is the catcher thread, the cat thread can be found [here](h... |
[Question]
[
## Challenge
Write the shortest code that can sum all the time durations that appear in the stdin. The program must only consider the strings that match with one of the following patterns and ignore the rest.
```
HH:MM:SS (it will be interpreted as HH hours, MM minutes and SS seconds)
... |
[Question]
[
If someone facing north at point A in this grid wanted directions to follow the green path (as they can only follow gridlines) to point B you might tell them:
Go `North, North, West, East, East, South, East, East`.
*or equivalently*
Go `Forward, Forward, Left, Back, Forward, Right, Left, Forward`.
(... |
[Question]
[
[Today's Daily WTF](http://thedailywtf.com/Articles/One-Bad-Ternary-Operator-Deserves-Another.aspx) quotes the following line of code...
```
FailSafe==0?'No technical alarms':((FailSafe&1)!=0&&(FailSafe&2)!=0&&(FailSafe&4)!=0&&(FailSafe&8)!=0?'Detection zones staying in a given state; Bad visibility;
I... |
[Question]
[
Given two positive integer fractions \$x\$ and \$y\$ such that \$x < y\$, give the fraction \$z\$ with the smallest positive integer denominator such that it is between \$x\$ and \$y\$.
For example \$x=2/5\$, \$y=4/5\$, the answer is \$1/2\$. Other fractions such as \$3/5\$ are also in between the two,... |
[Question]
[
[](https://i.stack.imgur.com/tQ23P.png)
## Task
Any one of these two:
* Determine if a given position (an ordered non-empty collection of integers in the range ‒8 to 8, or ‒7 to 7 if you want) is a valid [Dimensi... |
[Question]
[
Given a binary sequence of finite length, find the starting position where this sequence first appears in the binary digits of π (after the decimal). You can assume that an answer exists for any input sequence.
The binary digits of π start with
```
11.001001000011111101101010100010001000010110100011.... |
[Question]
[
## Background
Perfect shuffle algorithms like [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) don't produce great results when it comes to music playlist shuffling, because it often produces clusters of songs from the same album. In an attempt to solve this problem, S... |
[Question]
[
This is the inverse of [negative seven's question](https://codegolf.stackexchange.com/questions/193640/injection-from-two-strings-to-one-string).
Write a program or function which, given **any** single, possibly-empty string of printable ASCII (codes \$[32,126]\$) outputs or returns two strings of prin... |
[Question]
[
Output the following table:
```
一一得一
一二得二 二二得四
一三得三 二三得六 三三得九
一四得四 二四得八 三四十二 四四十六
一五得五 二五一十 三五十五 四五二十 五五二十五
一六得六 二六十二 三六十八 四六二十四 五六三十 六六三十六
一七得七 二七十四 三七二十一 四七二十八 五七三十五 六七四十二 七七四十九
一八得八 二八十六 三八二十四 四八三十二 五八四十 六八四十八 七八五十六 八八六十四
一九得九 二九十八 三九二十七 四九三十六 五九四十五 六九五十四 七九六十三 八九七十二 九九八十一
```
Or you can use the fir... |
[Question]
[
In the future when Time Travel (abbreviated as TT) will be common, coin tossing will become a serious mind-sport. To prepare for the future we create a competition for programs where time traveling will be really happening from the viewpoints of the entries.
The competition is a round-robin style King ... |
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.