text stringlengths 180 608k |
|---|
[Question]
[
My friend and I have this game that we play with words. It is a fun pastime and it involves "canceling out" letters in a word until there is nothing left. I am really tired of him being so much faster than me at it, so it is *your* job to implement it and let me finally beat him. Obviously, since I hav... |
[Question]
[
The king of Ancient Rome is having difficulties determining if a magic square is valid or not, because the magic square he is checking does not include any separators between the numbers. He has hired a software engineer to help him determine if a magic square is valid or not.
**Input Description**
In... |
[Question]
[
# Introduction
In this challenge, your task is to correctly list the [cases](http://en.wikipedia.org/wiki/Finnish_noun_cases) of two Finnish nouns.
The twist is that you may use one of the listings as a guide to produce the other.
### The Nouns
We use the following two declination tables as our data.
T... |
[Question]
[
In [this question](https://codegolf.stackexchange.com/questions/24925/ebcdic-code-golf-happy-birthday-system-360), a mapping is defined between EBCDIC and a superset of ISO-8859-1.
Your task is to build a network of two-input NAND gates that will take eight inputs `A1, A2, A4, ..., A128` representing a... |
[Question]
[
**Important edit: Earlier, there was an incorrect value in Example 1. It has been fixed.**
You are given a two-dimensional array in which each cell contains one of four values.
Examples:
```
1 2 2 2 2 1 @ . . X X V
1 3 1 4 1 4 e . @ I C V
2 3 1 3 4 2 H H @ X I ... |
[Question]
[
Those of you who like Numberphile would be familiar with Dr. James Grime, who [described a non-transitive dice game on his channel](https://www.youtube.com/watch?v=zWUrwhaqq_c).
The game consists of three 6-faced dice:
* Die 1: 3,3,3,3,3,6
* Die 2: 2,2,2,5,5,5
* Die 3: 1,4,4,4,4,4
Two players each sele... |
[Question]
[
Your lab needed to simulate how a particular cell evolves over time in a 2D grid space. A sample 2D grid space below shows a single cell at the centre of the grid.
```
0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0
```
The cell evolution follows these rules:
1. '0' indicates no live cell
2. A positi... |
[Question]
[
The string
```
abaaba
```
Is a palindrome, meaning it doesn't change when it's reversed. However we can split it in half to make two palindromes
```
aba aba
```
We could also split it up this way:
```
a baab a
```
And all three of those are palindromes.
In fact there are only two ways to split the stri... |
[Question]
[
The word "levencycle" is inspired by [cyclic levenquine](https://codegolf.stackexchange.com/q/116189/78410) challenge.
## Definitions
A **1-dup permutation** of order \$n\$ is some permutation of \$1, \cdots, n\$ plus one duplicate number in the range.
For example, 1-dup permutations of order 3 include... |
[Question]
[
# Convert NFA to DFA as quickly as possible.
**Input**
Your input will be an [NFA](https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton). In order to be able to test your code, it needs to be able to handle an NFA in the following format. This is taken directly from [GAP](https://www.gap-sys... |
[Question]
[
## Background
An [Eisenstein integer](https://en.wikipedia.org/wiki/Eisenstein_integer) is a complex number of the form \$ z = a + b\omega \$ where \$a, b\$ are integers and \$\omega\$ is the third root of unity \$\frac{1-\sqrt3i}{2}\$. The Eisenstein integers can be viewed as the triangular lattice po... |
[Question]
[
**Edit**: *I haven't played D&D before so when I initially made this question I didn't properly research it. I apologize for this, and I'm making a few edits that might invalidate answers to stay as true as possible to the dnd 5e rules. Sorry.*
---
A D&D fan from a recent [Hot Network Question](https:/... |
[Question]
[
# CHALLENGE
Given a set of grouped letters, arrange them onto the board so that they cover the area entirely.
## Board Representation (a.k.a. the SHIP DECK)
* The board is a 6x6 grid.
* There will always be 36 total squares.
* Columns are marked A-F.
* Rows are marked 1-6.
Example:
```
A B C ... |
[Question]
[
To "shift" over a number `n` places, do the following:
* Remove the last `n` digits
* Add `n` copies of the first digit to the beginning of the number
For example, to shift the number `31415` three places, take out the last three digits to get `31`, and then add three more copies of the first digit, ... |
[Question]
[
Stewie's Game of Life and Fatigue is quite similar to the more famous [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life).
---
The universe of the Stewie's Game of Life and Fatigue (GoLF) is an infinite two-dimensional orthogonal grid of square cells, each of which is in on... |
[Question]
[
As we all know, modern operating systems have thread schedulers that can pick different orders to schedule your threads based on internal logic which your code is not privy to. Normally you architect your multithreaded code to ensure that this nondeterminism imposed on you does not meaningfully affec... |
[Question]
[
Take the vector of unknowns [](https://i.stack.imgur.com/9HBDy.png), and apply some generic differentiable function [](https://i.stack.imgur.com/mQLwp.png). The [Jac... |
[Question]
[
### Back to basics...
As a teacher at the local primary (grade?) school, you need a way to teach your class their times tables. At your disposal, you have hundred squares and a load of red pens. You need to also be able to show your class the correct answers quickly.
Now, you're clever enough to writ... |
[Question]
[
You may have seen puzzles like this:
>
> Find the `0`:
>
> `OOOOOOOOOOOOOOOOOOOO0OOOOOOOOOOOOOOOOOO`
>
>
>
The challenge is to write a program that finds the index of the different letter given an image.
### Input
Input will be an `Image`. The image will consist of *one line* of *black* text i... |
[Question]
[
Suppose you have 2 languages, `A` and `B`. A string `s` is a semiquine in `A` and `B` if it satisfies the following conditions:
1. `s` is a quine in language `A`.
2. `s` is a polyglot in `A` and `B`.
3. The output of running `s` as a `B` program is a different string `s'`, which is a quine in `B`.
Th... |
[Question]
[
The best solution I've found so far for a golf code puzzle I'm working on includes two *rather fat-looking* invocations of `range`. I'm very new at code golf, especially in Python, so I could use a few tips.
The relevant fragment is this
```
[x for x in range(n+1,7**6)if`x`==`x`[::-1]*all(x%i for i i... |
[Question]
[
## Background
[Manufactoria](http://pleasingfungus.com/Manufactoria/) has been marketed as a game, but we code-golfers can see it for what it really is: a two-dimensional programming language. The Manufactoria programming language is based around a single [queue](http://en.wikipedia.org/wiki/Queue_%2... |
[Question]
[
Good Afternoon Golfers,
Our challenge for today is inspired by XKCD comics [356](http://xkcd.com/356/ "356") and [370](http://xkcd.com/730/ "730"). We're going to write a program to calculate the resistance of a group of resistors. A forewarning that this is nearly tough enough to warrant being a cod... |
[Question]
[
Write two programs:
- One which reads a string and a key and encodes the string into a rail-fence cipher using that key.
- Similarly, write a program for the reverse function: deciphering a rail fence using a key.
For those who don't know what rail fence cipher is, it is basically a method of writi... |
[Question]
[
You thought regular sudoku was hard, now try [Killer Sudoku](https://en.wikipedia.org/wiki/Killer_sudoku)!
In the game of Killer Sudoku, you aren't given any numbers at all. Instead, you're given regions that are said to add up to a certain number. Consider the following example, from Wikipedia:
![ki... |
[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/4772/edit).
Closed 3 years ago.
[Improve this question](/posts/4772/edit)
... |
[Question]
[
In this challenge you will receive as input a list of binary lists. The list represents a game board with each element representing a location on the board. The list at each location represents the tiles on the board, with a `0` being a white tile (□) and a `1` being a black tile (■). Each place can ... |
[Question]
[
# Parenthetical names
Your challenge is to build a program that puts parentheses around the 'title' part of names. For example, `Sonic the Hedgehog` is converted to `Sonic (the Hedgehog)`.
### Rules:
* **Around every `the` that passes the following rules, an opening parentheses will be added *before*... |
[Question]
[
I want to avoid responding to illegal or spoofed addresses. One type that's easy to detect is an address that should not exist on a packet received by my router: a special-use address.
## Challenge
Given an IPv4 32-bit address, identify whether it is valid general-use address.
## Challenge rules
* Sp... |
[Question]
[
Your task here is to take a LifeOnTheEdge pattern and convert it to LifeOnTheSlope.
A LifeOnTheEdge pattern is composed of these four characters: `|_L` . A pattern corresponds to a certain arrangement of "on" edges in a square grid. The pattern is placed in the grid first with the characters in the c... |
[Question]
[
(Note: this challenge is distinct from my other challenge ([Draw a path made from direction changers](https://codegolf.stackexchange.com/questions/179083/draw-a-path-made-by-direction-changers)) because of it's rendering of direction (horizontal or vertical), crossing points and single or double path... |
[Question]
[
Write a full program or a function taking an unsigned integer number N and doing this cut out work:
* Cut out a hollow hexagon 'donut' shape with side B-C equal to 2N times '/'
* Translate the piece above by 3 lines.
* Repeat the job N times (from the piece obtained) decrementing by 2 '/' side B-C ,... |
[Question]
[
`/o\` Jimmy [has](https://codegolf.stackexchange.com/questions/187682/how-many-jimmys-can-fit) [been](https://codegolf.stackexchange.com/questions/187731/jimmy-needs-your-help) [receiving](https://codegolf.stackexchange.com/questions/187759/can-jimmy-hang-on-his-rope) [a](https://codegolf.stackexchan... |
[Question]
[
You are given four numbers. The first three are \$a\$, \$b\$, and \$c\$ respectively, for the sequence:
$$T\_n=an^2+bn+c$$
You may take input of these four numbers in any way. The output should be one of two distinct outputs mentioned in your answer, one means that the fourth number is a term in the ... |
[Question]
[
## Introduction
For the purposes of this challenge, we will define the *neighbours* of an element \$E\$ in a square matrix \$A\$ (such that \$E=A\_{i,j}\$) as all the entries of \$A\$ that are immediately adjacent diagonally, horizontally or vertically to \$E\$ (i.e. they *"surround"* \$E\$, without ... |
[Question]
[
A matrix can be thought of as the altitudes of a surface in 3D space.
Consider the 8 neighbours (orthogonal and diagonal) of a cell as a cyclic sequence in clockwise (or anticlockwise) order. Some neighbours may be higher than the original cell, some lower, and some levelled at the same height as the... |
[Question]
[
You have been given N piles of coins. You have decided to divide each of those B1, B2, ..., BN piles among separate groups of people. The amount of people receiving coins has to be a prime number and the amount of money given to each person must be different in each pile.
Input: N, B1, B2, ..., BN (T... |
[Question]
[
I've been really interested with sequences that follow the property
\$a(n+1) = a(n - a(n))\$
recently, so here's another question about these sequences. In particular we are concerned with sequences from the integers to the natural numbers.
A periodic sequence with the above property is an **n**-Jug... |
[Question]
[
**The Problem:**
This challenge comes from a real problem I was having. I have a dual monitor setup at work, and I wanted to use the following image as my wallpaper:
[](https://i.stack.imgur.com/2bdJJ.jpg)
However, my monitors have quite significant ... |
[Question]
[
# Introduction
One day, you were just relaxing in your office in the CIA, when suddenly you see an alert on your computer. Your programs have just intercepted hundreds of coded messages! A quick examination reveals the rule for encoding, but you need a program in order to decode fast.
# Challenge
Yo... |
[Question]
[
Given positive integer `n < 10`, create a 2 dimensional matrix where each location is filled with its `x` and `y` index (starting from the top left).
For example:
Input: 2
```
00 10
10 11
```
Input: 3
```
00 10 20
01 11 21
02 12 22
```
Once the grid is created, randomly fill each index. This can be w... |
[Question]
[
## Task
Your task is simple. Write a program or function which takes three positive integer arguments \$n\$, \$k\$, and \$b\$ in any order, such that \$2 ≤ b ≤ 36\$, and returns or outputs the nth (1-indexed) base-\$b\$ digit after the decimal point of the rational number (\$b^k-1)^{-2}\$.
The output... |
[Question]
[
**This question already has answers here**:
[The centers of a triangle](/questions/11767/the-centers-of-a-triangle)
(3 answers)
Closed 8 years ago.
Try to write the shortest program or function you can that prints or returns the calculated orthocenter of a triangle.
The orthocenter of a trian... |
[Question]
[
The task is to write code that can find small logical formulae for sums of bits.
The overall challenge is for your code to find the smallest possible propositional logical formula to check if the sum of y binary 0/1 variables equals some value x. Let us call the variables x1, x2, x3, x4 etc. Your exp... |
[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/6284/edit).
Closed 6 years ago.
[Improve this question](/posts/6284/edit)
... |
[Question]
[
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/4900/edit).
Closed 9 years ago.
[Improve this question](/... |
[Question]
[
A Bingo card is five columns of five squares each, with the middle square designated "FREE". Numbers cannot duplicate.
The five columns are populated with the following range of numbers:
* B:1-15
* I:16-30
* N:31-45
* G:46-60
* O:61-75
In as few characters as possible, output a string that can be int... |
[Question]
[
This is an exact inverse of the question [Convert to Spoken Binary](https://codegolf.stackexchange.com/questions/268685/convert-to-spoken-binary). This introduction is copied from there.
>
> # Introduction
>
>
> In the video [the best way to count](https://www.youtube.com/watch?v=rDDaEVcwIJM), bin... |
[Question]
[
This challenge is to list out all possible words which are built from a pattern of syllables. Words are composed by joining syllables together. Syllables are composed of a number of vowels with some number of consonants optionally to the left and/or right. Your code should take in:
* a list of conson... |
[Question]
[
#### Background
From [Wikipedia](http://en.wikipedia.org/wiki/Egyptian_fraction): An Egyptian fraction is the sum of distinct unit fractions. That is, each fraction in the expression has a numerator equal to 1 and a denominator that is a positive integer, and all the denominators differ from each oth... |
[Question]
[
*Inspired by [Is this Flow Free puzzle trivial?](https://codegolf.stackexchange.com/questions/235848/is-this-flow-free-puzzle-trivial) by [@Bubbler](https://codegolf.stackexchange.com/users/78410/bubbler). Lengthy chunks of this challenge are borrowed from there. This may be one step of a solution fo... |
[Question]
[
Sequel of [Counting valid Binary Sudoku rows](https://codegolf.stackexchange.com/q/201094/78410).
## Background
Binary Sudoku, also known as [Takuzu](https://en.wikipedia.org/wiki/Takuzu), Binario, and Tic-Tac-Logic, is a puzzle where the objective is to fill a rectangular grid with two symbols (0s a... |
[Question]
[
If \$f,g\colon \mathbb{Z}\_{\geq 1} \to \mathbb{R}\$, the *Dirichlet convolution* of \$f\$ and \$g\$ is defined by
\$ \qquad\qquad\qquad \displaystyle (f\*g)(n) = \sum\_{d|n}f(d)g(n/d).\$
[This question](https://codegolf.stackexchange.com/q/176100/77634) asked about computing Dirchlet convolution of... |
[Question]
[
# Introduction
Big 2 is a card game popular in East Asia and South East Asia, in which 4 players are dealt 13 cards each (ie, an equal division of a standard deck without jokers). The goal is to empty your hand before any of the other players. Players take turns playing combinations of a Big 2 subset... |
[Question]
[
Given a string ending in either "er", "ir", or "re" (the "infinitive"), output the full conjugation of the string as a French verb in the seven simple tenses. For each tense (in the order given below), output each subject pronoun in the following order: *je*, *tu*, *il*, *elle*, *nous*, *vous*, *ils*... |
[Question]
[
# Task
You should write a program that when a button is pressed, it outputs a different sound for each key.
The keys that you will use are:
```
1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm
```
The notes begin at `C` and each key above adds one semitone.
Lets make it slightly easier f... |
[Question]
[
Given an non-negative integer \$n \ge 0\$, output forever the sequence of integers \$x\_i \ge 3\$ that are palindromes in exactly \$n\$ different bases \$b\$, where the base can be \$2 \le b le x\_i-2\$.
This is basically the inverse of [OEIS A126071](https://oeis.org/A126071), where you output which... |
[Question]
[
Given a string n, create a pyramid of the string split into pieces relative to the current row.
The first row contains the string unmodified.
The second row contains the string separated into halves by a pipe.
The third row separates it by thirds...
And so on. The length of each substring, where l ... |
[Question]
[
Given an expression, your task is to evaluate it. However, your answer cannot show more digits than necessary, as this gives the impression of having more precise measurements than reality.
The number of significant figures that a number has is how many digits it has when written in scientific notati... |
[Question]
[
I have a list, `l` and a function `f`. `f` is not strictly increasing or decreasing. How can I find the item in the list whose `f(item)` is the smallest? For example, let's say the list is:
```
l = [1, 2, 3, 4]
```
and `list(f(x)for x in l)` is:
```
[2, 9, 0, 3]
```
`f(3)` is smaller than f of any of... |
[Question]
[
When I was a child, I used to play this game a lot.
### Rules
There are two players (let's call them A and B), and each player uses his hands as guns. There are three possible moves:
1. Hands up to load ammunition to your gun.
Each gun starts empty. Loading increases the ammunition by one.
2. Hands ... |
[Question]
[
### Introduction
[I Ching](https://en.wikipedia.org/wiki/I_Ching) is an ancient divination text and the oldest of the Chinese classics. It uses a type of divination called cleromancy, which produces apparently random numbers.
The basic unit of the Zhou yi is the [hexagram](https://en.wikipedia.org/wi... |
[Question]
[
When dealing with long numbers when code golfing, getting the length of your code down can be difficult, so do you have any tips for making a number shorter and easier to manage?
For example, the following Pyth code prints "Hello world", but at 44 bytes, that is unsatisfactory:
```
Vcjkj8594200077544... |
[Question]
[
Write a function (such as `placeAt`) that takes an array of non-negative integers and an index that is a non-negative integer. It should place a 1 at the given index, possibly shifting other entries by one spot to vacate that spot, with 0's standing for empty spots.
* If the entry at the desired inde... |
[Question]
[
# The game
[Nim](https://en.wikipedia.org/wiki/Nim) is a mathematical strategy game, where 2 players take turns taking items from distinct heaps. On your turn, you must take at least one item, and you may take as many as you want, provided that you only take from one heap. The player that takes the l... |
[Question]
[
*This is one of several [challenges](http://meta.codegolf.stackexchange.com/a/2007/21682) left for the community by [Calvin's Hobbies](https://codegolf.stackexchange.com/users/26997/calvins-hobbies).*
The curve that an idealised hanging rope or chain makes is a [catenary](http://en.wikipedia.org/wiki... |
[Question]
[
# Menu Shortcuts
Traditionally, user menus are accessible by keyboard shortcuts, such as `Alt + (a letter)`, or even simply hitting the letter when all textboxes are unfocused ([gmail](https://support.google.com/mail/answer/6594?hl=en) style).
# Your task
Given the menu entries as an input, your task... |
[Question]
[
To solve the [Halting Problem](https://en.wikipedia.org/wiki/Halting_problem) you are given a description of a program, and must determine whether or not it will ever finish. You can never do this for all programs. Yet for programs like (in [brainf\*\*\*](http://esolangs.org/wiki/Brainfuck)):
```
>
`... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win.
Closed 6 years ago.
[Improve this que... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic).
Closed 7 years ag... |
[Question]
[
## Summary
The aim of this challenge is to write a *tenacious* program. This is a stateful program designed to output a given string, but for which, if the program is aborted at any point during the writing of the string, rerunning the program will continue where it left off, writing only the charact... |
[Question]
[
Given two strings \$A\$ and \$B\$ with edit (Levenshtein) distance \$x\$, find a third string with edit distance \$a\$ to \$A\$ and edit distance \$b\$ to \$B\$ so that \$a+b=x\$ and \$a=int(x/2)\$ (that is half of \$x\$ rounded down to the nearest integer).
The input is the two strings \$A\$ and \$B... |
[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/258728/edit).
Closed 12 months ago.
[Improve this question](/posts/258728/e... |
[Question]
[
## Bounty
One of the convincing conjectures, by Loopy Walt is,
```
maxlib(n) = 0, if n = 1
2, if n = 2
6, if n = 3
(2n - 1)⌊n / 3⌋, if n % 3 = 0
(2n - 1)⌊n / 3⌋ + n, if n % 3 = 2
2n⌊n / 3⌋ + 1, otherwise
```
Loopy Walt's post below explains ... |
[Question]
[
A [complete Boolean](https://en.wikipedia.org/wiki/Functional_completeness) function is a function such that, an amount of them can be used to express any Boolean function. For example, NAND \$\left[\begin{matrix}\text{input1}&0&0&1&1\\\text{input2}&0&1&0&1\\\text{output}&1&1&1&0\end{matrix}\right]\$... |
[Question]
[
# Challenge
The challenge is to implement the [bottom](https://github.com/bottom-software-foundation/spec) encoding (only encoding, not decoding). There is a wide variety of existing implementations in the [bottom-software-foundation org](https://github.com/bottom-software-foundation).
Bottom is a te... |
[Question]
[
## Challenge
We once had [a challenge to count domino tilings of m by n grid](https://codegolf.stackexchange.com/q/55240/78410), and we all know that, for any fixed number of rows, the number of domino tilings by columns forms a linear recurrence. Then why not have a challenge to compute **the linear... |
[Question]
[
## Problem Description
We all love a Twix (because it is the best candy), but this is the kids' first Halloween --- we gotta grab at least one of each type of candy for them. Each Halloween all the residents of Numberline avenue send out an email saying what types of candy they'll be giving away this... |
[Question]
[
Given three non-negative integers `y`, `m`, and `d` (of which at least one must be positive) and a valid date with a positive year (in any reasonable format that includes the year, month, and day, and no additional information), output the date that is `y` years, `m` months, and `d` days after the or... |
[Question]
[
For this task your code should take two sorted arrays of integers X and Y as input. It should compute the sum of the absolute distances between each integer in X and its closest number in Y.
Examples:
```
X = (1 5,9)
Y = (3,4,7)
```
The distance is 2 + 1 + 2.
```
X = (1,2,3)
Y = (0,8)
```
The distan... |
[Question]
[
As a fan of an at most moderately successful footballBE team, towards the end of the season I often wonder whether my favourite team still has any theoretical chance left of becoming champion. Your task in this challenge is to answer that question for me.
# Input
You will recieve three inputs: the c... |
[Question]
[
## Introduction
### Rules of the puzzle:
The puzzle Binary (also known as [Takuzu](https://en.wikipedia.org/wiki/Takuzu) or Subiku) is very simple to understand, and has only a few rules:
Since the name of the game is binary it's pretty obvious, but you can only fill in zeros and ones.
1. No more t... |
[Question]
[
# Background
Many esoteric programming languages don't have numbers built in at literals, so you have to calculate them at runtime; and in many of these cases, the number representation can be quite interesting. We've already had [a challenge](https://codegolf.stackexchange.com/q/26207/62131) about r... |
[Question]
[
Write a function which takes a set of integers and prints every permutation of the set, and the swap performed in between each step
### Input
a set of integers, for example (0, 1, 2)
### Output
the list of permutations and swaps in the format
(set)
(swap)
(set)
...
### Test case
```
Input:
(3, 1, 5)... |
[Question]
[
# Definition
* Two integers are **coprime** if they share no positive common divisors other than `1`.
* `a(1) = 1`
* `a(2) = 2`
* `a(n)` is the smallest positive integer which is coprime to the `a(n-1)` and `a(n-2)` and has not yet appeared, for integer `n >= 3`.
# Task
* Given positive integer `n`, ... |
[Question]
[
A binary recurrence sequence is a recursively-defined sequence of the following form:
$$F(1) = a\_1 \\ \vdots \\ F(y) = a\_y \\
F(n) = \alpha F(n-x) + \beta F(n-y), n > y$$
This is a generalization of the Fibonacci (\$x = 1, y = 2, a = [1, 1], \alpha = 1, \beta = 1\$) sequence and the Lucas (\$x = 1,... |
[Question]
[
In [this challenge about prefix code](https://codegolf.stackexchange.com/questions/79092/is-it-a-prefix-code), we learnt that prefix codes are uniquely concatenable.
That means, they can be joined together without separator, and without ambiguity.
For example, since [1,2,45] is a prefix code, I can j... |
[Question]
[
Paper stars are a big thing in my family at christmas, so I thought a virtual one would be cool.
Below is an image of a **regular dodecahedron** (from <https://en.wikipedia.org/wiki/Dodecahedron>, attributed to the author mentioned there.)
[, the [horseshoe map](https://en.wikipedia.org/wiki/Horseshoe_map) is an example of how chaos arises in a simple process of folding and squashing. It goes like this: take an imaginary piece of dough, fold it, and finally squash it to its or... |
[Question]
[
This challenge is inspired by [a SO question](https://stackoverflow.com/questions/1779199/traverse-matrix-in-diagonal-strips) about traversing a matrix by enumerating all its diagonal strips.
Instead of a matrix, consider a block of text:
```
ABCD
EFGH
IJKL
```
Traversing this block's SW-NE diagonals... |
[Question]
[
### Task
Write a program that reads three integers **m**, **n** either from STDIN or as command-line arguments, prints all possible tilings of a rectangle of dimensions **m × n** by **2 × 1** and **1 × 2** dominos and finally the number of valid tilings.
Dominos of an individual tiling have to be rep... |
[Question]
[
This challenge is partly an algorithms challenge, partly an optimization challenge and partly simply a fastest code challenge.
A T matrix is fully specified by its first row `r` and first column `c`. Each remaining element of the matrix is just a copy of the element that is diagonally up and left. Th... |
[Question]
[
# Background
For the purposes of this challenge, an *`n`-state cellular automaton* is simply a binary function `f` that takes two numbers from the state set `{0, 1, ..., n-1}` as inputs, and returns another number from that set as output.
It can be applied to a list of numbers `L = [x0, x1, x2, ..., ... |
[Question]
[
You have to write a program, implementing a function `digitsum(int i)`. The program has to modify its own code (for languages, where this is not possible with f.e. [reflection](http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29), please be creative) to get itself to solve the goal.
Yo... |
[Question]
[
The goal of a [rosetta-stone](/questions/tagged/rosetta-stone "show questions tagged 'rosetta-stone'") challenge is to write solutions in as many languages as possible. Show off your programming multilingualism!
In this challenge, you will create a program that will generate spam messages, given an i... |
[Question]
[
(The \$\mathbb{Q}\$ in the title means rational numbers.)
## Background
[**Conway base 13 function**](https://en.wikipedia.org/wiki/Conway_base_13_function) is an example of [a strongly Darboux function](https://en.wikipedia.org/wiki/Darboux%27s_theorem_(analysis)#Darboux_function), a function that t... |
[Question]
[
*Infinite Snake* is just like the video game [Snake](https://en.wikipedia.org/wiki/Snake_(video_game_genre)), except for that the snake is infinitely long, there are no items to eat, and the Snake needs to move in a repeating `n`-step move pattern (e.g. right, up, right, up, right, down). The only co... |
[Question]
[
Given two contiguous shapes of the same area, determine the optimal way to divide the first shape into a minimum number of contiguous segments such that they can be rearranged to form the second shape. In other words, find the minimum number of segments required that can form both of the shapes.
"Con... |
[Question]
[
Challenge Taken with permission from my University Code Challenge Contest
---
The dependence we have on mobile phones makes us charge them every night up to the maximum level of the battery, so we do not run the risk of running out of power by the middle of the next day. There are even people who, wh... |
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.