instruction
stringlengths
34
53.1k
Now that we know how to properly square and triangle a number, we are going to learn how to parallelogram one. To parallelogram a number, we first arrange it as a parallelogram by stacking it on top of itself a number of times equal to the number of digits it has, and adding spaces to make it a parallelogram. So 123 ...
Inspired by this Stack Overflow question: Sorting a list: numbers in ascending, letters in descending. Your task is to solve the following problem and, as this is code-golf, you should do so in as few as bytes as possible. You should take a list of objects as input containing letters (any reasonable form: string, char,...
Given an unsigned 16-bit integer N, your task is to determine whether its binary representation mapped inside a 4x4 matrix is matching a tetromino shape, and if so, which shape it is. Matrix Each bit of N is mapped inside a 4x4 matrix, from left to right and from top to bottom, starting with the most significant one. E...
Pascal's triangle is generated by starting with 1 and having each row formed from successive additions. Here, instead, we're going to form a triangle by alternating multiplication and addition. We start row 1 with just a solitary 1. Thereafter, addition is done on the odd rows, and multiplication is done on the even r...
Given a string of ASCII letters (upper and/or lower case), output the raw MathJax required to display that string bifurcating at each character, into superscripts and subscripts. For example, the inputs cat and horse would result in outputs which MathJax renders as the following, respectively: Note that only one inpu...
My Alarm Clock I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button moves it up one minute. Hitting both buttons at the same time resets it to midnight (12:00 am), and counts as two button...
Lost is a 2-D programming language where the start position and direction of the ip are entirely random. This makes it very difficult to make deterministic Lost programs. However today we are not writing a deterministic program, we are writing an RNG. Write a Lost program that takes no input and outputs a single digit...
Your task is simple, write a single code snippet that when executed in one language outputs only the string 'abc' and when executed in another language outputs only the string 'cba'. The program should take no input. This is a code-golf challenge.
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...
Challenge description In taxicab metric, a distance between two points is defined as: Consider a matrix with only zeros and ones: 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 Let's map each 1 to the distance to nearest different 1 in the matrix (of course, assuming that distance between two adjacent rows/column...
Now that we know how to Square a Number my Way, we need an inverse operation, a way to Square Root a Number my Way. To square a number my way, you simply stack it on top of itself a number of times equal to the number of digits it contains, and then take read off every number that is formed both vertically and horizon...
Anyone here a die-hard Bethesda fan? Maybe you prefer Obsidian Entertainment? Well, if you're either of those things than the following picture should be relatively familiar to you. I've taken the liberty of preparing a rather unique ASCII-Art challenge, so here's the first clue as to what I'm going to have you do: ...
The above image displays a hexagonal grid of hexagons. Each cell in the grid is assigned an index, starting from the center and spiraling counterclockwise around as shown. Note that the grid will continue indefinitely - the above picture is simply the first section. The next hexagon would be adjacent to 60 and 37. You...
Given two positive integers, W and H, output an ASCII-art box whose border is made of slashes (/ and \) with W "spikes" on the top and bottom edges, and H "spikes" on the left and right edges. The box's interior is filled with spaces. A "spike" is simply two slashes coming together to form an arrow shape: /\ \/ / ...
There are a few questions on this site about balancing brackets, and checking whether brackets are balanced. I propose it's now time to use those balanced brackets for something! In mathematics and programming, brackets are like bubbles, isolating everything inside form everything outside so that whatever's inside can ...
Challenge Here at PPCG, we sure do like our sequences, so here's a fun another one. Let's define a(n) as being the smallest non-negative integer X that is not equal to any a(k) (0 < k < n), and a(n-1) and X do not share any decimal digits. a(0) = 0 Given an input n > 0, output such a(n). For example, for input n = 13, ...
Chebyshev Polynomials are a family of orthogonal polynomials that pop up in all kinds of places in math, and they have a lot of quite interesting properties. One characterization of them is that they are the unique polynomials that satisfy \$T_n(\cos(x)) = \cos(nx)\$. Challenge Given an nonnegative integer \$n\$, you s...
Its been a while since you killed that hydra, you basked in the glory for years, but now people are calling you washed up, a has been. Well its time you prove them wrong, you've heard the whereabouts of annother hydra. Simply kill it and you will be awarded all the glory you deserve. You arrive at the armory to recei...
Input: Two strings (NOTE: the order of input is important). Output: Both words/sentences start on lines with one empty line in between them. They 'walk' horizontally 'next to each other'. But when they have the same character at the same position, they cross each other, and then continue walking 'next to each other'. C...
Given a list of integers, your task is to output the second largest value in the first k elements, for each k between 2 and the length of the input list. In other words, output the second largest value for each prefix of the input. You can output an arbitrary value for the first element (where k = 1), or simply omit th...
Everybody knows pi the mathematical constant, the ratio of a circle's circumference to its diameter. 3.14159265358979323846264338327950288419716939937510... You probably also know e the mathematical constant, the base of a natural logarithm. 2.71828182845904523536028747135266249775724709369996... But... do you know p...
Given an input list of non-empty strings, output an ASCII art representation of a tournament, based on the following drawing rules: The number of strings is guaranteed to be of quantity 2,4,8,16,etc. The first two strings play each other, and the next two play each other, and so on. This is the first round. For each g...
Given a string S and a list of indices X, modify S by removing the element at each index of S while using that result as the new value of S. For example, given S = 'codegolf' and X = [1, 4, 4, 0, 2], 0 1 2 3 4 5 6 7 | c o d e g o l f | Remove 1 c d e g o l f | Remove 4 c d e g l f | Remove 4 c d e g f ...
The difference list of a list of integers is the list differences of consecutive members. For example the difference list of 1, 3, 2 ,4 is 2, -1, 2 Your task is to take as input a difference list and output what the difference list would look like if the original list were sorted. For example the difference list 2, 1...
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 road: C.............................R.....
Given a single integer x where 0 <= x <= 91 output a stack of bottles of beer with that many bottles (and shelves) missing. For simplicity sake I'll only show the first 6 bottles and what it would be for each of the first inputs. Here's the stack of bottles, each number is the bottle you should remove for that input (1...
The coefficient of relationship refers to how much DNA two persons have in common. A parent has 50% common DNA with their child (unless the parents are related), so to calculate it we have to find all pairs of directed disjoint paths starting at same node (common ancestor) and ending at each of the two siblings, and su...
Well the title says it all. Standard loopholes apply Nothing to read from stdin, and output goes to stdout 1-byte-long programs are... nonsense. They don't qualify A program with a single byte repeated is also a nonsense (like aaa) Please mark it out if your program is a palindrome Sample: A program with source code...
Define the "maximum sub-array" of a given array as "a (consecutive) sub-array that has the biggest sum". Note there's no "non-zero" requirement. Output that sum. Give a description of your code if possible. Sample input 1: 1 2 3 -4 -5 6 7 -8 9 10 -11 -12 -13 14 Sample output 1: 24 Description 1: The biggest sum is yie...
Given a list of lists find the shortest list that is a contiguous sublist of exactly one list. For example if we had [[1,2,3], [1,2,3,4], [2,4,5,6], [1,2,4,5,6]] the shortest contiguous sublist would be [3,4] since it only appears in the second list. If there is no unique contiguous sublist (this requires at least ...
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 that represents a th...
Two lists A and B are congruent if they have the same length, and elements that compare equal in A compare equal in B. In other words, given any two valid indices x and y: If A[x] = A[y], then B[x] = B[y]. If A[x] != A[y], then B[x] != B[y]. For example, the lists [1, 2, 1, 4, 5] and [0, 1, 0, 2, 3] are congruent. Th...
Aliens have arrived, and they aren't friendly. Turns out, they've been in the process of converting all matter in the universe into compute capability so they can have more fun in their VR simulations. Our solar system is the last bit of space they haven't converted yet, and they're about to remedy this oversight. Howe...
Given a list of positive integers, output whether every adjacent pair of integers in it shares a prime factor. In other words, output truthy if and only if no two neighboring integers in the list are co-prime. In yet other terms: given a list of positive integers [a1 a2 … an], output whether        gcd(a1, a2) > 1 && g...
The date 0409·01·MO is New Year’s Day in the Ceres Calendar. Wish everyone and everything in the Asteroid Belt, Jupiter, Saturn and beyond a belated Happy New Year by writing a program to convert Julian Dates (JD) to Ceres Dates using these helpful landmarks: JD ...
Given as input a positive integer n>=1, output the first n rows of the following triangle: 1 1 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 1 1 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0...
Write a piece of code that takes a string as input, and outputs a piece of code in the same language that, when run, will output the initial input string. It must be able to handle any combination of characters A-Z, a-z, and 0-9. Example in Python: import sys print "print('" + sys.argv[1] + "')" Given the input of te...
Given a list of positive integers that contains at least 3 distinct entries, output a permutation of that list that isn't sorted in ascending or descending order. Examples 1,2,3 -> 2,1,3 or 3,1,2 or 1,3,2 or 2,3,1 1,2,3,3 -> 2,1,3,3 or 3,1,2,3 or 1,3,2,3 etc.. Thanks @Arnauld and @NoOneIsHere for the title!
Given a positive integer n >= 1, output the first n rows of the following structure: # # # ### # # # # # ## ## ##### # # # # # # # # # # ### # ## ## ## # ## ### ### ####### The n-th 1-indexed row is the binary representation of n, mirrored without copying the last character, with # in place of 1 a...
Many languages allow strings to be "added" with +. However this is really concatenation, a true addition would follow the group axioms: It is closed (the addition of any two strings is always a string) It is associative ( \$\forall a b . (a + b) + c = a + (b + c)\$) There is an identity (\$\exists e . \forall a . a...
Given any string, print it in the form of a triangle where the text runs up and down along each diagonal. For example, an input of "Hello World" should output: d l r d o l W r d o l o W r d ...
Write a program or function that takes in a quadratic equation and prints its factorized roots. The input can be taken in from any reasonable source, such as a function parameter, stdin, or a command line argument. Edit: This is not intended to be a duplicate of other quadratic equation questions. While others simply p...
We can define the Divisibility Streak k of a number n by finding the smallest non-negative integer k such that n+k is not divisible by k+1. Challenge In your language of choice, write a program or function that outputs or returns the Divisibility Streak of your input. Examples: n=13: 13 is divisible by 1 14 is divisib...
We define the hyper-average of an array / list (of numbers) the arithmetic mean of the sums of its prefixes. For example, the hyper-average of the list [1, 4, -3, 10] is computed in the following manner: We get the prefixes: [1], [1, 4], [1, 4, -3], [1, 4, -3, 10]. Sum each: [1, 5, 2, 12]. And now get the arithmetic m...
Given positive integer n > 2. We convert it to an array as follows: If it is equal to 2 return an empty array Otherwise create array of all n's prime factors sorted ascending, then each element replace with its index in prime numbers sequence and finally convert each element to array For example, lets convert number ...
Disclaimer: This is heavily inspired by "Polyglot the OEIS!" but fixes the problem that lead to closure (see the output section) and was re-posted as to not invalidate answers. Introduction We all know and love the on-line encyclopedia of integer sequences (OEIS). So what if we made an off-line version of the interesti...
The title is valid Jelly Code which has the same output as L€€ except printed twice. Background You can skip this section without losing ability to complete the challenge Some operations in Jelly try to convert its argument to a list first before applying the operation. One example is €, the mapping quick. This some...
As we all know, negative press covfefe has been conspiring to bring down the American president for some months now. There's also, definitely, an algorithm in play in that word. Covfe is a refreshing caffeinated beverage, and following the president's remarks it's clear the word can now be appended with successive f's ...
Many programming languages are written using solely printable ASCII, tabs and newlines. These 97 characters are then stored in 8-bit bytes (which are actually capable of holding 256 different characters!), which is just terribly inefficient - especially in code-golfing, where every byte counts! In this challenge, you w...
(Inspired quite heavily by this challenge) In the original challenge you were to make a horizontal zipper, however, looking down at my hoodie, my zipper is much more vertical (and a little bit broken) :P Input You will be given a single string (s), and a pair of integers (a and b) in any format. Where: a < (length-of-...
There's a cool magic trick that works using the power of binary. The effect of the trick is as follows: An audience member chooses some natural number in the range of 1 to x where x is chosen by the magician. The magician hands the audience member some special cards. Each card contains some numbers from 1 to x. The ...
Gozinta Chains (Inspired by Project Euler #606) A gozinta chain for n is a sequence {1,a,b,...,n} where each element properly divides the next. For example, there are eight distinct gozinta chains for 12: {1,12}, {1,2,12}, {1,2,4,12}, {1,2,6,12}, {1,3,12}, {1,3,6,12}, {1,4,12} and {1,6,12}. The Challenge Write a progr...
Challenge Given an arbitrary list of 2-tuples, and a single element in one of those tuples, output its "partner", i.e. given a and [(i,j),...,(a,b),...,(l,m)], output b. You can assume all tuples are unique, and that all elements in tuples are strings. Further assume you do not have both (x,y) and (y,x). Test cases Inp...
(Note: I'm not in the army so feel free to correct me if my formation is wrong, but I will not be changing the question. I will change any terminology mistakes though, because I'm trying to avoid air-cadet-specific wording choices) (Note: this follows the standards for Canadian Air Cadets, not any actual army thing) Ch...
So we're all hopefully familiar with Spreadsheet 'A1' cell notation. It's simply an alphanumeric representation of the positioning of said cell within a grid. The letter(s) represent the column positioning of the cell, and the number represents the row. The 'letter' part can consist of 1 or more letters from the 26 let...
Your challenge is to write a polyglot that works in different versions of your language. When run, it will always output the language version. Rules Your program should work in at least two versions of your language. Your program's output should only be the version number. No extraneous data. Your program may use what...
Warning : this is NOT a "hey, let's draw a cake in ASCII-art" challenge! Please keep reading ;) Some time ago it was my birthday, I'm 33 now. So there is this awkward social tradition consisting in inviting family and friends, putting number-like candles on a cake, sing songs and open gifts. 33 -------- Instead...
The crazy mathematician owns a wide collection of numbers, and therefore the space he has left is quite limited. To save some, he must fold his integers, but unfortunately he is really lazy. Your task, if you wish to help him, is to create a function / program that folds a given positive integer for our number maniac. ...
Let us say a substring is any continuous section of an original string. For example cat is a substring of concatenate. We will say that a proper substring is a substring that is not equal to the original string. For example concatenate is a substring of concatenate but not a proper substring. (single character strin...
Given an input n, your program or function must output the smallest positive integer k such that n rounded to the nearest multiple of k is greater than n. Example. Given an input 20, the output value should be 3: The nearest multiple of 1 is 20, which is not greater than 20. The nearest multiple of 2 is 20, which is...
The function TREE(k) gives the length of the longest sequence of trees T1, T2, ... where each vertex is labelled with one of k colours, the tree Ti has at most i vertices, and no tree is a minor of any tree following it in the sequence. TREE(1) = 1, with e.g. T1 = (1). TREE(2) = 3: e.g. T1 = (1); T2 = (2)--(2); T3 = (2...
Description There are an infinite number of ASCII strings. Write a program that will output every possible ASCII string exactly once. The ordering does not matter, but you must be able to show that for any possible ASCII string s, there exists an integer n such that s is the nth string in the output. This restriction m...
We've had a few challenges for base conversion, but all of them seem to apply to integer values. Let's do it with real numbers! The challenge Inputs: A real positive number x, expressed in base 10. This can be taken as a double-precision float or as a string. To avoid precision issues, the number can be assumed to be ...
Given a non-empty string consisting of only lower and upper case alphabetical characters and spaces ([a-zA-Z ]), reduce it to a snippet of the alphabet, starting with the first character. To reduce a string, begin with the first alphabetical character, then remove every character after it that is not the next letter of...
Make a program/function which takes in an integer from 0 to 999999999999 (inclusive) as input and returns how many syllables it has when spoken in English. Make your code short. Specification A billion is a thousand million, a trillion is a million million, etc. A million has three syllables -- it's mill-ee-on, as opp...
You might know Alan Walker from his ever popular song Faded. Now his "followers" are called Walkers and they have a logo, here is a simplified version: \\ \\ //\\ \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ //...
There is a game called Get Home that is played on the a chess board. In this game there is a single piece that is moved by both players in turns. There are some rules to how the piece can be moved. On a turn a player must make one of the following moves for positive n. n spaces up n spaces to the left n spaces up a...
Given a matrix consisting of positive integers, output the path with the lowest sum when traversing from the upper left element to the bottom right. You may move vertically, horizontally and diagonally. Note that it's possible to move both up/down, right/left and diagonally to all sides. Example: 1* 9 7 3 10...
An Octothorpe, (also called number sign, hash or hashtag, or pound sign) is the following ASCII character: # Isn't that a fun shape? Lets make bigger versions of it! So here is your challenge: Given a positive integer N, output an ASCII hashtag of size N. For example, an ASCII hashtag of size 1 looks like this: # #...
I ran into this problem while working on another challenge I'm making for this site. In that challenge I utilize "Mario Kart 8 Scoring". The amount of points the player in kth place gets is represented by this 1-indexed array: [15,12,10,9,8,7,6,5,4,3,2,1]. So 1st place gets 15 points, 2nd place gets 12 points, etc. It...
I'm surprised this hasn't come up in a challenge yet. Output the IP address of the machine you're running on. You are required to output both the local and external IP addresses. Local IP address, ie along the default format of 192.168.x.x Public IP address can be verified by using google https://www.google.co.uk/searc...
Input: We take two inputs: An input b with two distinct values: Left and Right.† And a positive integer n. Output: Based on the Left/Right input, we output either of the following two sequences in the range of 1-n (in the sequences below the first 125 items are displayed): Left: 1, 6, 7, 56, 57, 62, 63, 960, 961, 96...
Codegolf the hamming code (with distance equals 3)! The sequence looks like this: 0, 7, 25, 30, 42, 45, 51, 52, 75, 76, 82, 85, 97, 102, 120, 127, 385, 390, 408, 415, 427, 428, 434, 437, 458, 461, 467, 468, 480, 487, 505, 510, 642, 645, 667, 668, 680... Task Given n output the first n items in OEIS sequence A075926. Y...
Given two strings, output a third string that is not equal to either of the two inputs, but has the same length (in characters) as either of the inputs. There is guaranteed to be at least one valid output. Test Cases Test cases are quoted to show they are strings. Outputs are one of many possible. input, input -> outpu...
Inspired by this post. For those marking this question as a duplicate I urge you to actually read the question to see that mine is a modification of the one linked. The one linked does not ask for an input and is to just print the alphabet diagonally. The Challenge Given an input between 1-26 inclusively, print the alp...
Manually summing a Cubically cube's faces is tedious and time-consuming, sorta like writing code in Cubically itself. In Most efficient cubifier, I asked you to translate ASCII to Cubically source. One of the answers there uses a cube initialization sequence and then modifies the resulting cube based on the sums of the...
Given a prime P greater than 10, your program or function must figure out its divisibility rule x, defined as the integer with smallest absolute value which yields a multiple of the original prime when multiplied by the last digit of the prime and added to the rest of the original prime. Example Given an input 31, the ...
This is a simple challenge which hopefully may lead to some creative answers. Quoting Wikipedia: "Dual-tone multi-frequency signaling (DTMF) is an in-band telecommunication signaling system using the voice-frequency band over telephone lines between telephone equipment and other communications devices and switching cen...
When I was younger, I had a big map of the US tacked up on my wall across from my bed. When I was bored, I would stare at that map and think about stuff. Stuff like the four-color-theorem, or which state bordered the most other states. To save younger me some brainpower in counting, you are going to invent a time machi...
The challenge Given positive integer input n (n>1), calculate the array of unique factorizations of n, not including 1. Order does not matter. Test cases 2 => [[2]] 3 => [[3]] 4 => [[4],[2,2]] 5 => [[5]] 6 => [[6],[2,3]] 7 => [[7]] 8 => [[8],[2,2,2],[2,4]] 9 => [[9],[3,3]] 10 => [[10],[2,5]] 11 => [[11]] 12 => [[12],[3...
Squares looks symmetric, and so are the required codes. Objective: Write a program whose source code is a solid square (N lines with N printable, non-whitespace characters each line) and prints a square of equal size. A program (or output) with inconsistent width and height is invalid. (e.g. 6x5) Example (HQ9+) QAA AAA...
You are given 6 numbers: 5 digits [0-9] and a target number. Your goal is to intersperse operators between the digits to get as close as you can to the target. You have to use each digit exactly once, and can use the following operators as many times as you want: + - * / () ^ sqrt sin cos tan. For example, if I'm give...
Given a square string, produce all the output for the string at every stage of unfurling. The string must unfurl in a clockwise direction one quarter turn at a time. Examples Input: A Output: A Note: I'll also accept the input duplicated for this particular test case only if this helps reduce your byte count. Input: ...
It is fairly simple to, given a number n, create a range from 0 to n-1. In fact, many languages provide this operation as a builtin. The following CJam program reads an integer, and then prints out such a range (Try it online!): ri, Notice that it prints out numbers without a separator. The Challenge Your task is to r...
Given an integer n as input, return a list containing n, repeated n times. For example, the program would take 5 and turn it into [5,5,5,5,5]. The elements need to be integers, not strings. No built-in functions that accomplish the task are allowed. This is code-golf, so standard rules apply.
"First they came..." is a poem by Martin Niemöller: First they came for the Socialists, and I did not speak out- Because I was not a Socialist. Then they came for the Trade Unionists, and I did not speak out- Because I was not a Trade Unionist. Then they came for the Jews, and I did not speak out- Because I was not a...
Here is the sequence I'm talking about: {1, 4, 5, 9, 10, 11, 16, 17, 18, 19, 25, 26, 27...} Starting from 1, keep 1, drop the next 2, keep the next 2, drop 3, keep 3 and so on. Yes, it's on OEIS (A064801), too! The Challenge Given an integer n>0, find the nth term of the above sequence Test Cases Input -> Output ...
This challenge is a simple ASCII-art challenge inspired by the solar eclipse that happened on August 21, 2017. Given an input 0 <= n <= 4, output the corresponding stage of the eclipse described below: n=0: ***** ** ** * * * * ** ** ******* n=1: ***** ** ***** * ******* * *****...
Given an array of non-negative integers, your task is to only keep certain elements of it, as described below. Let's say the array is [1, 3, 2, 4, 11, 5, 2, 0, 13, 10, 1]. First get the first element of the array, n. Keep the first n elements and discard the next one (discard the n+1th). The new array is [1, 2, 4, 11...
Given a nonnegative integer n, your solution must output a program in your chosen language whose output has n times as many bytes as the outputted program. Rules You must specify the language and encoding of the programs your solution outputs, and you may not choose different languages or encodings for different input...
Note: This challenge has nothing to do with actual assembly language. As the head of Code-Golf Factory Inc., you must create an assembly line to generate a specific piece of code. Today, the foreman has asked you to produce quines. Specification: In this challenge, the goal is to write a quine such that a proper subse...
The game of Ghost is played between two players who alternate saying a letter on each turn. At each point, the letters so far must start some valid English word. The loser is the player to complete a full word first. So, for example, if the letters so far are E-A-G-L, then the only valid next letter to say is "E" an...
Since 2009, Android's version code names have been confectionery-themed. Android 1.5 is Cupcake, Android 1.6 is Donut, Android 2.0 is Eclair, etc.. In fact, the version names are alphabetical! C -> Cupcake D -> Donut E -> Eclair F -> Froyo G -> Gingerbread H -> Honeycomb I -> Ice Cream Sandwich J -> Jellybean K -> Kitk...
Write a proper quine containing at least one newline/linefeed whose every unfurling is either itself a proper quine or outputs the original quine. Your answer can mix and match outputting itself and outputting the original quine. Unfurlings Unfurlings consist of: Appending spaces to make the input a rectangle. Taking ...
Let's count... Count up to 2 and back to 1 Count up to 4 and back to 1 Count up to 6 and back to 1 ... ok you got it... put all these together and you'll get the following sequence {1,2,1,2,3,4,3,2,1,2,3,4,5,6,5,4,3,2,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,2,3...} Challenge Given an integer n>0for 1-indexed (or n>=0 for 0-i...
This challenge is based on a drinking game. I advise against alcohol consumption while programming. In this game, the players count up in turns: the first player says 1, the second says 2 and so on. Here's the twist however: each number that is divisible by 7 or has a 7 in its digits (in base 10) is replaced by another...
Given a letter of the English alphabet, your task is to build a semi-diagonal alphabet to the input. How to build a Semi-Diagonal alphabet? Brief Description: First, you take the position of the letter in the alphabet, P (P is 1-indexed here). Then, you print each letter until the input (inclusive) on a line, precede...
Take three inputs, a string of text, T; a string of characters to replace, F; and a string of characters to replace them with, R. For each substring of T with the same (case insensitive) characters as F, replace them with the characters in R. However, keep the same case as the original text. If there are more character...
Input no input for this challenge The Challenge Write a code that outputs: The first 10 prime numbers whose sum of their digits equal the number of bytes of your code Examples Let's say your code is Co&%423@k"oo" which is 13 bytes your code must output [67, 139, 157, 193, 229, 283, 337, 373, 409, 463] those are the fi...
COBOL is a very old language, at the time of writing it is 58 years old. It is so old, in fact, that it has a very interesting quirk: the first six characters of each line are comments. Why is this, you ask? Well, those 6 characters were intended to be used as line numbers, back in the day where programs weren't comple...