text
stringlengths
180
608k
[Question] [ A [**powerful number**](https://en.wikipedia.org/wiki/Powerful_number) is a positive integer \$n\$ such that for every prime \$p\$ that divides \$n\$, \$p^2\$ also divides \$n\$. Or equivalently, \$n\$ is powerful if and only if it can be written in the form \$n = a^2b^3\$, where \$a\$ and \$b\$ are po...
[Question] [ ### Your task Given a integer input, \$ n \$ (such that \$ n > 1 \$), decide whether it can be written as the sum of (at least 2) consecutive square numbers. ### Test cases **Truthy:** ``` Input Explanation 5 1 + 4 13 4 + 9 14 1 + 4 + 9 25 9 + 16 29 4 + 9 + 16 30 1 + 4 + 9 + 1...
[Question] [ What general tips do you have for golfing in sed? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to sed (e.g. "remove comments" is not an answer). Please post one tip per answer. [Answer] If you need to use [labels](https://www.gnu.or...
[Question] [ This is an adaption of [Core War](http://en.wikipedia.org/wiki/Core_War), a programming KOTH dating back to the 20th century. To be more specific, it is using an incredibly simplified instruction set primarily based off of the [original proposal](http://corewar.co.uk/cwg.txt). ## Background In Core War...
[Question] [ Consider the array `[5, 6, 8, 3, 9, 4, 2, 1, 7]`. If we list how far each number has moved from it's (1-indexed\*) index, we have (considering absolute distance): ``` Array: [5, 6, 8, 3, 9, 4, 2, 1, 7] Index: [1, 2, 3, 4, 5, 6, 7, 8, 9] Dists: 4 4 5 1 4 2 5 7 2 ``` We can then group the elemen...
[Question] [ I define the n-th ternary as a ternary that returns n and has the form: ``` 1 ? 2 ? 3 ? n - 1 ? n : 0 : 0 : 0 # n - 1 zeroes ``` Write a function or complete program that given an input n will output or return the n-th ternary. Code-Golf. **Testcases** ``` 0 #=> undefined behaviour 1 #=> 1 2 #=> 1 ? 2...
[Question] [ A doubling sequence is an array of numbers where each subsequent number is at least twice the previous number. Given an ordered list of numbers, determine if the numbers in the list (\$n\_{x}\$) have the property that: \$n\_1 \times 2 \le n\_2\$ \$n\_2 \times 2 \le n\_3\ ...\$ and so on until reaching ...
[Question] [ This challenge takes place on the [snub square tiling](https://en.wikipedia.org/wiki/Snub_square_tiling). Start by choosing any triangle, and color it \$c\_1\$. Next, find all tiles which touch this triangle at any vertex, and color them \$c\_2\$. Next, find all tiles which share a vertex with any \$c\...
[Question] [ # Challenge Given a list, determine if grouping the list into runs of increasing and decreasing elements will result in a list of equal-sized lists. In other words, "turning points" of the list are spaced out evenly. # Example Here's an example: `0, 3, 7, 5, 2, 3, 6` `0, 3, 7` increases, `7, 5, 2` decr...
[Question] [ ### Intro We have had [histograms](https://codegolf.stackexchange.com/questions/48216/n-gram-histogram) and [counting](https://codegolf.stackexchange.com/questions/45257/counting-k-mers), but not listing all of them. Every year, [Dyalog Ltd.](http://www.dyalog.com/) holds a student competition. [The ch...
[Question] [ Take a unit circle centered on the origin. In any two neighboring [quadrants](http://en.wikipedia.org/wiki/Quadrant_%28plane_geometry%29), mirror the curve of the circle across the lines connecting the circle's x and y intercepts. With the resulting shape, you can tile the plane: [![circle tessellation...
[Question] [ This was inspired by [this question](https://codegolf.stackexchange.com/questions/235446/neural-processing-lattice-checker). Given an \$m\times n\$ matrix of \$0\$'s and \$1\$'s, apply "gravity" to it. This means to drop down all the \$1\$'s as if they were affected by gravity. For example ``` [[1,0,1,...
[Question] [ Consider a grid from \$(0,0)\$ in the bottom-left corner to \$(m,n)\$ in the top-right corner. You begin at \$(0,0)\$, and can only move in one of these three ways: * Directly north \$(+0, +1)\$, * Directly east \$(+1, +0)\$, or * Directly north-east \$(+1, +1)\$ How many different paths are there from...
[Question] [ You must take two lists of positive integers as input, let's call these **n** and **m**. You may assume that: * All integers in **n** are part of **m** * All integers in **m** are unique * The lists are non-empty ### Challenge: Return the indices of where you find the values in **n**, in **m**. That m...
[Question] [ There seems not to be a contest for this one yet. The task is simple. Add the first `n` numbers of the Fibonacci sequence that are even and output the result. This is given by [OEIS A099919](https://oeis.org/A099919), except that sequence is shifted by one, starting with `fib(1) = 0` instead of `fib(1)...
[Question] [ Use any programming language to display numbers between 1 and 99 (including both) in such a way, so that: * the numbers are separated by single space, * if a number is divisible by 3, it should be in parentheses, * if a number is divisible by 4, it should be in square brackets, * if a number is divisib...
[Question] [ Let \$n=42\$ (Input) Then divisors are : 1, 2, 3, 6, 7, 14, 21, 42 Squaring each divisor : 1, 4, 9, 36, 49, 196, 441, 1764 Taking sum (adding) : 2500 Since \$50\times 50=2500\$ therefore we return a truthy value. If it is not a perfect square, return a falsy value. # Examples : ``` 42 ---> true 1 --...
[Question] [ In this task your code will be given an integer \$n\$ as input. Your code should then output the greatest number of multiples of \$3\$ that can be concatenated (in base \$10\$) to form \$3n\$ (with no leading zeros). For example if you were given \$26042\$ as input, \$26042\times3=78126\$ and \$78126\...
[Question] [ ## Introduction According to [Rand Al'Thor's post](https://puzzling.stackexchange.com/questions/42209/what-is-a-close-knit-word) in the Puzzling SE, a close-knit word is any word that contains three alphabetically consecutive letters (in any order). Words like **education**, **foghorn** and **cabaret**...
[Question] [ Write a program or a function to print the following cube (if you allow me to call it so) in different sizes: ``` ^L^L^L^L^L^L^L^L^L^L^L //^L^L^L^L^L^L^L^L^L^L^L ////^L^L^L^L^L^L^L^L^L^L^L //////^L^L^L^L^L^L^L^L^L^L^L ////////^L^L^L^L^L^L^L^L^L^L^L /////////...
[Question] [ ## Challenge: Take a list, **L** containing positive integers as input: ``` 3 5 2 1 6 ``` and create a matrix where the n'th column contains the vector **1:L(n)**, where shorter rows are padded with zeros. ### Test cases: ``` 3 5 2 1 6 ----------------- 1 1 1 1 1 2 2 2 0 2 3 ...
[Question] [ [Fibonacci coding](https://en.wikipedia.org/wiki/Fibonacci_coding) is a universal code, which can encode positive integers of any size in an unambiguous stream of bits. To encode an integer \$ n \$: * Find the largest Fibonacci number less than or equal to \$ n \$; subtract this number from \$ n \$, ke...
[Question] [ You're given a non-empty list of positive integers, e.g. ``` [6 2 9 7 2 6 5 3 3 4] ``` You should rank these numbers by their value, but as is usual in leaderboards, if there is a tie then all the tied numbers get the same rank, and an appropriate number of ranks is skipped. The expected output for the...
[Question] [ ## Display a Digital Clock (I see there are many clock challenges, I have tried to read them all, I'm pretty sure this is unique) Write some code that continuously updates a digital clock displayed in the format `h:m:s` where `h`, `m`, and `s` can occupy 1 or 2 characters each. The restrictions in simp...
[Question] [ July 1st is Canada day (yay Canada)! Or is it? It seems that the [Wikipedia](https://en.wikipedia.org/wiki/July_1) page for this day has a lot of Canada related content, but is there another day which is more Canadian? Your task is to write a program or function which takes a date (month and day) as in...
[Question] [ A pleasing number (according to this definition) is a number that can be passed through the following process (let's use `41802000` as an example): * Separate the trailing identical numbers (`41802000 => [41802, 000]`) * Sort the first half of the digits and take the maximum (`[41802, 000] => [8, 000]`...
[Question] [ I came across [this question on SO](https://stackoverflow.com/questions/8886475/simple-way-to-compare-a-character-in-a-position-in-a-line-to-rest-of-lines-at-sa) and thought it'd make a nice golf challenge. So here it is: ### Challenge: Write a program that reads a sequence of character strings, one pe...
[Question] [ Just because the [reverse](https://codegolf.stackexchange.com/q/193315/78410) and [palindrome](https://codegolf.stackexchange.com/q/221209/78410) were not too challenging individually :) Write a program (full program or function) that satisfies the following: given a string input, * the program *as-is*...
[Question] [ ## Challenge Given a whole number divisible by 9 and one missing digit, find the missing digit. The missing digit may be represented by any character other than the digits 0-9 as long as it is consistent. If the missing digit could be 0 or 9, output something to signify so. Assume the user is intellige...
[Question] [ Given an image, either as input (possibly in RGB triplets) or with the filename as input (you may assume the image has a specific filename, possibly without an extension), output an image representing a single color channel of the image. You will also take another input, representing which channel to o...
[Question] [ **Task:** Given an input consisting of exactly one of the characters `<>^v`, output a second input consisting of the printable ASCII characters (from space to tilde), oriented with the arrow. Let's assume the second input to the program is `ABC`. This is what it should do: * Input `>`: print `ABC`. * I...
[Question] [ This challenge is inspired by the AoC 2020, [Day 14 - Part II](https://adventofcode.com/2020/day/14#part2), created by [Eric Wastl](https://twitter.com/ericwastl) and [his team](https://adventofcode.com/2020/about), which asks to output the possible binary values from a bitmask. Let's say we've a bitma...
[Question] [ ### Challenge Given an [ASCII](http://en.wikipedia.org/wiki/ASCII) operator from the list below and a number n, draw an ASCII representation of the operator using that operator as the character with the line segments of the operator having length *n*. ### Input An ASCII character from the list `= + - x...
[Question] [ You're given a **n-by-m** matrix of integers, where **n,m > 3**. Your task is to find the **3-by-3** sub-matrix that has the lowest mean, and output this value. **Rules and clarifications:** * The integers will be non-negative * Optional input and output format * The output must be accurate up to at le...
[Question] [ ## Background **[Gödel numbers](https://en.wikipedia.org/wiki/G%C3%B6del_numbering)** are a way of encoding any string with a unique positive integer, using prime factorisations: First, each symbol in the alphabet is assigned a predetermined integer code. Then, to encode a string \$ x\_1 x\_2 x\_3 \ldo...
[Question] [ (we won't be finding a `Find` or catching a `tryCatch`, though) This is part two of a multi-part series of implementing some interesting R functions. Part one can be found [here](https://codegolf.stackexchange.com/q/188078/67312). # The task: You are to implement [R's `match` function](https://stat.eth...
[Question] [ Your task is to write a function that takes an even-digit integer and compares the 2 halves of the integer. If the sum of the digits in the first half is greater than the sum of the digits in the second half, output a truthy value, otherwise, output falsey. For example: ``` 12345678 1234 5678 (1+2+3+4)...
[Question] [ **This question already has answers here**: [Pseudofactorial](/questions/82494/pseudofactorial) (44 answers) Closed 7 years ago. The question's pretty much described by the title: write a program or function that takes a positive integer *n* as input, and returns the smallest positive output whi...
[Question] [ # Challenge description Let's take a positive integer `n`, reverse its digits to get `rev(n)` and get the absolute value of the difference of these two numbers: `|n - rev(n)|` (or `abs(n - rev(n))`). Example: ``` n = 5067 rev(n) = 7605 |n - rev(n)| = |5067 - 7605| = |-2538| = 2538 ``` After repeating ...
[Question] [ What general tips do you have for golfing in Prolog? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Prolog (e.g. one letter variables is not specific to Prolog to reduce the size of programs). Please indicate in your tips if it is spe...
[Question] [ A simple golf to start the week! You're given three arrays: the *base array* `B`, the *value array* `V` and the *index array* `I`. You should produce another array where the values from `V` are inserted into `B` at the indices specified by `I`. Here is an example: ``` Base: [5, 1, 4, 1, 3] Values: ...
[Question] [ > > Given a string, you've to split it into groups of three characters (by padding `_` at the end). > > > [Related](https://codegolf.stackexchange.com/questions/77310/split-string-into-n-pieces-or-pieces-of-length-n), but still it's different. > > > --- **Sample I/O:** * `'abcde' -> 'abc', 'de_'`...
[Question] [ # The challenge Quite simple, given an input `x`, calculate it's infinite power tower! ``` x^x^x^x^x^x... ``` *For you math-lovers out there, this is `x`'s infinite [tetration](https://en.wikipedia.org/wiki/Tetration).* Keep in mind the following: ``` x^x^x^x^x^x... = x^(x^(x^(x^(x...)))) != (((((x)^x)...
[Question] [ # Background The [Hamming weight](https://en.wikipedia.org/wiki/Hamming_weight) of an integer is the number of ones in its binary representation. For this challenge, integers are represented with 32 bits, and they are unsigned. # Challenge Given an integer between 0 and 2^32-1 (non-inclusive), output a...
[Question] [ This is inspired by a real world problem I had. I'm curious to see if there is any clever way to go about this. You are given two unsorted arrays, A and B, each containing an arbitrary number of floats. A and B don't necessarily have the same lengths. Write a function that takes the elements of A seque...
[Question] [ # Setting the Scene: It is an average afternoon, as you unwind after a long day by engaging in your favorite pastime: answering the plethora of captivating questions on PPCG. It hasn't been a good day for you; those damned Pyth programmers keep getting best answer and it's killing your vibe. Suddenly, ...
[Question] [ You must write a program to evaluate a string that would be entered into a calculator. The program must accept input and output the correct answer. For languages that do not have standard input/output functions, you may assume the functions `readLine` and `print`. **Requirements** * Does not use any ki...
[Question] [ Euclidean distance between two lattice points \$(x\_1, y\_1)\$ and \$(x\_2, y\_2)\$ on a plane is: \$\sqrt{(x\_1 - x\_2)^2 + (y\_1 - y\_2)^2}\$. Imagine now a lattice `N x N` replicated infinitely many times next to itself. The two points \$(x\_1, y\_1)\$ and \$(x\_2, y\_2)\$ also get replicated. Eucli...
[Question] [ Given a ragged list of positive integers find the size of the largest list contained somewhere in it. For example: ``` [1,[1,[8,2,[1,2],5,4,9]],2,[],3] ``` Here the answer is 6 because one of the lists has 6 elements and all other lists have fewer. ``` [1,[1,[8,2,[1,2],5,4,9]],2,[],3] ^ ^ ^ ...
[Question] [ I don't like curry. Help me reverse the effects of this evil question - [Make me some curry](https://codegolf.stackexchange.com/q/162231/95792) - by uncurrying functions. # Task * Given a [blackbox](https://codegolf.meta.stackexchange.com/a/13706/95792) curried function, output its uncurried equivalent...
[Question] [ # Code Golf Measurer © 2019 Hexdumps used with `xxd` look something like this: ``` 00000000: 666f 6f20 6261 7220 7370 616d 2065 6767 foo bar spam egg 00000010: 730a s. ``` Your task is to convert a hexdump in this form in to the number of bytes used. ## Rules: * Usu...
[Question] [ [Desmos](https://desmos.com/calculator) is mainly used as an online graphing calculator, but its graphical and mathematical functionalities can also be applied in certain coding challenges. I know not that many people use Desmos on this site, but for the people that do, what are some tips for golfing i...
[Question] [ Suppose we have an array \$\texttt{ps}\$ of length \$n\$ with pointers pointing to some location in the array: The process of "[*pointer jumping*](https://en.wikipedia.org/wiki/Pointer_jumping)" will set every pointer to the location the pointer it points to points to. For the purpose of this challenge...
[Question] [ Given an array of numbers with `length >=3` and `length % 3 == 0` `[1, 2, 3, 4, ...]` You will split it in sub-arrays of length 3 `[[1, 2, 3], [4, 5, ...], [...` And return an array with * [0] => The amount of cases in the sub-array where **all numbers are equal** * [1] => In case all numbers in sub-...
[Question] [ # Intro Find the result of number cannibalism. Why was 6 scared of 7? Becase 7 `8` 9. Your program will have to find the result of applying the `8` operation(defined below) on a number, repeatedly. [Related](https://codegolf.stackexchange.com/questions/66603/why-was-6-afraid-of-7), [Sandbox](https://co...
[Question] [ Write code that when given a positive number \$x\$ as input, outputs the largest positive divisor of \$x\$ less than or equal to the square root of \$x\$. In other words find the largest \$n > 0\$ such that \$\exists m\geq n:m\cdot n=x\$ (Exists \$m\$ greater than or equal to \$n\$ such that \$m\$ time...
[Question] [ Given a positive integer, find its smallest positive integer multiple which is a run of 9 followed by an optional run of 0. In other words, find its smallest positive integer multiple which is matched by the regex `/^9+0*$/`. For example, if the given positive integer is 2, then return 90, since 90 is ...
[Question] [ Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of". The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any c...
[Question] [ Given an integer \$ n \ge 1 \$, your task is to output an array \$ a \$ consisting of \$ n^2 + 1 \$ integers, such that all possible pairs of integers \$ (x, y) \$ satisfying \$ 1 \le x, y \le n \$ exist as a contiguous subarray in \$ a \$, exactly once. For example, if \$ n = 2 \$, a valid output woul...
[Question] [ The 3Blue1Brown Youtube channel released a video a year ago called "[Why do colliding blocks compute pi?](https://www.youtube.com/watch?v=jsYwFizhncE)" which describes a model where a block `A` of mass \$a\$ slides into a block `B` of mass \$b\$, which then pushes block `B` into a wall, causing it to b...
[Question] [ Given an integer `n >= 2`, output the largest exponent in its prime factorization. This is OEIS sequence [A051903](https://oeis.org/A051903). ## Example Let `n = 144`. Its prime factorization is `2^4 * 3^2`. The largest exponent is `4`. ## Test Cases ``` 2 -> 1 3 -> 1 4 -> 2 5 -> 1 6 -> 1 7 -> 1 8 -> 3...
[Question] [ A [superpermutation](https://en.wikipedia.org/wiki/Superpermutation) on n symbols is a string which contains every permutation of n symbols in its body. For instance, `123121321` is a superpermutation on three symbols because it contains `123`, `132`, `213`, `231`, `312` and `321` as substrings. # The ...
[Question] [ **The Challenge:** Draw a rectangle of ASCII boxes: [] **The Rules:** Takes a width and a height input You can assume both of these are numbers Must produce a string with newline characters, \n **Examples:** 2, 2: ``` [][] [][] ``` 2, 3: ``` [][] [][] [][] ``` Fewest Bytes wins. [Answer] # [SOGL](...
[Question] [ ## Challenge: Create a function or program that will take an input N (a number from 0 - 24) which represents the HOUR. Output should draw an analog clock out of asterisks showing the hour N. # 🕛🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛 --- ## No...
[Question] [ ## Background As far as we can tell from trying everything (besides cheating with ZWSPs), you can't type ``\` in [Stack Exchange chat](https://chat.stackexchange.com/). However, you can type `\`` by doing ``\\```. So, if you want to tell someone in chat how to type backslash-backtick, you'd need to typ...
[Question] [ # Introduction * Note that I learned it from a [Numberphile Video](https://www.youtube.com/watch?v=KNjPPFyEeLo), where [Neil Sloane](https://www.youtube.com/playlist?list=PLt5AfwLFPxWJXQqPe_llzWmTHMPb9QvV2) explains it better. I recommend you to watch his Video. But for a quick Introduction: The [Levin...
[Question] [ A while ago, I had a look at the prime factorization of 27000: > > 27000 = 23 × 33 × 53 > > > There are two special things about that: * **consecutive-prime**: The primes are consecutive: 2 is the 1st prime, 3 is the 2nd prime, 5 is the 3rd prime. * **constant-exponent**: The exponent is the same f...
[Question] [ In this challenge, you receive a string as input containing a string of X's, Y's and Z's eg. "XYZZ". X, Y and Z represent a particular character. This pattern is then compared with a second string input. If the pattern exists as a substring in the second input, return `True`, otherwise, return `False`....
[Question] [ **Final results are here !** # Introduction The game takes is strongly inspired by [Manu's Game of Town](https://codegolf.stackexchange.com/questions/44491/the-game-of-towns/44531). It takes place in a world of swords and magic. The king who ruled the whole continent just died, and the lords of the man...
[Question] [ A simple regex is either: * `_` (which matches the empty string) * Any lowercase letter `a` to `z` (which matches that letter) * `r*`, where `r` is a regex (which matches `r` any number of times) * `(r|s)`, where `r` and `s` are regexes (which matches either `r` or `s`) * `(r+s)`, where `r` and `s` are...
[Question] [ Think of a road as a number line, starting at `0` and continuing indefinitely: ``` ................................................................. ``` There are two cars on the road: `C` and `R`. `C` is the cop who is trying to catch `R`, the robber. `C` starts at `0`, and `R` starts somewhere on the...
[Question] [ To neutralize data, recursively replace all numbers (not digits!) with zeros and all characters (not strings!) with spaces. You must accept any single number, character, or string, or possibly recursive array\* of mixed numeric/character data that your language can handle. For example, you must accept ...
[Question] [ Given an integer ***n > 2***, print or return the smallest non-negative integer ***k*** such that ***a(n, k) = 9***, where ***a(n, k)*** is defined by: * ***a(n, 0) = n*** * ***a(n, k+1) =*** + ***a(n, k) / 2 + 1*** if ***a(n, k)*** is even + the sum of the digits of ***a(n, k)²*** (in base 10) if **...
[Question] [ When you convert a fraction to a decimal number and you want to store that number, you often have to round it, because you only want to use a certain amount of memory. Let's say you can only store 5 decimal digits, then 5/3 becomes 1.6667. If you can store only 2 decimal digits it will be 1.7 (now assu...
[Question] [ > > **Thanks for all the entries, the deadline has now passed and the final scores are at the end of the question.** > > **Congratulations to [PhiNotPi](https://codegolf.stackexchange.com/users/2867/phinotpi) on a fairly comprehensive victory.** > > > This is a [king-of-the-hill](/questions/tagg...
[Question] [ In this challenge you will be tasked with implementing a sequence of natural numbers such that: * Each number appears a natural number of times * No two numbers appear the same number of times * No two numbers appear in the sequence next to each other more than once. For some examples, the sequence ```...
[Question] [ Given an input of an integer \$n ≥ 2\$, output a list of its divisors sorted by the exponents in their prime factorizations, in ascending order, ordering first by the largest prime, then by the second largest, and so on. As an example, take the integer \$72\$, which is \$2^3\cdot3^2\$. It has the divis...
[Question] [ ## Context When I was a little kid, I watched a Disney movie where [Goofy](https://en.m.wikipedia.org/wiki/Goofy) told his son "Boy, even a broken clock is right two or three times a day." ([see this youtube clip](https://youtu.be/pMw_oy-2wZY), courtesy of [@Arnauld](https://codegolf.stackexchange.com/...
[Question] [ ## Task Given an integer, `n`, where `3 <= n < 2^32`, calculate the area of a regular `n`-gon, with an apothem of 1, using the formula `A = n * tan(π / n)`. > > [The apothem of a regular polygon is a line segment from the center to the midpoint of one of its sides.](https://en.wikipedia.org/wiki/Apoth...
[Question] [ Inspired by [Find the “unwrapped size” of a list](https://codegolf.stackexchange.com/questions/99304/find-the-unwrapped-size-of-a-list). Define the Recursive Size, `RS`, of a list containing no lists as its length (number of items contained) and the Recursive Size of a list containing any lists as the ...
[Question] [ Given a positive integer as input, output the smallest positive integer such that appending its digits (in base 10) to the end of the input number will form a prime number. ## Examples ``` 1 --> 1 2 --> 3 8 --> 3 9 --> 7 11 --> 3 20 --> 11 43 --> 1 134 --> 11 34...
[Question] [ [Sandbox](https://codegolf.meta.stackexchange.com/a/18345/82007) # Background (not necessary for the challenge) A standard number theory result using the pigeonhole principle is the fact that given any natural number k, there is a Fibonacci number that is a multiple of k. We can see this by considering...
[Question] [ Given a natural number \$n\$, return the \$n\$-th [cuban prime](https://en.wikipedia.org/wiki/Cuban_prime). ### Cuban Primes A cuban prime is a prime number of the form $$p = \frac{x^3-y^3}{x-y}$$ where \$y>0\$ and \$x = 1+y\$ or \$x = 2+y\$ ### Details * You may use 0 or 1 based indexing, whatever sui...
[Question] [ Last challenge ([Pixel-art, episode 1: display Super Mario](https://codegolf.stackexchange.com/questions/39915/pixel-art-display-super-mario/)) was just a training... (and you completed it in amazing ways, thanks!) This time, you have to work a little bit more. You have to display all the first overwor...
[Question] [ ## Challenge Mark is a student who receives his `N` marks in a concatenated way in a one single line. The challenge is to separate his marks, knowing that each mark can only be `0` or `1` or `2` or `3` or `4` or `5` or `6` or `7` or `8` or `9` or `10`. ## Input `N` natural number and one line. ## Outpu...
[Question] [ # Execute a Lindenmayer System A [Lindenmayer System](http://en.wikipedia.org/wiki/Lindenmayer_system) (or L-system) is related to [Thue](http://en.wikipedia.org/wiki/Semi-Thue_system) and [Post](http://en.wikipedia.org/wiki/Post_system) systems, and is used in [botanical modeling](http://algorithmicbo...
[Question] [ Say I have a ragged list, like: ``` [ [1, 2], [3, [4, 5] ] ] ``` And I want to iterate over each item and delete it one-by-one. However, I don't know the structure of the list. So, I have to iterate over the list, with the following algorithm: * Look at the first item of the list. * If it's ...
[Question] [ Given a single positive odd integer as input, return a converging zigzag as a list of strings, list of lists of characters, or newline-separated string, in this form: ``` # # # # # # # # # # # ``` You can replace `#` with any consistent non-whitespace character. Trailing whitespa...
[Question] [ This is a "counterpart" of another puzzle, [Eight coins for the fair king](https://puzzling.stackexchange.com/q/77750/44061) on Puzzling.SE. You can read the above puzzle for the background. The details about this puzzle are as follows. A set of 8 kinds of coins of different values are created, the kin...
[Question] [ Given `n` numbers in an array (you can't assume they are integers), I would like to compute the product of all subsets of size `n-1`. You can do this by multiplying all the numbers together and then dividing by each one in turn, as long as none of the numbers is zero. However, how quickly can you do th...
[Question] [ Write a program or function that, when given `n`, will print a spiral `n` characters long made up of the Latin alphabet `ABCDEFGHIJKLMNOPQRSTUVWXYZ` repeated as needed. This spiral should run through the alphabet only forwards. Related to [Alphabet Spiral](https://codegolf.stackexchange.com/questions/8...
[Question] [ Cellular Automata are truly fascinating. The ones that are usually talked about are the binary ones, i.e., the ones representable by a number. However, those, in my opinion, have been done to death. Ternary CAs are more interesting, but we have all of ASCII to consider! What fun could that be! Instead ...
[Question] [ Given a *strictly* positive integer `n` (therefore `0` isn't a valid test case), produce an approximate triangle of height `n`. ## A non-programmatic process of drawing the picture Initially we start with the base of the triangle. ``` | ``` So, we want to draw a triangle of a height of 5. First we know...
[Question] [ # Context Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. This is the basic skeleton almost everyone follows. # Task Your task, should you choose to accept it, is...
[Question] [ Your challenge today is to take a multiline string, and output the biggest square contained within the string that includes the top left corner. A square string is one where: * Each line has the same number of characters * The number of characters on each line is equal to the number of lines. Consider...
[Question] [ Given a matrix of integers, test if it's rank-one, meaning that every row is a multiple of the same vector. For example, in ``` 2 0 -20 10 -3 0 30 -15 0 0 0 0 ``` every row is a multiple of `1 0 -10 5`. The same definition also works with columns in place of rows. Alternatively, a m...
[Question] [ Consider a length-\$n\$ array of positive integers. * The **complement** of the element with index \$i\$ is the element with index \$n - i - 1\$. * The **twin** of an element \$a\$ is its complement after removing all elements not equal to \$a\$. For example, in the array `[1, 2, 3, 4, 2, 1, 3, 2]`, th...
[Question] [ ## The challenge Interpret the stack-based programming language [underload](https://esolangs.org/wiki/Underload). The stack is a stack of strings that can be concatenated together. Each underload program is a string of some of these instructions: * `~`: Swap the top two elements of the stack. * `:`: Du...
[Question] [ Given a string as input, determine whether it is a noun or not. You will be scored on the 1000 most common English words, by how many you correctly label as a noun or not. The program or function which correctly classifies the most of those words in 50 bytes or less will win. # Nouns A noun is a word t...
[Question] [ ## COMPLETE Wumpus season has ended, and with, the lives of many a vicious Wumpus and brave Hunter. As well as some cowardly, immoral and downright stupid Hunters. But at the end of the day, NascarHunter by Dr Heckle came away with the most loot and glory. We salute you, oh brave... driver? It's open s...