text stringlengths 180 608k |
|---|
[Question]
[
A [repdigit](https://en.wikipedia.org/wiki/Repdigit) is a natural number that can be written solely by repeating the same digit. For example, `777` is a repdigit, since it's solely composed of the digit `7` repeated three times.
This isn't limited to simply decimal (base 10) numbers, however:
* Every M... |
[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/26855/edit).
Closed 7 years ago.
[Improve this question](/p... |
[Question]
[
You will be given as input an infinite stream of positive integers.
Your task is to write a program which outputs an infinite sequence of lists with two requirements:
* All lists in the output are finite sub-lists of the input stream.
* Every sub-list must be output *eventually* by your program.
Sub-li... |
[Question]
[
The [Kempner series](https://en.wikipedia.org/wiki/Kempner_series) is a series that sums the inverse of all positive integers that don't contain a "9" in their base-10 representations (i.e., \$\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + .. + \frac{1}{8} + \frac{1}{10} + ...\$).
It can be shown that, unli... |
[Question]
[
## Challenge
Given an arbitrary list of 2-tuples, and a single element in one of those tuples, output its "partner", i.e. given `a` and `[(i,j),...,(a,b),...,(l,m)]`, output `b`. You can assume all tuples are unique, and that all elements in tuples are strings. Further assume you do not have both `(x,y... |
[Question]
[
You will be given a String that only contains letters of the English Alphabet, both lowercase and uppercase (ASCII 65-90 and 97-122). Your task is to output the Fizz-Buzzified version of the String.
### How to Fizz-Buzzify a String?
* Each letter that has an even index in the English alphabet (the alph... |
[Question]
[
# Problem
Inspired by a [previous challenge](https://codegolf.stackexchange.com/questions/125383/draw-a-big-slash-x) doing something similar
Given positive integer input `n` output a shape that follows this pattern:
input `n=1`:
```
* *
*
* *
```
input `n=2`:
```
** **
****
**
****
** **
```
inp... |
[Question]
[
We often see music videos on Youtube. Many Youtube channels that host music videos are "powered by VEVO". Those can be easily identified by both embedding VEVO at their video thumbnails and appending VEVO to their channel name.
Now write some code to test whether a string given by user is a VEVO user a... |
[Question]
[
In this challenge, you will be given a square matrix `A`, a vector `v`, and a scalar `λ`. You will be required to determine if `(λ, v)` is an eigenpair corresponding to `A`; that is, whether or not `Av = λv`.
# Dot Product
The dot product of two vectors is the sum of element-wise multiplication. For ex... |
[Question]
[
You are given a multi-dimensional array of integers. Each dimension has a fixed size (so that it would be always rectangular if it is 2D). Your program should calculate the sums in each dimension and append the sums as the new last items in that dimension.
Assume the input and output arrays are A and B... |
[Question]
[
You are given a square \$n \times n\$ matrix \$A\$, and a list (or vector) \$u\$ of length \$n\$ containing the numbers \$1\$ through \$n\$ (or \$0\$ through \$n-1\$). Your task is to reorder the columns **and** rows of the matrix \$A\$ according to the order specified in \$u\$.
That is, you will cons... |
[Question]
[
Given a decimal number `k`, find the smallest integer `n` such that the square root of `n` is within `k` of an integer. However, the distance should be nonzero - `n` cannot be a perfect square.
Given `k`, a decimal number or a fraction (whichever is easier for you), such that `0 < k < 1`, output the sm... |
[Question]
[
### Background
[Jelly](https://github.com/DennisMitchell/jelly)'s arithmetic atoms vectorize automatically. In fact, **x + y** is well-defined whenever **x** and **y** are numbers or ragged arrays of numbers. Jelly's source code implements this behavior using a generic vectorizer, but for this challeng... |
[Question]
[
You will be given as input a non-empty list of positive integers. For example:
```
[1,2,2,2,1]
```
You want to produce a ragged list as output which has this as its "depth map". This list should have the same elements in the same order but each element `n` should be at the depth equal to its value.
```... |
[Question]
[
Given a strictly positive integer **n**, follow these steps:
1. Create an array **A** with **n** **1**s.
2. If **A** only has one element, terminate. Otherwise, starting from the first element, replace each pair of **A** with its sum, leaving the last element as is if **A**'s length is odd, and repeat ... |
[Question]
[
Challenge Taken with permission from my University Code Challenge Contest
---
For some years now, the number of students in my school has been growing steadily. First the number of students was increased by classroom, but then it was necessary to convert some spaces for some groups to give classes ther... |
[Question]
[
In chess, a knight can only move to the positions marked with X relative to its current position, marked with ♞:
[](https://i.stack.imgur.com/uYFbI.png)
---
A [Knight's Graph](https://en.wikipedia.org/wiki/Knight%27s_graph) is a graph that ... |
[Question]
[
Quick musical refresher:
The piano keyboard consists of 88 notes. On each octave, there are 12 notes, `C, C♯/D♭, D, D♯/E♭, E, F, F♯/G♭, G, G♯/A♭, A, A♯/B♭` and `B`. Each time you hit a 'C', the pattern repeats an octave higher.
[](http... |
[Question]
[
*This is the cops' thread of a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge. The robbers' thread can be found [here](https://codegolf.stackexchange.com/questions/251451/polyglot-quiz-robbers-thread)*
In this challenge as a cop you will choo... |
[Question]
[
In this challenge you will be given a list of positive integers which represents some range of integers which has been truncated for display. Your job is to find the missing bits and insert ellipses to show that that part has been truncated.
The input will always be strictly ascending and if two consec... |
[Question]
[
Create a function which given a number of lines `n`, makes a `bigA`.
* The horizontal bar of `bigA` must be at the middle row, or the lower of the two if `n` is even
* Assume a monospace font for output
Output should be a string (or similar, eg character array) with clear linebreaks to break up the lin... |
[Question]
[
Haskell has tuples that can be written as
```
(a,b,c)
```
However this is just syntactic sugar for
```
(,,)a b c
```
In general an **n** tuple can be formed with **n-1** `,`s between `(`...`)` followed by its elements separated by spaces. For example the 7-tuple, `(1,2,3,4,5,6,7)` can be formed by
```
... |
[Question]
[
I recently stumbled across [this image](https://commons.wikimedia.org/wiki/File:Tesseract_Hasse_diagram_with_nibble_shorthands.svg) on wikimedia commons. It's a little bit of an information overload at first, but after examining it a bit it shows an interesting number system for writing nibbles.
[![Tes... |
[Question]
[
## Definition
Given a matrix \$M\$ of non-negative integers and a non-negative integer \$k\$, we define \$F\_k\$ as the "chop-off" function that removes all rows and all columns in \$M\$ that contain \$k\$.
*Example:*
$$\begin{align}M=\pmatrix{\color{red}6&\color{red}1&\color{white}{\bbox[red,1pt]{5}}\... |
[Question]
[
[Pascal's triangle](https://en.wikipedia.org/wiki/Pascal%27s_triangle) is generated by starting with `1` and having each row formed from successive additions. Here, instead, we're going to form a triangle by alternating multiplication and addition.
We start row `1` with just a solitary `1`. Thereafter,... |
[Question]
[
The task is the following. Given an integer `x` (such that `x` modulo `100000000003` is not equal to `0`) presented to your code in any way you find convenient, output another integer `y < 100000000003` so that `(x * y) mod 100000000003 = 1`.
You code must take less than 30 minutes to run on a standar... |
[Question]
[
Given a list with number, output the ranges like this:
Input: `[0, 5, 0]` would become `[0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]`.
This is mapping a range through the array, so we first have to create the range `[0, 5]`, which is `[0, 1, 2, 3, 4, 5]`. After that, we use the `5` to create the range `[5, 0]`. A... |
[Question]
[
**Disclaimer: the content of this post *is not medical information* and should not be used for any medical purpose, as it is deliberately oversimplified for the purpose of the challenge.**
There are several different strains of [*Neisseria meningitidis*](https://en.wikipedia.org/wiki/Neisseria_meningit... |
[Question]
[
Totally not inspired by Lyxal repeatedly mentioning elevators in chat :P
## Challenge
In short: simulate some people filling up an elevator and then leaving it.
The elevator is simplified as a grid, where each person can occupy one cell of the grid. The height and width of the grid is the input paramet... |
[Question]
[
Let's build an advent Calendar for this Christmas!
Many Advent calendars for children take the form of a large rectangular card with numbered windows for each day of December starting from 1 ( although advent time begins on Advent Sunday, which is the fourth Sunday before Christmas day and often happen... |
[Question]
[
[Related OEIS sequence: A008867](http://oeis.org/A008867)
## Truncated triangular number
A common property of triangular numbers is that they can be arranged in a triangle. For instance, take 21 and arrange into a triangle of `o`s:
```
o
o o
o o o
o o o o
o o o o o
o o o o o o
```
Let's... |
[Question]
[
## Introduction
A decimal is terminating if it has a finite number of decimal digits. For example, 0.4 (2/5) is terminating because it has one decimal digit.
A decimal is purely periodic if it has an infinite number of decimal digits and has no decimal digits before its repetent (the part of the decima... |
[Question]
[
Given an unsorted list of unique, positive integers, output the shortest list of the longest possible ranges of sequential integers.
# INPUT
* An unsorted list of unique, positive integers
+ e.g. `9 13 3 11 8 4 10 15`
* Input can be taken from any one of the following:
+ `stdin`
+ command-line argum... |
[Question]
[
[Rijndael's S-box](http://en.wikipedia.org/wiki/Rijndael_S-box) is a frequently used operation in [AES](http://en.wikipedia.org/wiki/Advanced_Encryption_Standard) encryption and decryption. It is typically implemented as a 256-byte lookup table. That's fast, but means you need to enumerate a 256-byte l... |
[Question]
[
Your task: given a nonzero positive number `i`, calculate pi using the Nilakantha series unto `i` terms.
The Nilakantha series is as follows:
$$\text 3 + \frac{4}{2 \times 3 \times 4} - \frac{4}{4 \times 5\times 6}+\frac{4}{6 \times 7 \times 8} - ...$$
3 is the first term, `4/2*3*4` is the second, `-4/... |
[Question]
[
Your task is to take a positive number as input, **n**, and output the length of the longest rep-digit representation of **n** in any base. For example 7 can be represented as any of the following
```
111_2
21_3
13_4
12_5
11_6
10_7
7_8
```
The rep-digits are `111_2` and `11_6`, `111_2` is longer so our... |
[Question]
[
In English, there is the fun and simple difference between `an` and `a`: you use `an` when preceding a word starting with a vowel sound, and `a` when the word starts with a consonant sound.
For the sake of simplicity in this challenge, `an` precedes a word that starts with a vowel (`aeiou`), and `a` p... |
[Question]
[
Write a program or function that takes in two integers that represent the X and Y coordinates of a point on a [Cartesian plane](https://en.wikipedia.org/wiki/Cartesian_coordinate_system).
The input may come in any reasonable format as long as the X value comes before the Y. For example, `1 -2`, `(1,-2)... |
[Question]
[
Given the following input:
* An integer `n` where `n > 0`.
* A string `s` where `s` is not empty and `s~=[0-9A-Z]+` (alpha-numeric capitals only).
Using a standard, simplified QWERTY keyboard (as shown below):
```
1234567890
QWERTYUIOP
ASDFGHJKL
ZXCVBNM
```
Perform the following operation:
* Find the o... |
[Question]
[
Inspired by [this Math.SE question](https://math.stackexchange.com/questions/2560570/do-fibonacci-numbers-reach-every-number-modulo-m).
# Background
The [Fibonacci Sequence](https://en.wikipedia.org/wiki/Fibonacci_number) (called `F`) is the sequence, starting `0, 1` such that each number (`F(n)`) (aft... |
[Question]
[
The crazy mathematician owns a wide collection of numbers, and therefore the space he has left is quite limited. To save some, he must fold his integers, but unfortunately he is really lazy. Your task, if you wish to help him, is to create a function / program that folds a given positive integer for ou... |
[Question]
[
It's Friday... so let's go golfing! Write code that determines the player's scoring on a hole in a game of golf. The code can be either a function or entire program. As the genre suggests, shortest code wins.
Input (parameters or stdin, your choice):
* An integer representing the hole's par, guaranteed... |
[Question]
[
What general tips do you have for golfing in T-SQL? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to T-SQL. Please post one tip per answer.
Thanks to Marcog for the original idea. :)
[Answer]
My general bag of tricks::
* `@` is a val... |
[Question]
[
# Code Golf Challenge
I have an isdue, my fingrrs are fat and I freqintly jave an isdue of ty[ing one keystrpke to the right on my kryboard.
I'm afraid the isdue is getyng worse anf worsr as time goes on.
Sopn every keystrpke I make wil; be shiftrd pne to the right!
Befpre then I'd like a program (or f... |
[Question]
[
Today we're going to build a pyramid out of letters! Here's an example letter pyramid for the first 5 letters:
1. Write the first 5 letters with a space between, first ascending and then descending.
```
A B C D E D C B A
```
2. Do the same thing for the first four letters on the line above, but with tw... |
[Question]
[
You task for today: draw a dragon curve!
In case you don't know what a Dragon Curve is, [here](https://youtu.be/EdyociU35u8) is an introductory ViHart video (Really cool, please watch!)
Your task: draw a dragon curve, iterated at least 9 times. You don't have to show iterations 1 through 9, you just ha... |
[Question]
[
Given two *non empty* lists of integers, your submission should calculate and return the *discrete convolution* of the two. Interestingly, if you consider the list elements as coefficients of polynomials, the convolution of the two lists represents the coefficients of the product of the two polynomials... |
[Question]
[
# Input
Your input in this challenge is a list of integer pairs. They represent the southwest corners of unit squares on the plane, and the list represents their union as a subset of the plane. For example, the list
```
[(0,0),(1,0),(0,1),(1,1),(2,1),(1,2),(2,2)]
```
represents the red-colored set in t... |
[Question]
[
...so this is a challenge to make me a tree.
Produce a program or function called tree which takes a single integer argument, N and draws a Pythagorean Tree N levels deep, where level 0 is just the trunk.
Each junction of the tree should place the vertex of the triangle at a random point on the perimet... |
[Question]
[
*Inspired by [the problem with the same name](https://puzzling.stackexchange.com/questions/110490/largest-number-with-no-repeating-digit-pairs) on [Puzzling SE](https://puzzling.stackexchange.com) by our very own [Dmitry Kamenetsky](https://codegolf.stackexchange.com/users/92610/dmitry-kamenetsky).*
Yo... |
[Question]
[
The *binary-square-diagonal-sequence* is constructed as follows:
1. Take the sequence of positive natural numbers:
```
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ...
```
2. Convert each number to binary:
```
1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111... |
[Question]
[
**This question already has answers here**:
[Find the Pisano Period](/questions/8765/find-the-pisano-period)
(12 answers)
Closed 8 years ago.
The Fibonacci sequence is a well known and famous sequence, where each successive element is the sum of the previous two. A modular Fibonacci sequence is ... |
[Question]
[
The Hamming(7,4) code goes back to 1950. Back then Richard Hamming worked as a mathematician at Bell Labs. Every Friday Hamming set the calculating machines to perform a series of calculation, and collected the results on the following Monday. Using parity checks, these machines were able to detect err... |
[Question]
[
# Introduction
How to prove that 1 = 2:
```
1 = 2
2 = 4 (*2)
-1 = 1 (-3)
1 = 1 (^2)
```
You can just multiply both sides by 0, but that's cheating. This is just bending the rules a little bit.
# Your challenge:
Write a program/function that, when given two integers, outputs a "proof" that the two are ... |
[Question]
[
Língua do Pê, or P Language, is a language game spoken in Brazil and Portugal with Portuguese. It is also known in other languages, such as Dutch and Afrikaans. ([Wikipedia](https://en.wikipedia.org/wiki/L%C3%ADngua_do_P%C3%AA))
There are some dialects in this language game. The different languages the... |
[Question]
[
## Happy birthday to Me!
Write a program that prints `Happy birthday to me!` on its birthday.
1. The program's birthday is the creation, last modification or compilation time of the program (you choose), and must not be hard-coded.
2. The date you use as the birthday must not be affected by the program... |
[Question]
[
This challenge initially appeared in [this challenge](https://codegolf.stackexchange.com/questions/141315/) as a an extra brain teaser. I am posting it with permission from the original author so that we can have a formal competition.
---
Your task here will be to implement a function1 that forms a pe... |
[Question]
[
## ...or Toroidal Moore Neighbourhoods
Given positive integers `h`, `w` and a non-negative integer `i`, return all of the indices surrounding `i`.
You are to assume a matrix consisting of `h` rows of `w` elements, numbered from lowest, in the top left-hand corner, to highest, in the bottom right-hand c... |
[Question]
[
Given a fraction in the format `m/n` (where m and n are coprime integers), output the corresponding Unicode fraction. Your program/function will not be expected to take in any input that does not correspond to a Unicode character. Arrays, e.g. `[2, 3]` as opposed to `2/3`, are accepted. `m / n` as oppo... |
[Question]
[
Given a polynomial function *f* (e.g. as a list *p* of real coefficients in ascending or descending order), a non-negative integer *n*, and a real value *x*, return:
# *f* n(*x*)
i.e. the value of *f* (*f* (*f* (…*f* (*x*)…))) for *n* applications of *f* on *x*.
Use reasonable precision and rounding... |
[Question]
[
Given an integer between 0 and 141 (inclusive), list all 24-hour times whose hour, minute, and second units add to that integer.
**Rules of addition**
Numbers are added by their time units, not by single digits.
For example, take 17:43:59
17+43+59=119
Remember, that is an example of digits being *adde... |
[Question]
[
Given an integer `N > 1`, output all other numbers which prime decompositions have the same digits as the prime decomposition of `N`.
For example, if `N = 117`, then the output must be `[279, 939, 993, 3313, 3331]`, because
```
117 = 3 × 3 × 13
```
therefore, the available digits are `1`, `3`, `3` and ... |
[Question]
[
In the strategy game ["Hexplode"](https://en.wikipedia.org/wiki/Hexplode), players take turns placing tokens on a hexagonal board. Once the number of tokens equals the number of adjacent tiles, that tile *hexplodes*, and moves all of the tokes on it to the surrounding neighbors. You can play the game o... |
[Question]
[
# Symbolic Differentiation 1: Gone Coefishin'
## Task
Write a program that takes in a polynomial in *x* from stdin (1 < deg(p) < 128) and differentiates it. The input polynomial will be a string of the following form:
```
"a + bx + cx^2 + dx^3 +" ...
```
where the coefficient of each term is an integer... |
[Question]
[
## Background
[**Penney's game**](https://en.wikipedia.org/wiki/Penney%27s_game) is a two-player game about coin tossing. Player A announces a sequence of heads and tails of length \$n\$, then player B selects a different sequence of same length. The winner is the one whose sequence appears first as a ... |
[Question]
[
When you look at the last decimal digit of each power of a non-negative integer a repeating pattern forms. For example, 3:
```
3^1 = 3
3^2 = 9
3^3 = 27
3^4 = 81
3^5 = 243
3^6 = 729
3^7 = 2187
3^8 = 6561
3^9 = 19683
```
The last digits go `3971` which repeats indefinitely. In fact an... |
[Question]
[
You're at integer coordinates \$(x,y)\$ facing one of North, South, East, or West. Your goal is to walk home to \$(0,0)\$. At each step, you may do one of:
* Walk one step in the current facing direction, that is to whichever of \$(x+1,y)\$, \$(x-1,y)\$, \$(x,y-1)\$, or \$(x,y+1)\$ you're facing.
* Rot... |
[Question]
[
Your mission is to build an algorithm (program or function) that can optimize packing fruit from a conveyor belt into bags to be sent off to retailers, optimizing for a largest number of bags.
Each bag has to weight at least a certain amount, but any excess is lost profit since that weight could be use... |
[Question]
[
The [Collatz conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture) postulates that if you take any positive integer, then repeat the following algorithm enough times:
```
if number is odd, then multiply by three and add one
if number is even, then divide by two
```
you'll eventually end up at 1... |
[Question]
[
[The Goldbach conjecture](https://en.wikipedia.org/wiki/Goldbach%27s_conjecture) states that every even number greater than two can be expressed as the sum of two primes. For example,
```
4 = 2 + 2
6 = 3 + 3
8 = 5 + 3
```
However, once we get to 10 something interesting happens. Not only can 10 be writ... |
[Question]
[
Write a program or function that takes in a multiline string of `0`'s and `1`'s. No other characters will be in the string and the string will always be rectangular (all lines will have same number of characters), with dimensions as small as 1×1, but otherwise the `0`'s and `1`'s may be arranged arbitr... |
[Question]
[
In this challenge, you're given a list of overlapping waves. Each wave is a finite list with `n` truthy values, then `n` falsy values, then `n` truthy and so on, where `n` is the wavelength (or half the wavelength I guess, but it really doesn't matter in this challenge). The values of a wave may have a... |
[Question]
[
There exists a bijection between the natural and rational numbers that works (approximately) like this:
1. You create a 1-indexed 2-dimensional grid.
2. In every field of this grid with position `(x, y)`, put the number `x / y`.
3. You start at `(1,1)` and iterate over the field in the following way:
[... |
[Question]
[
[Landau's function](https://en.wikipedia.org/wiki/Landau%27s_function) \$g(n)\$ ([OEIS A000793](https://oeis.org/A000793)) gives the maximum order of an element of the symmetric group \$S\_n\$. Here, the order of a permutation \$\pi\$ is the smallest positive integer \$k\$ such that \$\pi^k\$ is the id... |
[Question]
[
**This is Hole-3 from [*The Autumn Tournament* of APL CodeGolf](https://apl.codegolf.co.uk/problems#3). I am the original author of the problem there, and thus allowed to re-post it here.**
---
Given:
1. a number of turns (please state if no movements is 0, otherwise we'll assume it is called 1) and
2.... |
[Question]
[
Whenever you make a move on a Rubik's Cube, there is a reverse move which undoes the first move. Because of this, every algorithm (set of moves) has a reverse algorithm which undoes the first algorithm.
The goal of this challenge is to find the reverse of a given algorithm.
# Specification:
The input c... |
[Question]
[
Earlier, we did the [pseudofactorial](https://codegolf.stackexchange.com/questions/82494/pseudofactorial) of a number, which is the LCM of the numbers from `1` to `n`.
It would be useful in adding fractions together.
However, we find that the denominator of `1/1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6` is `20` i... |
[Question]
[
... Ah sorry, no popcorn here, just POPCNT.
Write the shortest **program** or **function** which takes in a number `n` and **output** all integers from 0 to 2n - 1, in ascending order of *number of 1 bits in the binary representation of the numbers* (popcount). No duplicates allowed.
The order of numbe... |
[Question]
[
Inspired by the [Google Code Challenge](https://code.google.com/codejam/contest/351101/dashboard#s=p2):
>
> The Latin alphabet contains 26 characters and telephones only have ten digits on the keypad. We would like to make it easier to write a message to your friend using a sequence of keypresses to i... |
[Question]
[
This is different from [Floating Point XOR](https://codegolf.stackexchange.com/questions/192862/floating-point-xor), and more in the spirit of a comment by R.. GitHub STOP HELPING ICE on that challenge, but I thought of this idea independently.
## Generalized XOR
The bitwise exclusive or (XOR) operatio... |
[Question]
[
For our purposes, a trend is a contiguous subsequence of an array that falls into one of three categories:
* increasing, e.g. `[1,2,3,10,239]`
* decreasing, e.g. `[8,5,0,-3,-50]`
* stable, e.g. `[7,7,7,7]`
Note that `[1,1,2,3]` is not a valid trend. It can be broken up into a stable trend `[1,1]` and a... |
[Question]
[
>
> And no, This is not a dupe of [Translate ASCII text to braille](https://codegolf.stackexchange.com/questions/32924/translate-ascii-text-to-braille).
>
>
>
There are 28=256 [Braille patterns](https://en.wikipedia.org/wiki/Braille_Patterns) in Unicode. (By 'Braille' I mean 8-cell ones)
W, wait. H... |
[Question]
[
I recently saw [this](https://stackoverflow.com/questions/36260956/all-possible-ways-to-interleave-two-strings) question on stackoverflow. It's a great question, but there's one fatal problem with the question. They are asking for the best way to do it. E.g, easiest to read, most idiomatic, neatest etc... |
[Question]
[
Consider the function `Remove(n, startIndex, count)` that removes `count` digits from the number `n` starting from the digit at position `startIndex`. Examples:
```
Remove(1234, 1, 1) = 234
Remove(123456, 2, 3) = 156
Remove(1507, 1, 2) = 07 = 7
Remove(1234, 1, 4) = 0
```
We will call the prime number X... |
[Question]
[
The goal is to produce a single line of R code that:
1. Does as little as possible
2. In as many characters as possible (max of 100 characters)
3. And is as ugly as possible (where "ugly" can be taken to mean inefficient computational strategies, extraneous characters such as a terminating semicolon, a... |
[Question]
[
Related: [Name the poker hand](https://codegolf.stackexchange.com/questions/6494/name-the-poker-hand)
>
> A straight flush is a poker hand containing five cards of sequential rank, all of the same suit. As part of a straight flush, an ace can rank either above a king or below a two. An ace can rank ei... |
[Question]
[
Take a matrix of positive integers as input, and output the individual sums of the elements on the diagonal lines through the matrix.
You shall only count the lines that goes diagonally down and to the right. You must start with the diagonal that contains only the bottom-left element, then the length-... |
[Question]
[
# [The Baum-Sweet Sequence (A086747 with a Twist)](https://oeis.org/A086747)
Take in a positive integer `n` and print the integers from 1 to n for which the Baum-Sweet sequence returns true. The Baum-Sweet sequence should return **falsy** if the binary representation of the number contains an odd numbe... |
[Question]
[
I like to play [(*The Settlers of*) *Catan*](https://en.wikipedia.org/wiki/Catan) on [Board Game Arena](https://boardgamearena.com) with totally random number tokens. These tokens determine the production rate of the terrain tiles beneath:

There are 18 number to... |
[Question]
[
Note to those without experience in music: Through making an attempt to solve this problem, you may find that music and computer programming are similar in the ways that they implement rules and syntax. With some help from Wikipedia, you can likely solve this problem with no prior knowledge of music th... |
[Question]
[
[Lucky numbers](https://en.wikipedia.org/wiki/Lucky_number) ([A000959](https://oeis.org/A000959)) are numbers generated by applying the following sieve:
Begin with the list of natural numbers:
```
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, ...
```
Now, re... |
[Question]
[
## Challenge:
## Input:
Two integer parameters `a` and `b` (where `a<b` and the difference is at least 2)
## Output:
Output or return this text, where `a` and `b` are filled in:
```
(a,b) = ]a,b[ = {a<x<b} = {a<x&&x<b} = a+1..b-1
[a,b) = [a,b[ = {a<=x<b} = {a<=x&&x<b} = a..b-1
(a,b] = ]a,b] = {a<... |
[Question]
[
The least common multiple (LCM) of a set of numbers `A` is the smallest integer `b` such that `b/a` is an integer for all integers `a` in `A`. This definition can be extended to rational numbers!
# Task
Find the smallest positive **rational** `b` such that `b/a` is an **integer** for all **rationals** ... |
[Question]
[
We have a strictly increasing sequence of non-negative integers, like:
```
12 11 10
```
Wait! This sequence isn't strictly increasing, is it? Well, the numbers are written in different bases. The least possible base is 2, the biggest is 10.
The task is to guess bases each number is written, so that:
* ... |
[Question]
[
Arrr... Ahoy there, me maties! Unfurl tha' mainsail! Full to starboard! Ah, feel th' wind in yer hair!
Right, me hearties... I be needin' a bit of yer codin' skills! Me crew are a li'l more modernized than meself... I still be preferrin' th' points of th' compass (see [here](http://en.wikipedia.org/wik... |
[Question]
[
Given two positive integers **p** and **q**, your task is to return the array **A** created by applying the following algorithm:
1. Start with **A = [p, q]** and **d = 2**
2. For each pair **(x, y)** of contiguous numbers in **A** whose sum is divisible by **d**, insert **(x + y) / d** between **x** an... |
[Question]
[
## Challenge
**Peter has risen again to save us from the duplicate challenges!**
~~[Peter Taylor is dead](http://chat.stackexchange.com/transcript/240?m=24491073#24491073), and there's no doubt about it (well, apart from the huge amount of doubt we have... but just ignore that). In his memory,~~ you mu... |
[Question]
[
Your job is to generate a heightmap and show it as a parallel projected, voxel landscape. The rules are the following:
* The (heightmap of the) landscape has to be randomly generated
* You also have to *describe* how the algorithm you are using works, so everyone can learn something new here
* You have... |
[Question]
[
What general tips do you have for golfing in Raku? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Raku (e.g. "remove comments" is not an answer). Please post one tip per answer.
[Answer]
Avoid `sub` literals. In many cases, you can... |
[Question]
[
[Sandbox](https://codegolf.meta.stackexchange.com/a/18273/78850)
Have y'all ever written an answer with unprintable ASCII characters in it and wished that there was an easy way to represent those characters in a printable way? Well, that's why the [Control Pictures](https://unicode-table.com/en/block... |
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.