instruction
stringlengths
34
53.1k
Not a new one: Input N, being n, 0 ≤ n ≤ 5. Output N times "Hello World." Example: Input 3 Output Hello World. Hello World. Hello World. These 2 are my best solutions: First public class Out { public static void main(String[] a) throws Exception { java.io.OutputStream o = System.out; ...
Gah! It's a shame that Pokémon Sword and Shield won't introduce a new eeveelution. Let's mourn them with a code golf. The objective is to, when given a type name as the input, output the name of the corresponding eeveelution. When given Water, output Vaporeon. When given Electric, output Jolteon. When given Fire, outp...
Today's challenge: Given an ordered list of at least 3 unique integer 2D points forming a polygon, determine if the resulting polygon is Rectilinear. A polygon is rectilinear if every interior angle is a right angle. The edges do not necessarily have to be purely vertical or horizontal (parallel to the x or y axis), ...
Description Given an object (json), write code to extract all the keys from it. This is a question that I really wanted to ask everybody for a long time ago but I did not have time to write it up. It can be helpful in some cases in your daily work. Rule: You can use any parse function to get the JSON object, it does n...
Given an input integer, output the volume corresponding to the value. The value will always be in the range \$[0,100]\$. Examples If the input \$=0\$: _/| | |\/ |_ |/\ \| If the input \$>0\$ and \$<33\$: _/| | |\ |_ |/ \| If the input \$\ge33\$ and \$<66\$: _/| \ | |\ \ |_ |/ / \| / If the input \$\ge66...
Let's say we have some arbitrary number: For example 25. We also have some "tokens" (poker chips, money, something similar) with different values. Values of tokens are 2; 3; 4; 5. "Tokens" are limitless You need to achieve number 25 using exactly n tokens (for example, 8) and to output all possible ways of doing so. F...
Shikaku is a 2D puzzle. The basic rundown of it is that a rectangular grid has some numbers in it, and you want to partition the grid into rectangular components such that each component contains exactly one number which is the number of grid squares in that component. This challenge involves a 1D simplification of thi...
You are starting up a cryptocurrency exchange website which supports conversion from USD to two currencies, foo-coin and bar-coin. Write a program that takes the exchange rate for each coin to USD as arguments and outputs the maximum value of USD that cannot be completely divided into the two currencies (assuming these...
Your task is to write a program, function, or snippet that will output one value if run forward, and another if run backward. The program must run without errors. The output can be any two distinct values, of the same data type. For example, 1 and 3, true and false, or 't' and 'f'. In languages without a concept of dat...
Introduction The Fibonacci sequence is a mathematical sequence in which each term is the sum of the \$2\$ terms before it; the first two terms are \$0\$ and \$1\$. The first few terms are \$0, 1, 1, 2, 3, 5, 8, 13\$. However, it is possible to make variations of this sequence, where each term is the sum of the, say \$3...
Introduction Every letter in the English alphabet can be represented as an ASCII code. For example, a is 97, and S is 83. As we all know, the formula for averaging two numbers \$x\$ and \$y\$ is \$\frac{x+y}{2}\$. I'm pretty sure you can see where this is going. Your challenge is to average two letters. Challenge Yo...
Your task is to write a program or function which takes a pure brainflak program as input (assume it contains only balanced ()[]{}<>), and output a visually mirrored copy of it. If you reversed a brainflak program as a string, say ({}()) (add one to an input), you would get ))(}{(, which is not valid. Instead, you shou...
Your challenge is to create the longest run of characters with incrementing Unicode codepoints in a pristine program as you can. To keep things simple, I'll abridge the definition for this challenge to be "any program which produces no errors but will error if any one character is removed". Let's define a codepoint run...
Print the ASCII version of a random grid. ################################################################################ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ############# # # ...
Your challenge is to parse nonsensical text and output a "congruous phrase" - which I shall define here to be text with any contiguous characters in between, and including, a given set of like symbols removed. The given set of like symbols (ignore all brackets and commas here, they're only for notation) are: {(< >), (^...
Challenge Construct n strings, each with three distinct letters, chosen randomly with equal probability. Print the proportion k/n where k is the number of strings such that all three characters are in ascending order. Print also those k strings. Input The only input is n (and thus it must be a positive integer). Ou...
Background Set is a card game. The deck consists of 81 unique cards that vary in four features: number of shapes (one, two, or three), shape (diamond, squiggle, oval), shading (solid, striped, or open), and color (red, green, or purple). For convenience, let's write a card as a 4-tuple of numbers from 1 to 3, e.g. 111...
Given a description of the base state of a recursive ASCII pattern, output an expanded state somewhere along the recursion steps. More specifically: Let the following be an example: ##.. ##.. ..__ ..__ Where # is filled, . is empty, and _ is recursive. This describes a pattern wherein the top left quarter is filled, t...
Today is November 11th, which for many regions is Remembrance Day. If you don't know anything about the history or context of Remembrance Day, you can read about it in the wiki page, but it's not relevant for this challenge. In Flanders Fields is a poem that is pretty well-known relating to this day. It opens like so: ...
Introduction I have an even number of bottles, all of different sizes. Unfortunately, I only know the size of the smallest bottle: 300ml. I also know the following: Half of the bottles are twice the size of the other half, meaning that the smallest small bottle and the smallest large bottle are in a ratio of 2:1. The...
I have a piece of paper whose shape is a regular n-gon with side length 1. Then I fold it through some of its diagonals. What is the area of the shape formed by the (former) edges of the regular polygon? Illustration Suppose n = 8, i.e. an octagon-shaped paper. Let's name the vertices from A to H (left picture). Then I...
In some parts of the world, phone numbers are fixed-length, apparently. That sounds boring, though. For this challenge, your task is to take the digits of a what is presumed to be a valid phone number, and format it based on some simplified rules around what a phone number looks like. Input format Your input will consi...
Challenge Write code that, given an English word, outputs the number of syllables it has. Scoring will be determined by a combination of code length and accuracy. Rules The accuracy of the solution should be measured against this CSV file (which countains syllable counts for all the 52,439 entries in the CMU Pronounc...
A guess the word game The agreed dictionary. All words are 6 letters long with all letters distinct Rules: This is a game of two players and the task will be to implement Player 2. Player 1 chooses a word from the agreed dictionary Player 2 repeatedly guesses a word from the agreed dictionary. At each turn, Player 1 ...
At the time of writing this puzzle, there are soon to be 269 puzzles related to primes. To celebrate/mourn this event (269 is prime), this challenge will be about exploding primes. In preparation for this task, I've obtained a permit (legal, I assure you) for dynamite charges of military grade, along with enormous dyna...
In as few bytes as possible, sort the input, a delimited string OR list/vector/array of words, words contain printable ASCII except space (ASCII values 33-126) into a numbered list, table, or something resembling a table, by length. Table rules are as follows: Order is mandatory, direction is optional, either labelled...
Description Your input is a list of integers \$[a_1, \dots, a_n]\$. A magic triplet is a triplet \$(a_i, a_j, a_k)\$ of values from this list, such that the indices \$\{i, j, k\}\$ are all distinct, the values are in ascending order (\$a_i \leq a_j \leq a_k\$), and the sum of two of the values equals the third. Your ...
Write a function or a full program that applies an ASCII texture to a 2d shape. Inputs: shape, texture, dimensions(optionally). Both Shape and Texture can be given by any convenient method (2d matrix, array of strings or string with newlines) Shape data have a rectangular shape and contains 2 possible values: [truth...
This simple challenge is very similar to this one: How many days in a month? The only difference is you yield the number of days in a month given the index of the month instead of its name. The reason I ask this near-duplicate is curiosity about mathematical patterns in the sequence of numbers. For example, a simple ob...
The quaint hamlet of Кодгольф in the Russian far east has a problem: their population is low (below 66), and no new people have arrived for years. Moreover, after centuries of near-isolation, just about everybody is related to each other. Mayor Стекобмен has a solution that should keep the morale high: organise a weddi...
Introduction The Cartesian product of two lists is calculated by iterating over every element in the first and second list and outputting points. This is not a very good definition, so here are some examples: the Cartesian product of [1, 2] and [3, 4] is [(1, 3), (1, 4), (2, 3), (2, 4)]. The product of [1] and [2] is [...
Your task is to write the shortest algorithm in a language of your choosing that accomplishes the following: Given two matrices it must return the euclidean distance matrix. The euclidean distance between two points in the same coordinate system can be described by the following equation: \$D = \sqrt{ (x_2-x_1)^2 + (y_...
Your task is to convert Chinese numerals into Arabic numerals. A problem similar to Convert Chinese numbers, however, more complex. Also, answers given there mostly don't satisfy all the conditions. Chinese digits/numbers are as follows: 0 零 1 一 2 二 2 两 3 三 4 四 5 五 6 六 7 七 8 八 9 九 10 十 100 百 1000 千 10000 万 10^8 亿 Multi...
Sandbox 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 Unicode block was invented. However, manually substituting these characters into one's answer is time-consumin...
This is the exact same question I asked earlier, but without the annoying Cyrillic factor which many found superfluous. I hope this is a better puzzle! The quaint hamlet of North Codetown in the Scottish far north has a problem: their population is low (below 52), and no new people have arrived for years. Moreover, af...
I want to be down with the kids of the 1990's and start speaking this L33T speak of their's. For any given input I would like the resulting L33T speech as an output. I don't want to go to far down the rabbit hole so let's start simple. Consider the following replacements: B or b = 8 E or e = 3 I or i = 1 S or s = 5 Let...
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 ...
Introduction All these snakes everywhere! I've had enough, and have decided that I much prefer camels. Therefore, I want you to convert my snakes to camels for me. Challenge Turn any snake_case string into a camelCase string. Capitals should be returned to lowercase before the conversion occurs. Test Cases In: camel_c...
Gaussian integer is a complex number in the form \$x+yi\$, where \$x,y\$ are integer and \$i^2=-1\$. The task is to perform such operation for Gaussian integers \$a,b\$, that \$a=q \cdot b+r\$ and \$|r|<|b|\$ (\$q,r\$ are Gaussian integers, \$|z|\$ is defined as \$\sqrt{a^2+b^2}\$ for \$a+bi=z\$). Need to output only ...
Part 2 of the challenge is here Flags Mashup Bot is a small Twitter bot that generates a new flag based on two random flags and tweets the result every couple of minutes. Task Your task is to replicate what the bot does by writing a script or a function based on the following criteria: The input is any two lossless i...
Background The Look and Say Sequence is built up by reading off the digits of previous entries in the sequence, counting the number of digits in groups of the same digit. For example: 1 => 11 # (one 1) 11 => 21 # (two 1s) 21 => 1211 # (one 2, then one 1) 1211 => 111221 # (one 1, then one 2, then two 1s) This sequence ...
Reproductive strategy of oozes can be summarized as follows: o O 8 oo A population of oozes at generation N is described by a string, for example: ooooo88ooOoOo8Ooooo8OOoo8Oo8Oo8oo8oooooo8OOooO88o To compute the population at generation N+1, take one character randomly, and replace it by the result of ooze evolution...
Disclaimer: This challenge inspired by me spending the morning debugging recursive functions, which have been frying my brain a little. Here's an example of recursion, from a letter, we keep going to the previous letter of the alphabet, printing out each one as we go, until we hit the letter a, then we print that and s...
Disclaimer: This challenge inspired by me trying to find pairs in a large pile of socks. Disclaimer: This is looking for a very different process and output to Help me sort my socks!. Please don't claim it as a duplicate until you've read both ;) So, I have a huge pile of socks. Of course I keep them categorized by c...
Your task is, given a family tree, to calculate the Coefficient of Inbreeding for a given person in it. Definition The Coefficient of Inbreeding is equal to the Coefficient of Relationship of the parents. The Coefficient of Relationship between two people is defined as weighed sum over all common ancestry as follows: E...
You are to write a program that, when given an integer between 1 and 5 (or 0 and 4 if you wish to use 0-indexing), outputs one of Code, Golf, and, Coding or Challenges. Each input can map to any of the five outputs. However, the mapping must be one to one (each input goes to a different output) and consistent when runn...
Although what is a Pascal's triangle is well-known and we already can generate it, the task is now different: Output \$n\$ first lines of the Pascal's triangle as colored bricks. Color number is computed as maximal power of \$d\$, that divides the needed-to-color element or \$7\$ if power is more than \$7\$. Numbered c...
Draw the ionising-radiation-hazard-symbol in an arbitrary colour on a distinctly coloured background. The specific proportions were published in the June 27th 1974 issue of the Federal Register of the US Government. Details As output, writing to a file (raster and vector formats are permitted) or displaying on the scr...
This wasn't originally intended for code-golf, just as a little debugging routine to roughly visualize something "goofy" going on in a model of some (irrelevant here) physical process. But when I saw how surprisingly short it was, compared to my expectations, I just wondered if it can be further shortened. And that's p...
Part 1 of the task is here Flags Mashup Bot is a small Twitter bot that generates a new country name based on two random country names and tweets the result every couple of minutes. Task Your task is to replicate what the bot does by writing a script or a function based on the following criteria: The input is two cou...
Introduction Each Unicode codepoint can be represented as a sequence of up to 4 bytes. Because of this, it is possible to interpret some 2, 3, or 4-byte characters as multiple 1-byte characters. (See here for a UTF-8 to bytes converter). Challenge Given a UTF-8 character, output it split into a sequence of 1-byte chara...
Please note: this is a restricted-source challenge — see details below! Each natural number \$n\$ has 10 faces: its decimal representations in bases \$1\$ through to \$10\$. For example, the 10 faces of \$12\$ are \$[111111111111, 1100, 110, 30, 22, 20, 15, 14, 13, 12]\$, and the 10 faces of \$4\$ are \$[1111, 100, 11,...
This challenge is based on Project Euler problem 208. Also related to my Math Stack Exchange question, Non-self-intersecting "Robot Walks". You have a robot that moves in arcs which are \$1/n\$ of a circle, with each step turning toward the left or to the right. The robot takes in an array of instructions of the form \...
Create three programs, which we'll call Rock, Paper, and Scissors. Each program must be unique, and accept input. If a program gets any input which is not one of the programs Rock, Paper or Scissors, it must print itself. RPS style, the programs will each print one of the following four outputs: "win" if the running ...
The title pretty much describes it all. Given as input a \$n \times m\$ matrix and an integer \$i\$ create a complete function/program that returns the matrix \$i\$ times clockwise rotated by \$90^\circ\$. Rules: as matrix you can use any convenient representation you like e.g. a list of lists etc... matrix values can...
I have a fixed length vector of 4 elements. The inputs of which are always 0 or 2^n for n = 1 to 15 (so n = 0 excluded i.e. 2^0 = 1 will not appear) x = [32, 4, 4, 8] the result should be x = [32, 8, 8, 0] The way it works is that values that are the same will get combined, but one it's combined it can not be combined...
Oof! You've been coding the whole day and you even had no time for Stack Exchange! Now, you just want to rest and answer some questions. You have T minutes of free time. You enter the site and see N new questions. To write an answer for each you'll need ti minutes. Of course, as a dedicated reputation gatherer, you wa...
This challenge is inspired by one of my other challenges: Pointlessly make your way down the alphabet That challenge asked you to take a string of text, and for each letter produce a sequence of letters moving down the alphabet to 'a'. For this challenge I'd like to decode the output of that challenge (minus the line b...
Can Alice win the game? The game's rules are as follows. First, a finite non empty set of positive integers \$X\$ is defined. Then, Alice and Bob take turns choosing positive integers, with Alice going first. Each integer must be strictly less than the previous one, and the game ends when one of the players chooses \$1...
Consider a positive integer N written in base b. A sequence is generated from this number by finding the largest digit d in the expansion of N and writing N in base d+1, repeating until the base the number is written in can be decreased no further. For example, the sequence generated by 346 (10) in starting base 16 has...
This challenge is inspired by turn based videogames like "Heroes of Might and Magic" Implement this game mechanic: There is some units(Imps, Swordsmans etc...) in our game Every unit have an integer "initiative" Your program must decide which unit's turn now - based on unit's initiative The more initiative means mor...
I can see that it is 101 'moving to the right' but I cannot think of a short way to generate it in R language. \$\begin{bmatrix} 0 & 1 & 0 & 0 & 0 & 0 \\ 1 & 0 & 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 0 & 1 & 0 \\ \end{bmatrix}\$
You are to create a program which, when given a positive integer \$n\$, outputs a second program. This second program, when run, must take a second positive integer \$x\$ and output one of two distinct values depending on whether \$x\$ is divisible by \$n\$. Those values must be consistent for a given \$n\$ but can be ...
You are given three parameters: start(int), end(int) and list(of int); Make a function that returns the amount of times all the numbers between start and end are multiples of the elements in the list. example: start = 15; end = 18; list = [2, 4, 3]; 15 => 1 (is multiple of 3) 16 => 2 (is multiple of 2 and 4) 17 => 0 18...
Given a level from a simple platform game, your task is to make a program or function to determine if a level is winnable. Platform game levels are 4 characters tall and any number of characters wide. There is exactly one platform for each horizontal space in a level: ======= = == = = ...
(Note: this challenge is distinct from my other challenge (Draw a path made from direction changers) because of it's rendering of direction (horizontal or vertical), crossing points and single or double paths.) Let's start with a frame drawn in Ascii characters. For this challenge it will always be 20 characters wide ...
What are some tips on how to shorten this code even further? The code is meant to compute the parallel resistance of an electric circuit. Using scanf float r;main(){float a;scanf("%f",&a);r+=1/a;printf("%f",1/r);main();} Using command-line arguments #include<stdlib.h> float r;main(c,v)char**v;{for(int i=1;i<c;)r+=1/at...
The totient function \$\phi(n)\$, also called Euler's totient function, is defined as the number of positive integers \$\le n\$ that are relatively prime to (i.e., do not contain any factor in common with) \$n\$, where \$1\$ is counted as being relatively prime to all numbers. (from WolframMathworld) Challenge Given an...
Inspired by Flow Fit: Sudoku, a brand-new mobile puzzle game (as of Nov 2019). Background A Latin square is a square grid of side length \$ n \$ filled with \$ n \$ different symbols, where each row and column contains each symbol exactly once. Let's define a row (resp. a column) as a maximally consecutive group of cel...
You get a string which contains an integer between 1000 and 99999999 as input. The input string might contain leading zeroes but cannot be longer than 8 characters. Your goal is to output all dates between 6th of December 1919 and 5th of December 2019 which fit the input in these formats: day - month - year (dmy) mont...
How many atoms in the hydrocarbon? A hydrocarbon is a chemical compound which consists of only hydrogen and carbon atoms. For this challenge, we will only consider the three simplest kinds of hydrocarbons: alkanes, alkenes, and alkynes with no branches. An alkane with \$n\$ carbon atoms contains \$2n+2\$ hydrogen atoms...
Morpion solitaire This is a game that I remember having learnt from my grandparents in my childhood. Initially I didn't know the name. G B has found it to be Join Five (or less ambiguously - Morpion solitaire) with a slightly different starting position. NOTE: it seems that it's kinda known and this problem formulation...
Sandbox Given two positive integers a and b, return the smallest multiple of b that is greater than or equal to a. Examples Definitions: true = is a multiple of b, false = is not a multiple of b. f(1,3) = 3 because 1 is false, 1+1 is false, but 1+1+1 is true. Therefore 3 is returned. f(5,3) = 6 because 5 is false, but...
The permanent of an \$n\$-by-\$n\$ matrix \$A = (a_{i,j})\$ is defined as: $$\operatorname{perm}(A)=\sum_{\sigma\in S_n}\prod_{i=1}^n a_{i,\sigma(i)}$$ For a fixed \$n\$, consider the \$n\$-by-\$n\$ matrices whose entries are taken from \$\{-1, 0, +1\}\$ . Task For each \$n\$ from 1 upwards, output the number of \$n\$-...
Roll for Initiative! Introduction In tabletop games like Dungeons and Dragons, when you begin a battle, all involved parties roll for initiative. In DnD 5e, this is 1d20 + DEX + Other bonuses, where DEX is the bonus given by your Dexterity stat. The characters that roll higher numbers go first. We'll use a similar, det...
Problem 4 in the 2019 BMO, Round 1 describes the following setup: There are \$2019\$ penguins waddling towards their favourite restaurant. As the penguins arrive, they are handed tickets numbered in ascending order from \$1\$ to \$2019\$, and told to join the queue. The first penguin starts the queue. For each \...
Write a function or program which takes as input a set of distinct, non-negative integers \$\{x_1, \ldots, x_n\}\$ and outputs the smallest gap between any two values in the set, i.e. \$\min_{i\neq j}|x_i-x_j|\$. Scoring This is not code golf. Your score is the smallest gap of the set of code points of characters in yo...
Once upon a time I wanted to order custom tokens for a board game. They say they can do it, and then they present me their price list. I was confused because they charge per inch of head movement, and I have no idea how much will my tokens cost. INPUT: a 2d grid: |,-,\,/ are straight cuts. Each has a length of 1. ┌,┐,...
The code: function L(){N=null;E=[N,N];t=this;h=E;t.u=i=>h=[i,h]; t.o=_=>h==E?N:h[+!(h=h[1])];t.e=(i,l)=>h=(l||h)==E?[i, E]:[(l||h)[0],t.e(i,(l||h)[1])];t.s=_=>{o="";while(i=t.o()) {o+=i+","}return o}} For my response to this (old) question: https://codegolf.stackexchange.com/a/196783/72421 (my linked answer has a com...
Let me know if this task has already been posed. I haven't found it when I looked. Input master sequence \$\ X = x_1\dots x_n\$: sequence of characters, eg. \$\rm international\$ subsequence \$\ Y = y_1\dots y_m\$: sequence of characters, eg. \$\rm intl\$ Output Number of possible mappings \$\mu: [1\dots m] \righta...
Create a program that outputs Hello, World! The winner is the source code that is the biggest, subject to the constraint that it is irreducible For this challenge, irreducible means there does not exist a program that outputs Hello, World! that can be constructed by removing characters from the original program. For ex...
Inspired by Help me pair my socks, and the fact that I have some pairs of socks where the left sock is distinct from the right. Background Again, I have a huge pile of socks. And a machine that can give the list of labels of the socks for me. This time, the labels follow these rules: Some socks have left and right ve...
Introduction An elementary cellular automaton is a cellular automaton that is 1-dimensional and has 2 states, 1 and 0. These cellular automata are categorized based on a simple code: the Wolfram code, invented by Stephen Wolfram (yes, the Wolfram | Alpha guy). It works like this: First, you the set of all possible sta...
Introduction Big 2 is a card game popular in East Asia and South East Asia, in which 4 players are dealt 13 cards each (ie, an equal division of a standard deck without jokers). The goal is to empty your hand before any of the other players. Players take turns playing combinations of a Big 2 subset of standard poker ha...
Sandbox A spin-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/argument. The tricky part is that if I left shift your source code, the output must be left shifted too. Likewise, if I right shift your so...
Sandbox 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 modular pairs (F(n-1) % k, F(n) % k), and noting that there are only a fini...
Sandbox post In this code-golf challenge, you are provided with a series of y values at even x-values as well as a console width and height. The desired output is an ASCII-art representation of a ribbon plot of the y-values scaled to the desired size. If all values are positive or negative, the x-axis should be display...
Some sleep commands implement a delay of an integer number of seconds. However, 2³² seconds is only about 100 years. Bug! What if you need a larger delay? Make a program or a function which waits for 1000 years, with an error of less than ±10%. Because it's too time-consuming to test, please explain how/why your soluti...
Introduction A polyglot is a program that is valid in multiple languages at once. An iterative quine is a program that outputs another program that outputs another program that outputs the source of the original program. Note that the number of chained programs does not have to be 3; it could be 2, 4, or 97384. Challen...
Sandbox There are special sets S of primes such that \$\sum\limits_{p\in S}\frac1{p-1}=1\$. In this challenge, your goal is to find the largest possible set of primes that satisfies this condition. Input: None Output: A set of primes which satisfies the conditions above. This challenge is a code-challenge, where your s...
Simple question! Given a string that contains a date in ISO8601 format, print the first of the next month in ISO8601 format. Example inputs: 2018-05-06 2019-12-20 Their respective outputs: 2018-06-01 2020-01-01 The rules: Imports are free and don't count towards your score. The date will be stored in a string called s...
In this challenge you will be asked to take a knot and determine if it can be colored in a particular way. First we draw a diagram of the knot. We use the standard way of drawing knots where we put gaps in strands where they pass under each other. Here is an example of some knots drawn this way: Taken with permissio...
This challenge is from a game called Keep Talking And Nobody Explodes. Memory is a fragile thing but so is everything else when a bomb goes off, so pay attention! – from the manual The Objective A number from 1–4 is given as the "display", along with scrambled numbers 1–4 as the "buttons." The output must be the label ...
The task here is pretty simple. You should write a program that takes a string as input and outputs it (that is a cat program). Additionally when the \$n\$th byte of your program is removed (without replacement) the augmented program should take a string as input and remove the \$n\$th character. If the input to your...
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 regexes (which matches r followed by s) Note that du...
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 happens to be on Novemb...
Sandbox What is Hexagonification™? Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then rotated by 0, 120 and 240 degrees respectively, as shown in the following image. A triangle hole may appear in the middle, but that isn't a ...
This is kept fairly original: Write a program that creates a standard blackjack game: input "h" means hit or draw another card input "s" means stand, or take what you have already Rules: cards values are as follows: 2-9 = face value of card 10, J, Q, K = 10 aces = 11 unless player busts, then it's only a 1 if 2 or m...
Dowker notation is a common way of representing mathematical knots. Dowker notation can be derived from a knot diagram in the following way (based on the description from the wikipedium): We will label each of the \$n\$ intersections with two numbers whose absolute value is on the range \$1, \dots 2n\$ (one odd one ev...
Lost is a 2-Dimensional programming language where the instruction pointer starts at a random location, moving in a random direction. A description of the language can be found at the bottom of the post for completeness' sake and a tutorial for the language can be found in the above link. The task here is simple to de...