instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
This is a Cops and Robbers challenge. This is the cop's thread. The robber's thread is here. As a cop, you must pick any sequence from the OEIS, and write a program p that prints the first integer from that sequence. You must also find some string s. If you insert s somewhere into p, this program must print the second ...
stackexchange_codegolf
Background An ex-increasing set sequence of order \$N\$ is defined as a sequence of integer sets \$S_1,S_2,\cdots,S_n\$ which satisfies the following: Each \$S_i\$ is a non-empty subset of \$\{1,2,\cdots,N\}\$. For \$1\le i<n\$, \$S_i \cap S_{i+1} = \varnothing\$, i.e. any two consecutive sets have no elements in comm...
stackexchange_codegolf
Input: n Output: A list of length n, with each element being the nth happy prime. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number either equals 1, or it loops endlessly in a cycle which does not include 1. A happy number is a number...
stackexchange_codegolf
Your task is to write a program to print the sum of the ASCII codes of the characters of the program itself. You are not allowed to open any file (Any input such as command line arguments, standard input or files is prohibited). The program that prints the lowest number (i.e. has the lowest sum of ASCII codes) wins. He...
stackexchange_codegolf
This idea came to me when I saw my little brother playing with my calculator :D The task Taking a integer as an input, print that many graphical square roots under each other, like this: n = 1 ___ \/ 1 n = 3 _______ / _____ / / ___ \/\/\/ 3 n = 5 ___________ / _________ / / _______ / ...
stackexchange_codegolf
The basic idea of a kolmogorov-complexity challenge is to print a set output in the shortest code (though that meaning has changed now). We have had many of them, from Borromean Rings to The Gettysburg Address. ##Your Task This question is similar, except that it requires printing of a special text - the text of this q...
stackexchange_codegolf
A bronze plaque in the pedestal of the Statue of Liberty displays the poem "The New Colossus" by Emma Lazarus, part of which reads: Give me your tired, your poor, Your huddled masses yearning to breathe free, The wretched refuse of your teeming shore. Send these, the homeless, tempest-tost to me, I lift my lam...
stackexchange_codegolf
This challenge is completely ripped offheavily inspired by All Light, developed by Soulgit Games. Challenge You are an electrician, and it's your job to wire up all the lights to the battery. The lights and battery are laid out in a grid. You can connect a light or battery to the nearest light or battery to its north,...
stackexchange_codegolf
Your friend is trying to break into a vault that has a peculiar locking system: it requires a certain number of gentle knocks in a particular spot. Your friend discovered the number (which is in the range 1...99999) and possesses a gadget that produces the required knocks. However, the gadget is a Brainfuck interpreter...
stackexchange_codegolf
[Question inspired by Can you calculate the average Levenshtein distance exactly? . Thank you Anush. ] The longest common substring between two strings is the longest substring which is common to both. Please note this is not the same as the longest common subsequence whose fastest algorithm takes quadratic time. The ...
stackexchange_codegolf
As a child, my friend had a magic 8 ball that we would ask questions to and see what the fate of that question was. Challenge Your challenge is to write a program (or function) that when run (or called), outputs (or returns) a random answer from the possible answers below. (Random being: each output should have a nonze...
stackexchange_codegolf
Given N items (0 < N <= 50) with prices (which are always integers) P0 ... PN-1 and given amounts of each item A0 ... AN-1, determine how much the total cost will be. Examples N: 2 P0: 2 P1: 3 A0: 1 A1: 4 Result: 14 N: 5 P0: 2 P1: 7 P2: 5 P3: 1 P4: 9 A0: 1 A1: 2 A2: 3 A3: 2 A4: 3 Result: 60 Remember, this is code-golf,...
stackexchange_codegolf
The way points are assigned on a dice follows a regular pattern, the center dot is present if and only if the number is odd. To represent the even numbers, pairs of dots on opposite sides of the center are added, which will stay present for all successive numbers. 1: O 2: 3: 4: 5: 6: O O O O O O ...
stackexchange_codegolf
Bobby's booby-trapped safe requires an n-digit code to unlock it. Alex has a probe which can test combinations without typing them onto the safe. The probe responds Fail if no individual digit is the same as that in its corresponding position in Bobby's code. Otherwise it responds Close, including when all digits are c...
stackexchange_codegolf
The Home Prime of an integer \$n\$ is the value obtained by repeatedly factoring and concatenating \$n\$'s prime factors (in ascending order, including repeats) until reaching a fixed point (a prime). For example, the Home Prime (\$\text{HP}(n)\$) of \$10\$ is \$773\$ as: $$\begin{align} 10 & = 2 \times 5 \to 25 \\ 25 ...
stackexchange_codegolf
"Buzzing" Bill is a well respected beaver. He is the hardest working in his home dam. He was a strong beaver and was able to lift more logs than anyone at the dam. Unfortunately Buzzing Bill's career came to an end in a tragic accident. Being such a prominent figure in his town, the Beaver newspaper wanted to write a ...
stackexchange_codegolf
Originally from caird coinheringaahing's idea, I (Bubbler) am hosting Advent of Code Golf 2021. On each day from today (Dec 1) until Christmas (Dec 25), a challenge will be posted at UTC midnight, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes ...
stackexchange_codegolf
Thanks to your help in the Mark My Mail challenge, PPCG-Post has successfully stamped all of its parcels with the generated barcodes! Now, it's time to decode them. In this challenge your program will, given a barcode generated from the Mark My Mail challenge, decode it and return the encoded integer. But watch out! Th...
stackexchange_codegolf
Given the name of a cation and anion, output "S" (soluble) or "I" (insoluble). The table we will be using is from wikipedia: https://en.wikipedia.org/wiki/Solubility_chart. It is copied at the end of the question for future reference. Input: The cation, followed by the anion, separated by a space. The cation will be on...
stackexchange_codegolf
There is that famous riddle: A bear walks 1 km south, 1 km east and 1 km north, and comes to the place it started from. What color is the bear? This one is very old, so I'll generalize it: A bear walks x km south, y km east and x km north, and comes to the place it started from. This bear thinks that the North Pole ...
stackexchange_codegolf
A radiation-hardened quine can take a hit and stay standing, but nobody ever said that the quine can't be a wuss about it. For this challenge, you should write a quine that: If no characters are removed, prints its source code normally. Iff any one character is removed, prints the original program's source code, follo...
stackexchange_codegolf
in my country we have a children's song which goes like this: Priletela muha na zid, muha na zid, muha na zid. Priletela muha na zid, muha na zid. Pralatala maha na zad, maha na zad, maha na zad. Pralatala maha na zad, maha na zad. Preletele mehe ne zed, mehe ne zed, mehe ne zed. Preletele mehe ne zed, mehe ne zed. ...
stackexchange_codegolf
A finite-permutation is a function which takes an \$n\$-tuple and produces an \$n\$-tuple such that every element of the input is present in the output, and the ordering does not rely on the values of the inputs. We can unambiguously represent these permutations with an \$n\$-tuple where each element is the index of wh...
stackexchange_codegolf
Write a regex that only matches valid country code top level domains (ccTLDs). Your regex must match both the domains with the dot and without the dot (it must match tv and .tv). Any domain that is not a ccTLD or does not exist (e.g. .info or .jobs or .xz) must not be matched. Use Perl, POSIX, PCRE or Python. For refer...
stackexchange_codegolf
Your kindly neighbour, Doctor Tree, just gave you three magical creatures called Codémon. There's a battle tournament in the nearby town of Colorville. Are you the very best, like no one ever was? Overview This is a battle tournament. Each player controls a team of three monsters, and the objective is to knock out (k...
stackexchange_codegolf
At some point, I bumped into an SO question asking how to implement Perl's trivial hash-of-hashes data structure in Java. For those who don't know Perl, the hash value can be a scalar or another hash, or technically speaking hash reference. Arbitrary depth. Additional feature offered by Perl is autovivification - assi...
stackexchange_codegolf
The goal of this challenge is to generalise the bitwise XOR function to other bases. Given two non-negative integers \$ x \$ and \$ y \$, and another integer \$ b \$ such that \$ b \geq 2 \$, write a program/function which computes the generalised XOR, described the following algorithm: First, find the base \$ b \$ re...
stackexchange_codegolf
For this challenge, a list is considered valid if and only if it consists entirely of integers and valid lists (recursive definitions \o/). For this challenge, given a valid list and an integer, return a list of all depths at which the integer can be found. Example Let's consider list [1, [2, [3, [1, 2, 3], 4], 1], 1] ...
stackexchange_codegolf
Lexicographic Ordering For this challenge we will be talking about the lexicographic ordering of strings. If you know how to put words in alphabetical order you already understand the basic idea of lexicographic ordering. Lexicographic ordering is a way of ordering strings of characters. When comparing two strings lex...
stackexchange_codegolf
We are to define the idea of a fixed list as follows: A fixed list is a list of fixed lists. This definition is recursive so it's useful to look at some examples. The empty list [] is a fixed list. And list of empty lists is a fixed list. e.g. [[],[],[]] Any list of the above two is also a fixed list. e.g. [[],[],[[...
stackexchange_codegolf
Task Given a finite permutation output its inverse. You may take input and output in any reasonable format equivalent to a list of natural numbers. You may choose to use 0 indexing or 1 indexing. Your input and output format should be the same. You may assume a permutation has at least 1 element. This is code-golf so...
stackexchange_codegolf
I found another sequence not yet in the OEIS The binary expansion sequence is defines as follows, assuming 0 indexing: The even numbers of the sequence are how often 0 has appeared in the binary expansion of all previous items in the sequence The odd elements are the same, but for 1s. If you choose to 1-index, revers...
stackexchange_codegolf
Joe lives at the Bahamas. It is winter. His children are disappointed that there is no snow. Joe needs to make snow for his children. Fortunately, he has a 3-d printer. He plans to make snowflakes with it. Unfortunately he has no idea how a snowflake would look like. In fact, he has never seen a snowflake! Let us help ...
stackexchange_codegolf
Intro Help! I'm stuck on a snow-covered mountain and I need to get down as fast as possible, preferably without dying. I have a map showing how high each part of the mountain is above the normal ground. I am a novice skier, which means I like to stick to slopes that aren't too steep. I'm willing to go down just two mod...
stackexchange_codegolf
This is a cops-and-robbers challenge, the robbers' thread is here You can change the word code into golf by changing a letter at a time in four steps: CODE COLE COLD GOLD GOLF Today, we’ll be doing the same thing with programs. Your challenge is to: choose a programming language write two programs / functions, one th...
stackexchange_codegolf
The absolute value of a number \$x\$ is normally written as \$|x|\$. The left and right side of the absolute value uses the same symbol, so it is not immediately obvious how to parse nested absolute values e.g. \$||1-2|+|3-|4-5|||\$ Your goal is to parse such an expression containing nested absolute values: The express...
stackexchange_codegolf
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Instead, you click on nearby tiles to reveal the number of adjacent mines. One downside about the game is that it is possible to end up in a scenario where there are multiple valid answers and you may o...
stackexchange_codegolf
Your task is to output a square sandbox of size n+2 with / characters in the corners and | for the sides, and - for the top, with n**2 layers of sand (.) overflowing out of the sandbox of width n+2 Testcases 1 -> /-/ |.| /./ ... 2 -> /--/ |..| |..| /../ .... .... .... .... 3 -> /---/ |...| |...| |...| /.../ ..... ......
stackexchange_codegolf
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 Special-use addresses, as de...
stackexchange_codegolf
Challenge: With any given number that has multiple digits, every digit in the number needs to repeatedly be summed together until the sum is a single digit number. To make things interesting, if there's a 0 in the number, then it must equal 26, because zero starts with the letter z, which is the 26th and final letter o...
stackexchange_codegolf
I define the following operators: Manhattan Addition a +M b, for single-digit numbers, is the result of concatenating b onto a. So, a +M b = 10a + b. Therefore, the general operator +M is defined as thus: a +M b = 10a + b Manhattan Subtraction a –M b, for single-digit numbers, is the result of removing the last b from ...
stackexchange_codegolf
Given two strings of digits, determine which string, if any, has the earliest digit which is lower than the other string's digit at the same index. Do note that this differs from alphabetization, as shown in the following examples: Examples Given inputs 12345000 and 1233999999, the second string would have the earliest...
stackexchange_codegolf
.i xu .e'o lo zunsnagri cu drani loka jboge'a Given an input of a string consisting of two characters, output whether it is a valid consonant cluster in Lojban. Here is a quote from CLL 3.6 detailing the rules for a valid consonant cluster pair (or rather, an invalid one): 1) It is forbidden for both consonants to be ...
stackexchange_codegolf
Compute 30000 digits of the mathematical constant π, with the fastest code. Implement in any computer programming language that I can run in my 64 bit Linux machine. You should provide your compiler optimization options if any. I am ready to install a new compiler or language runtime to run your code, given that I am n...
stackexchange_codegolf
Here's yet another Steenrod algebra question. Summary of the algorithm: I have a procedure that replaces a list of positive integers with a list of lists of positive integers. You need to repeatedly map this procedure over a list of lists and flatten the output until you reach a fixed point. Then for each sublist, if i...
stackexchange_codegolf
Introduction The Nineteenth Byte is CGCC's official chatroom (go check it out!). Its name is a play on the nineteenth hole, and it also refers to golf, which is appropriate for CGCC's chatroom's name. The name is also precisely \$19\$ bytes long, as its name states. Challenge Your task is to write a program that output...
stackexchange_codegolf
I've recently been indulging myself in some nostalgia in the form of Bookworm Deluxe: In case you haven't seen it before, it's a word game where the goal is to connect adjacent tiles to form words. In order to determine whether a string is a valid word, it checks it against its internal dictionary, which is stored in ...
stackexchange_codegolf
Reading the text of the millitext font There is a font here that fits each character into a single, 1x5 pixel block. It does this (assuming you're using an LCD screen) by using the RGB channels of each pixel to expand the one pixel into three subcolumns, one for each channel. Your task is to take in a string of text en...
stackexchange_codegolf
A near-repdigit number is a positive integer where all the digits are the same, except one. For example 101 and 227 are near-repdigits. A near-repdigit prime is a near-repdigit that is also prime. For example: 101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373, 383, 433, 443, ...
stackexchange_codegolf
Write an \$n\$-bytes program \$AB\$ such that: it outputs an integer \$x,\ 0\lt x\lt n\$; both its \$x\$-byte prefix \$A\$ and \$(n-x)\$-byte suffix \$B\$, when run as programs, output \$AB\$. \$A, B\$ and \$AB\$ should: run in the same language not take any input use the same output method This is code-golf, so th...
stackexchange_codegolf
Elixir is a programming language with a feature called the pipe operator, |>, similar to the pipe in Bash and other languages. It passes the result of an expression on the left as the first parameter of a given function on the right. To clarify, here are some examples. 2 |> myFunction() is equivalent to myFunction(2) ...
stackexchange_codegolf
We all know about the Fibonacci sequence. We start with two 1s and keep getting the next element with the sum of previous two elements. n-bonacci sequence can be defined in similar way, we start with n 1s and take the sum of previous n elements to get the next element. Challenge Given a positive integer m > 1, output t...
stackexchange_codegolf
This is a code-challenge with a custom scoring system, where the lowest score wins. Introduction Many smartphones allow to enter text by swiping your finger across the 2D virtual keyboard. This technology is usually combined with a prediction algorithm that outputs a list of guessed words, sorted from most likely to le...
stackexchange_codegolf
A001057 is one way to represent an integer as a natural number. It lists them according to the following pattern: 0, 1, -1, 2, -2, 3, -3, 4, -4, ... In this challenge, you'll take two distinct integers as input and return which is at a higher index in this enumeration. Take -2 and 1 as an example: -2 comes after 1, so...
stackexchange_codegolf
The major system is a mnemonic device for converting numbers into words so they can be memorized more easily. It is based on how words sound phonetically, but to keep things simple for the challenge we'll only be concerned with how words are spelled. This means there will be some incorrect conversions, but that's alrig...
stackexchange_codegolf
Here is a tic-tac-toe board: a b c | | 1 - | - | - _____|_____|_____ | | 2 - | - | - _____|_____|_____ | | 3 - | - | - | | Given a set of moves, print the board with the tokens on. Input will be taken in as moves separated by...
stackexchange_codegolf
Given a real number t in (-10^9,13) (not including -10^9 or 13) as input, output Γ(t), also known as the Gamma function, which is defined as follows: You may not use a built-in Gamma function to solve this task, nor may you use built-in numeric or symbolic integration functions. Your output should be accurate to 6 sig...
stackexchange_codegolf
The objective Given the non-negative integer \$n\$, output the value of the hyperfactorial \$H(n)\$. You don't have to worry about outputs exceeding your language's integer limit. Background The hyperfactorial is a variant of the factorial function. is defined as $$ H(n) = 1^{1} \cdot 2^{2} \cdot 3^{3} \cdot \: \cdots ...
stackexchange_codegolf
Your challenge, should you choose to accept it, is to take as input: A program in DirectionLang (as an ASCII string consisting of DirectionLang instructions) A list of pairs of integers, henceforth known as the pretty places. This list may be taken in any reasonable format. You should then output a truthy value if th...
stackexchange_codegolf
As a programmer or computer scientist one might encounter quite a lot of trees - of course not the woody growing-in-the-wrong-direction kind, but the nice, pure mathematical kind: *<- root (also a node) /|\<- edge * * *<- inner node | / \ * * *<- leaf (also a node) | * Naturally over time we all have put tog...
stackexchange_codegolf
It's the end of the year, you and your friends have just received your grades and ranks for the GOLF101 class. On a chat group, everyone sends their grade and rank to see who's got the best one. Problem: someone is lying. Here is an excerpt from the chat: <A> I'm ranked 1 with a grade of 85. <B> Ranked 3, got 50. <C> R...
stackexchange_codegolf
Introduction I have some ASCII cars that have velocity and direction. Their velocity is represented by their number. If a car is <> then it has stopped. For example: <> 1> 2> 3> After one second, I get <> 1> 2> 3> After two, I get <> 1> 2> 3> If two cars are too close, they crash. 1> <1 1> <2 Afte...
stackexchange_codegolf
Can you recover a sequence of letters from a sequence of dots and dashes? In Morse code, x is represented by -..-, but without the help of spaces, -..---.-... could represent xmas, or dole, or teettteteee, etc. I took the lyrics from "Rudolph, the Red-Nosed Reindeer" to make the following sequence of letters: youknowda...
stackexchange_codegolf
Your input is a ragged list of positive integers and a positive integer. Your task is to find that positive integer and return it's index, or if the positive integer doesn't exist, indicate it's nonexistence. How are indices in ragged lists defined? They are simply lists of indices that when used consecutively to index...
stackexchange_codegolf
Description We consider a slightly simplified version of Tetris where each move consists of: rotating the piece clockwise, 0 to 3 times positioning the piece at a given column fast drop The goal is to determine the number of completed lines, given a list of such Tetris moves. Completed rows are removed as pieces are ...
stackexchange_codegolf
Challenge You find yourself in a bash terminal, and want to do some simple tests on sqlite3. So you issue the following command: echo "CREATE TABLE T (id INT NON NULL PRIMARY KEY)" | sqlite3 test.db Now you want to insert the first N integers (starting from 0, excluding N) into the table T. For convenience, you execut...
stackexchange_codegolf
Challenge description Dominoes is a game played with tiles with two values on it - one on the left, one on the right, for example [2|4] or [4|5]. Two tiles can be joined together if they contain a common value. The two tiles above can be joined like this: [2|4][4|5] We'll call a sequence of n joined tiles a chain of le...
stackexchange_codegolf
Challenge: Input: a string, consisting of only printable ASCII characters Output: a truthy/falsey value whether its characters are in alphabetical order (based on their UTF-8 unicode values), from any starting point inside the string including wrap-around by going left-to-right For example: xyzabc would give a truthy r...
stackexchange_codegolf
It's well known that corrupted JPEG files or NTSC/PAL streams will appear as distorted versions of the true images, or versions covered in random-looking blocks of pixels. Consider the below image (from here): If we run it through this filter (with settings 44, 7, 21, 83, for anyone who wants to reproduce it), it end...
stackexchange_codegolf
A magic square is an n-by-n square grid, filled with distinct positive integers in the range 1,2,...n^2, such that each cell contains a different integer and the sum of the integers in each row, column and diagonal is equal. Your task is to take an n-by-n matrix consisting of positive numbers, and a placeholder charact...
stackexchange_codegolf
In this challenge you have to make an ascii pulsing heart with rhythm problems (Heart arrhythmia) and then measure the pulse.Don't worry it's easy! Making the heart The heart alternates between these 2 states: state 1 ,d88b.d88b, 88888888888 `Y8888888Y' `Y888Y' `Y' state 2 d8b d8b ...
stackexchange_codegolf
Given an array of integers A, the task is to output another array B of the same length so that B[i] is the maximum over A for every index that is not i. That is \$B[i] = \max_{i' \ne i} A[i']\$. Examples: A = [1, 5, -3, 4, 2]. B = [5, 4, 5, 5, 5] A = [1, 2, 3]. B = [3, 3, 2] A = [-1, -2, -3, -1]. B = [-1, -1, -1, -1] ...
stackexchange_codegolf
This is Markov. Markov's golf ball rolls around randomly. Markov's ball will hole however he strikes it. Markov is smart. Be like Markov. And this: is an anthill in Langton's backyard. The anthill is big enough to hold Markov's golfball, MarGolf. However, the anthill moves and changes direction depending on the surro...
stackexchange_codegolf
This challenge has officially ended. Further submissions will not be competitive (but are still welcome!). View the scores here In this challenge, submissions ("bots") should be Javascript functions which try to win as many races as possible. In each race, bots will have a limited amount of energy which should be use...
stackexchange_codegolf
An old test for programmers, taken from here (Note: in italian). Along a road (denoted by '_'), there is a Magical Piper (denoted by 'P') and several mice (represented by the two characters 'o' and '~', that denote respectively the head and the tail of the small rodents). Write a program that prints how many mice are g...
stackexchange_codegolf
Step one In a new google sheet insert an image into cell A1 with Insert > Image > Image In Cell Step two Create a formula to return TRUE (if the cell contains an image) and FALSE (if the image is missing) Rules Only vanilla formulas are allowed. The shortest code in bytes wins.
stackexchange_codegolf
This challenge is based on the idea of Plouffle's Inverter. Write a program in any language that does the following: Takes as input a non-negative rational number X written in decimal, for example 34.147425. Returns a mathematical expression using only non-negative integers, whitespace, parentheses, and the following ...
stackexchange_codegolf
Given a string of the characters +=- where there is at least one =, insert positive integers between all the symbols and at the start and the end such that the math equations are satisfied. For example, given the input +-=-= you need to insert positive integers A through F like this A+B-C=D-E=F such that the equation...
stackexchange_codegolf
Each character in this 64 by 64 block of text has been chosen randomly and uniformly from the 95 printable ASCII characters. /rq$:Zy5*g'$DeGXX2o8y "{@Cg:FR9qih}xh >5$DsF1Fs5Ao~smFp;.RJbV )U c4\(|Sx*V$10G9xO:NjHKasem%,\9[pPm@&kTaN~HC[;9`lgqlAH(7dt0a-5}LJ[ &sifw9V-.PLRoD~F'dJYA^Q)L#h>$9h!B4b&ceKp8~HndzDm#1/ySydrf5T8[Y%4 ...
stackexchange_codegolf
The world of art is full of colour, but the world of the network is even fuller than the world of art of diferent colours and it's renderings. That's why we need to know how to convert one type of colour format to another. The challenge is self-evident: Write a program / function than converts an given HEX code (#00ff0...
stackexchange_codegolf
Create a function, expression, or program which does the following: Take the prime factors of any number and sum them. For example, the prime factors of 28 are 2 2 7, summed to 11. Multiply the result by the number of prime factors for the given number. E.g, 28 has 3 prime factors which sum to 11. 11 * 3 is 33. Repeat...
stackexchange_codegolf
Recently I asked for tips on improving some code-golf of mine. The code was supposed to output every third value of the Fibonacci sequence starting with 2: 2,8,34,144,610,2584,10946,46368,196418,832040 However, I made a mistake in deriving my formula, and my code output a different sequence which is accurate for the ...
stackexchange_codegolf
I've searched around, and cannot find a challenge too similar to this one--however, it would not surprise me if this is not the first of its kind. My apologies if I've overlooked something. The Challenge This challenge is intended to amuse those of every skill level and users of every language. Your task, in itself, is...
stackexchange_codegolf
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, except that sequence is shifted by one, starting with fib(1) = 0 instead of fib(1) = 1. This is code golf. Lowest byte count wins. E...
stackexchange_codegolf
Note, challenge copied from question asked at math.stackexchange. Recently, I attained quite some skill at blowing bubbles. At first I would blow bubbles like this: But then things started getting strange: After a while, I was blowing some pretty weird bubbles: After blowing hundreds, maybe even thousands of such bu...
stackexchange_codegolf
The divisors of a natural number form a poset under the relation of "a divides b?", \$a | b\$. This challenge is to produce the number, \$C\$, of non-empty chains of such posets for natural numbers, \$N\$. This is A253249 in the Online Encyclopedia of Integer Sequences. That may sound complicated, but it's not really, ...
stackexchange_codegolf
Challenge: Given an ASCII art of a (possibly leaky) bowl consisting of a random distinct non-whitespace and non-~ character, fill it completely with ~ characters. If the bowl is leaky, fill the bottom row below the bowl and a stream of liquid emerging from that, with the intended amount of ~ if the bowl would not have ...
stackexchange_codegolf
In the video game Minecraft, the player can obtain experience points (XP) from various activities. In the game, these are provided as XP "orbs" of various sizes, each of which give the player various amounts of XP. The possible orbs are shown in the image below, along with the smallest and largest amount of XP that orb...
stackexchange_codegolf
Given 2 brainfuck code snippets A and B, output some brainfuck code C which has the same behavior as running B with the input of As result. Note that C must work for any input that match the following assumptions, as if it were given to A. You can assume: Finite input. both A and B halt. EOF is consistently 0 or consi...
stackexchange_codegolf
Given an integer n, output the following ASCII art to n rows: 1+1=2 1+2=3 2+3=5 3+5=8 5+8=13 Essentially, the first row is 1+1=2 and the nth row (1-indexed) is \$f_n + f_{n+1} = f_{n+2}\$ where \$f\$ is the Fibonacci sequence, padded so the numbers line up with the previous row. You may instead out...
stackexchange_codegolf
Objective You are to write a program that receives an integer n as input (from the command line), and embeds itself (the program) n directories down the directory tree. Example with n=5: The folder names may be whatever you wish. The only requirements are that the depth is correct, and that the program can then be ran...
stackexchange_codegolf
The usual correlation coefficient (in 2d) measures how well a set of points can be described by a line, and if yes, its sign tells us whether we have a positive or negative correlation. But this assumes that coordinates of the points can actually interpreted quantitatively for instance as measurements. If you cannot do...
stackexchange_codegolf
Make an upside down triangle of positive integers. Every number in the triangle must be distinct. Each number is the summation of its two parents (similar to how Pascal's triangle is constructed, but upside-down). Construct it in such a way that the bottom number is minimized. For example, for input n = 4, here is a po...
stackexchange_codegolf
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. Input <: print CBA. Input ^: prin...
stackexchange_codegolf
K-means is a standard unsupervised clustering algorithm, which, given a set of "points" and a number of clusters K, will assign each "point" to one of K clusters. Pseudo-Code of K-means Note that there are many variants of K-means. You have to implement the algorithm I am describing below. You may have some variation o...
stackexchange_codegolf
Background An almost regular hexagon is a hexagon where all of its internal angles are 120 degrees, and pairs of the opposite sides are parallel and have equal lengths (i.e. a zonogon). The following is an example of an almost regular hexagon, with side lengths 2 (red), 4 (blue), and 3 (yellow). A triangular domino ...
stackexchange_codegolf
This code-golf challenge will give you an integer n, and ask you to count the number of positive integer sequences \$S = (a_1, a_2, \dots, a_t)\$ such that \$a_1 + a_2 + \cdots + a_t = n\$, and \$\displaystyle \sqrt{a_1+\sqrt{a_2 + \cdots + \stackrel{\vdots}{\sqrt{a_t}}}} \$ is an integer. Example If n = 14, then the...
stackexchange_codegolf
Tamagotchi and Giga Pets were small electronic devices which simulated a little virtual pet. This pet had several stats, like health, hunger, etc. I recently wrote this example: import msvcrt,os,sys;d=m=100;h=s=t=p=0;f=10 while 1: os.system('cls'if os.name=='nt'else'clear');print("health:",d,"\nhunger:",h,"\nsleep:",...
stackexchange_codegolf
The keitai input method is a method for writing Japanese kana on a 12-key phone keypad. Similar to Western keypads, each kana is assigned to a key; when the key is pressed multiple times, it cycles between all kana assigned to that key. You will be using the following key-kana assignments, with this order of kana (base...
stackexchange_codegolf
Blackjack, also known as twenty-one, is a comparing card game between yourself and a dealer, where each player in turn competes against the dealer, but players do not play against each other. Play goes as follows, the dealer deals you a card. The dealer then deals them-self a card, face down. The dealer then deals yo...
stackexchange_codegolf