instruction
stringlengths
34
53.1k
A CSS selector is made up of five elements: The element type (tag name) The id of the element The classes of the element The attributes of the element Operators to chain these element selectors This challenge will only involve the first four--also taking into account operators would make more than one element be gen...
Given one of the 50 U.S. state names on the left as input, output its two-letter postal code as shown to the right: Alabama AL Alaska AK Arizona AZ Arkansas AR California CA Colorado CO Connecticut CT Delaware DE Florida FL Georgia GA Hawaii ...
Introduction A while ago a lost SO user posted a question here and its now been deleted but I think it would make a good challenge so here it goes... Challenge Write a full program or function that takes two strings and checks whether any permutation of the first string is a sub-string of the second string. Input Two s...
You are to golf a program that will take a filename as input and you must output what color the file is. The file will have any one of these extensions but your program only needs to support one. Please say which one in your answer. .jpg .png .svg .gif .bmp And now to the classic layout. Input A filename with one of ...
Introduction Ever heard of Remind? No? Neither did I until about 2 years ago. Basic premise of it is for teachers to send out reminders and communicate with their students. Pretty neat, right? It even allows you send emotes and react to messages! Which I do on a daily basis. But, one thing about Remind is that the teac...
In the musical rendition of Les Miserables, a song appears called "Red and Black." Here is part of that song: Red - the blood of angry men! Black - the dark of ages past! Red - a world about to dawn! Black - the night that ends at last! Source. Your task is to turn input into a resounding "Red and Black" anthem. Inpu...
Given an unordered collection of positive integers by any reasonable input method, return all of the sub-collections that have an odd number of odd elements (i.e. have an odd total). This is code-golf so you should aim to minimize the byte count of your program. Since some languages only have ordered collections (lists...
I see from this SMBC comic that Zach Weinersmith is offering a generous 14 points to anybody who can find a way of generating the following series: 0, 1, 4, -13, -133, 52, 53, -155 Now, we all know that there are infinite ways of generating any given numeric series, so Zach is clearly just giving those points away. Bu...
In probability theory, the normal (or Gaussian) distribution is a very common continuous probability distribution. Normal distributions are important in statistics and are often used in the natural and social sciences to represent real-valued random variables whose distributions are not known. The challenge Your chal...
Eyeballing the binary values printed as ovals and sticks is not so easy... To help with that, you must write a function (or a program) that prints numbers in custom binary representation. So I want to take a number, say 3 (00000011) and output the bits in user-defined format, for example with space separated pairs: 0...
Write a program that outputs all possible Tic Tac Toe positions including the corresponding game outcome. Avoid duplicate output of equal positions. The program takes no input. Rules: A position output must consist of 9 characters, using X and O for the taken squares, and an arbitrary non-whitespace character for the ...
An addition chain is a sequence of integers starting with 1, where every integer other than the initial 1 is a sum of two previous integers. For instance, here's an addition chain: [1, 2, 3, 4, 7, 8, 16, 32, 39, 71] Here are the sums that make it an addition chain: 1 + 1 = 2 1 + 2 = 3 1 + 3 = 4 3 + 4 = 7 1 + 7 = 8 8 +...
Given a string, reverse it interleavingly. Here's how to do it for abcdefghi and abcdefghij, 0-indexed: Separate the chars at even indices from the chars at odd indices:a c e g i b d f h a c e g i b d f h j Reverse the chars at odd indices:a c e g i h f d b a c e g i j h f d b Interleave into one string again:ahcf...
Your task is to write a function which outputs a ukulele chord chart in the following format for a given chord symbol. For instance, for input "G7", it must output: G C E A --------- | | |#| | --------- | |#| |#| --------- | | | | | --------- | | | | | --------- | | | | | --------- It must support all chords of thes...
We've all seen the signs on motels telling us if there's a vacancy or not: Typically, these will permanently have the letters of VACANCY lit up, and have the letters of NO lit up if there isn't any room in the motel. The challenge The average motel in the U.S. has 200 rooms. You will write a program/function that take...
Your task is simple: Write a program that can be run in two languages. It should be a normal quine (prints its own source code) in language 1, and should be an error quine (generates an error message identical to its own source code) in language 2. This is code-golf, so the shortest valid submission (in bytes) wins. Ru...
Definition In Mathematics, Harmonic Sequence refers to a sequence where $$a_n = \frac 1 n$$ i.e. the \$n_{th}\$ term of the sequence equals the reciprocal of \$n\$. Introduction In this challenge, given a positive integer \$n\$ as input, output the Partial Sum of first \$n\$ terms of the Harmonic Sequence. Input Yo...
'---------' '-'.repeat(9) // longer! '------------' (x='----')+x+x '-'.repeat(12) // same length Is there any cleverer way of generating strings of 12 repeated characters in JavaScript?
I got the spontaneous idea of making a series of challenges of users that have helped and continue to help the PPCG community be an enjoyable place for everyone, or maybe just specifically for me. :P If you convert Dennis's name to an array of 1s and 0s where each consonant is 1 and each vowel is 0, the array is [1, 0,...
Given a stream of bits, output the shortest possible Hamming code that encodes it. The steps to generate the Hamming code are as follows, although your submission does not necessarily have to conform to them as long as it produces identical output. The input 110100101 will be used as an example. Pad the input with tra...
Background As noted in the PPCG challenge Compress a maximal discrepancy-2 sequence – which inspired this challenge – the authors of the paper Computer-Aided Proof of Erdős Discrepancy Properties found a maximal discrepancy-2 sequence, namely -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, ...
A cyclic number is a number of "n" digits that when multiplied by 1, 2, 3,...n, results in the same digits but in a different order. For example, the number 142,857 is a cyclic number since 142,857 x 2 = 285,714, 142,857 x 3 = 428,571, 142,857 x 4 = 571,428, and so on. Given an integer input, determine if it is a cycli...
Also known as the [analog root] (Opposite of the digital root!) ;) The digital root of a number is the continuous summation of its digits until it is a single digit, for example, the digital root of 89456 is calculated like this: 8 + 9 + 4 + 5 + 6 = 32 3 + 2 = 5 The digital root of 89456 is 5. Given a digit as input vi...
Kids who are learning how to count often know runs of numbers, but can't seem to put those runs together properly. For example, they might say: 1,2,3,4,7,8,9,10 Sometimes kids will realize that they skipped some numbers, and go back: 1,2,3,4,7,8,5,6,7,8,9,10 This is clearly the superior pattern. We need to identify ...
This is a throwback challenge. You will choose an old computer system and an old language created for that system. The challenge Pick an old computer system that was made before the year 2000. In a programming language that was created to run on that system, print said system's logo. Example systems, their languages, a...
Challenge Your program needs to take an input of a string, where the string has only letters, no special characters, no numbers, and no accents (they look all weird). Then, your program should output a superscript version. Example Input: hello world Output: ʰᵉᶫᶫᵒ ʷᵒʳᶫᵈ Test Cases hello - ʰᵉᶫᶫᵒ code - ᶜᵒᵈᵉ golf - ᵍᵒᶫᶠ a...
The challenge You're given: a non-empty, unsorted list h of positive integers (the haystack) a positive integer n (the needle) Your task is to return the list of all unique decimal concatenations of permutations of h whose binary representation contains the binary representation of n. Examples h = [ 1, 2, 3 ] n = 65...
The purpose of the challenge is to approximately plot the attractor of the logistic map as a function of its parameter r (also called bifurcation diagram), or a subregion of it. The appearance of the graph can be seen in the following image from Wikipedia: Background The logistic map is a mathematical function that ta...
Introduction I don't particularly know where the fizz buzz trend came from. It might just be a meme or something, but it is somewhat popular. Challenge Your job today is to convert Fizz Buzz into binary (0, 1) respectively, and convert that binary to text. Pretty standard stuff. How does that work? FizzBuzzBuzzFizzBuzz...
While writing my essay for Shakespeare, I realized that I needed to shorten my quote references to more manageable lengths. I had previously been writing this: (Act 1, Scene 2, Lines 345-346) But I've now been told to write them like this: (I.ii.345-6) Clearly, I need some golfed code to golf my Shakespeare quote ref...
Buzzby Berkeley Robot Hokey Pokey Task Write a program or function to produce an ASCII art animation depicting a line of robots dancing to the lyrics of the Hokey Pokey (or Cokey, if you prefer) in the style of a Busby Berkeley number! Example Output Input Accepts three arguments (assumed to be valid): N = number of r...
Hex triplets such as #ffffff (white) or #3764ef (blueish) are often used to denote RGB colors. They consist of # followed by six hexadecimal digits (0-f), or sometimes three digits where the real color is obtained by doubling each digit. For example, #fff is #ffffff and #1a8 is #11aa88. Sadly, that three digit shorthan...
Before I begin, this challenge was not mine originally Credits to The University of Waterloo. This came from the Canadian Computing Competition 2016, Senior Problem 5. Here is a clickable link to the contest PDF: http://cemc.uwaterloo.ca/contests/computing/2016/stage%201/seniorEn.pdf Here is a link to the site: http://...
This is a challenge about the the tricks and optimizations that can be used when golfing in CJam. CJam golfers may recognize many of the tricks involved. However, unfamiliar approaches and constructs may be involved, so take a look at the CJam tips as well as the CJam instruction reference if you get stuck. Solutions m...
Sometimes, while golfing, one needs to represent large number(s) in their code. Writing them as is can significantly increase the byte-count. What general1 tips do you have for representing long numbers concisely in code? Please post one tip per answer. 1With general, I mean tips that can be applied to more than a sin...
My previous challenge, Print invisible text was quite popular, likely due to how trivial it is. However those more observant of you may have noticed that you're not really printing invisible text, because it's impossible to read what was inputted given only the output. So I figured how about a real invisible text chall...
A simple one: Take a positive integer n less than 1000, and output the integers from 1 to n interleaved with the integers from n to 1. You must concatenate the numbers so that they appear without any delimiters between them. Test cases: n = 1 11 n = 4 14233241 n = 26 1262253244235226217208199181017111612151314141315...
Steven Gerrard was born on 30th of May 1980. He is now 37 years old. Happy birthday, Steven! To celebrate his anniversary, your goal is to remind him the number of goals he has scored each year in premiere league for Liverpool. He doesn't want to remember the goals scored before or after playing for Liverpool. It is l...
Challenge Hi, given a string as input, remove any salutations found at the start of the string. The program which performs the most correct substitutions in under 50 bytes wins. Salutations Hey, a salutation is defined as one of the following words: hi hey hello dear greetings hai guys hii howdy hiya hay heya hola hih...
Goal: This goal to take a string and output how many contributions should be made on which days in order to display a message. Specification Input Support letters plus space (i.e. [A-Za-z ] ) Space is a blank 3X7 The letters are defined in this 5x7 DOT Matrix font provided below The size of each letter is the minim...
For Gregorian calendars, the date format varies from a country to another. There are three main formats recognized: YY-MM-DD (big-endian) DD-MM-YY (little-endian) MM-DD-YY (middle-endian) Your task is to write a program which, given an input string representing a date, output all the possible date formats by which th...
Challenge Given a non-empty string S of length L consisting entirely of printable ASCII chars, output another string of length L that consists entirely of printable ASCII chars, but is not equal to S. For the purposes of this challenge, a printable ASCII char is one between U+0020 and U+007E, inclusive; that is, from ...
Overview In this challenge, you will be given two numbers which are both a small offset larger than a multiple of a medium-size number. You must output a medium-sized number that is almost a divisor of both of the numbers, except for a small offset. The size of the numbers involved will be parameterized by a difficulty...
The Straddling Checkerboard is a method for converting letters to numbers and was part of a pencil an paper cipher known as VIC To convert letters to numbers first you have to make a checkboard like this: 0 1 2 3 4 5 6 7 8 9 --------------------------------------- E T A O N ...
You must fill an array with every number from 0-n inclusive. No numbers should repeat. However they must be in a random order. Rules All standard code-golf rules and standard loopholes are banned The array must be generated pseudo-randomly. Every possible permutation should have a equal probability. Input n in any way ...
Given a non-negative integer N, output the smallest odd positive integer that is a strong pseudoprime to all of the first N prime bases. This is OEIS sequence A014233. Test Cases (one-indexed) 1 2047 2 1373653 3 25326001 4 3215031751 5 2152302898747 6 3474749660383 7 3415500717...
Everyone knows log scales are for quitters. Therefore, you must write a program or function that de-quitifies a bar graph with a log scale given a base. The bar graph input is taken as a single string which is a list of bars, where each bar of the log scale bar graph is separated by the printable (or whitespace) delimi...
Challenge Write two programs that: run in two different programming languages. These may not be two versions of one language. when one program is run, it outputs the second program, and vice versa. The two programs must be different (no polyglots). Here's the catch though: The programs must be radiation hardened....
In this challenge, you must take a string matching the regex ^[a-zA-Z]+$ or whatever is reasonable (you don't have to consider uppercase or lowercase letters if you want) (you may assume the string is long enough, and has the right structure for all the operations), and output another string, produced similarly to word...
Simple challenge inspired by the popularity of my previous print invisible text and print real invisible text challenges, and the same length different string challenge. Given a string consisting of only printable characters (0x20 to 0x7E), print every printable character not present in the string. Input A string, or a...
This year my age is a prime number, and so is this year. This conjunction will repeat in 10 years and again in 12. If I live to 100, I will lived exactly 11 years in which my age and the year are both prime. My condolences to those of you born in odd-numbered years, who will experience this phenomenon at most once if a...
In English, nouns can take on two different forms depending on whether they are singular (one) or plural (anything else). For example, we would say "1 dog" but "2 dogs", "0 dogs", "57 dogs" and so forth. In Russian, there are three categories. Instead of "1 dog, 2 dogs, 5 dogs", in Russian it would be "1 собака, 2 соба...
this challenge was based on a sandboxed post by @dmckee Old fashioned cell phones were and are used heavily as texting platforms, unfortunately the keyboard has only 12 + a few buttons, and is therefor ill-suited to naive text entry. Common solutions make use of the traditional telephone coding (generally with a modest...
You may have heard of the "Hacker Logo", also called the "Hacker Emblem". It looks like this: This is a pattern from a mathematical simulation called the Game of Life. The glider is the simplest Life pattern that moves, and the most instantly recognizable of all Life patterns. The challenge The challenge is pretty sim...
This: is a Glider. In Conway's Game of Life, the glider is a famous pattern that rapidly traverses across the board. For today's challenge, we are going to draw an ASCII art Game of Life Board, and place a glider on it. The board we are starting with is this: |_|_|_|_|_|_|_|_|_|_| |_|_|_|_|_|_|_|_|_|_| |_|_|_|_|_|_|_|...
Challenge Input two integers. Integer I/O must be decimal. If the integers are equal, output a truthy value. Otherwise, output a falsy value. Clarifications You will never receive non-integer inputs. You will never receive an input that is outside the bounds [-2³¹, 2³¹). Rules Standard loopholes are disallowed....
Inspired by Does the start equal the end Given a string s and an integer n, output a truthy/falsey as to whether the nth char in s equals the nth from the end char in s. Input A non-empty string and an integer. You can use 0-based indexing or 1-based indexing. The integer is guaranteed to be valid based on the string. ...
Muriel is a language where the only way to loop is to create a quine and execute it. Your job is to create your own language with this property and an implementation of it in a pre-existing language. We will define a Muriel-like language like as follows: It has a built-in command for executing code in its own language...
Overview Given a 2 dimensional array of values with a filled in rectangle, find the position and size of the rectangle. Do it in the fewest array accesses as possible. Requirements The x and y values in the output must be 0-indexed. The top left corner is (0, 0). The output should be the 4-tuple (x, y, width, height)....
Dr. Trump is the head psychiatrist at a mental hospital, which is populated by murdering psychopaths. If 2 psychopaths are left together, they will end up brutally injuring or even killing each other, so Dr. Trump needs to build walls to separate these psychopaths, but owing to the limited amount of funds he has left, ...
Your task is simple: tell me who wins the battle of the letters. The troops There are three different "troops" in this battle, summarized by this table. name | health | damage A 25 25 B 100 5 C 10 50 You may use any three unique characters to represent the the troops, but m...
Challenge Given an input x, create a directory (AKA folder) in the file system with the name x. Languages that are not able to create file system directories are excluded from this challenge. The directory may be created anywhere, as long as the location is writable to the user running the program. Assume that the prog...
What tips do people have for golfing in TeX/LaTeX? Please post one tip per answer, each at least somewhat specific to TeX/LaTeX. Context: I noticed this answer and that there is no tips question for TeX/LaTeX, so I'm creating this one. There's some overlap with the narrower question tips for golfing in TikZ (as TikZ i...
Based on this challenge, you must determine if a string is covfefey, that is, could it have been produced as output from a covfefifier? The string will be composed of only alphabet chars (^[a-z]\*$, ^[A-Z]\*$ are possible schemes for input. change the regexs appropriately if using caps) To do this, there are a few chec...
Writing quines is hard. Why not have your computer write them for you! Your program will take as input an interpreter (in a Turing complete language of your choosing) for a language X, and you will output a quine in language X. Notes: Language X is guaranteed to be Turing complete (you do not need to check this (it wo...
You are given a very special gun with a full magazine. Let n be the initial number of bullets in the magazine and i the number of bullets left. That gun is really unreliable, hence each time you shoot, you have a i/n chance to successfully shoot. The fewer bullets you have left, the more tries it requires to shoot. The...
Steve Ballmer is the ex-CEO of Microsoft, and in a recent article, claimed that he "still does not know what he did wrong with mobile". As CodeProject's newsletter pointed out, "That article's title could be ended at so many spots and still be accurate". Given no input, output the following: Steve Ballmer still does no...
The WannaCrypt ransomware has struck and it is attacking networks right, left and center. A network is defined by an m*n binary matrix (a), which has a a[i][j] = 1 if a computer is infected and a[i][j] = 0 if it is not. At the end of each hour, all computers that are a neighbour (which shares a side or a corner with) ...
DONT EVALUATE YET, ALMOST FINISHED, NEED A CLEAR WINNING CRITERION Make me rich in minecraft Minecraft is a 3D game made of blocks that you can destroy and place. There are some interesting farms you can build to provide you with game resources. In this problem, we will only have a look at pumpkin and melons farms. Her...
Challenge Given a list of keys and values, and a target n, return all sets of keys where the sum of their values equals or exceeds n. Input Input will be like this: [["Part 1", 20], ["Part 2", 15], ["Part 3", 14.75], ["Part 4", 3]], 30 Input consists of a list with keys (which can be any kind of string) and values (wh...
I've always liked screens full of randomly colored pixels. They're interesting to look at and the programs that draw them are fun to watch. The challenge Fill your screen, or a graphical window, with colored pixels. The rules Your program must have an even chance of picking all colors (i.e in the range #000000 to #FFF...
A narcissist program is a program that only accepts its own source code. A bigotous program is a program that only accepts the source code of programs semantically equivalent to itself. A gang member is somewhere in between. In particular, we will define a gang as set of programs G, which may or may not be in the same ...
Background The Hamming weight of an integer is the number of ones in its binary representation. For this challenge, integers are represented with 32 bits, and they are unsigned. Challenge Given an integer between 0 and 2^32-1 (non-inclusive), output a different integer within the same range, and also with the same Hamm...
The naming conventions for games in the Super Mario series is very strange, and don't match up between regions. | Japanese Name | American Name | |---------------------|------------------------------------| | Super Mario Bros. | Super Mario Bros. | | Super Mario Bros. 2 | S...
The Challenge Generate 1 sec of an 8 bit tone sampled at 256 samples per second. The tone will be made up of a number of sine waves. The frequency of each sine wave will be determined from the input data. These are deep tones, too low for a human to perceive, but I've chosen 8 bit numbers here since it's code-golf. The...
Recently, an electrical engineer studying traffic light timings was fined $500 by the state of Oregon for referring to himself as an engineer. Given a 2 letter string as input, representing a US state, output: I am not an engineer if the state is Oregon (OR) I am an engineer if the state is any other US state What is ...
Related Task Your task is to calculate the new Elo rating (FIDE rating system) for a player after winning, losing or drawing a game of chess. To calculate the Elo rating two formulas are needed: R' = R0 + K*(S - E) E = 1 / (1 + 10 ^ ((R1 - R0) / 400)) where: R' is the new rating for player0, R0 is the current rating ...
Given an ASCII representation of a piece of string, determine its length. Input An multi-line ASCII rendering of a piece of string, which runs from top to bottom, with one 'node' (corner) on each line of input. The delimiter may be assumed to be CR, LF, CRLF, or LFCR. Input may be accepted from STDIN, Command Line Argu...
Concept Remembering numbers can be difficult. Remembering a word may be easier. In order to memorize big numbers, I created a way to pronounce them in a leetspeak-like way. Rules Each digit is first replaced by its corresponding letter: 0 => O 1 => I 2 => R 3 => E 4 => A 5 => S 6 => G 7 => T 8 => B 9 => P After the re...
Lets play golf while we golf. Problem: Distance to the hole initially is 700m Each hit to the ball will make it advance to the hole 250-350m, this should be random. Each hit has a 5% probabilities of going into water, this will make the quantity of hits increase by 1 as a penalty. When ball is under 250m it will adva...
Let's imagine we have a finite set of positive integers. This set can be represented as a line of dots where each integer present in the set is filled in like a scantron or punch card. For example the set {1,3,4,6} could be represented as: *.**.* * represents a member of our set and . represents an integer that is n...
When writing code-golf programs, I usually end up using some numeric constants. I always put them in decimal because that's how I think, but I just realized that my language supports other number formats that might let me shorten my code slightly. Challenge Given a non-negative integer less than 2^53-1, decide whether ...
Task You must write a program in Language A that will output the source code for a program in Language B which will then output the source code for a program in Language C and so on and so forth. The final program must output the x root y where x and y are the inputs e.g. in Python: print(int(input()) ** (1/int(input()...
Your task is to take an encrypted string as input, and output the string decrypted, to reveal its hidden message. The strings, both the input and output, will contain characters from this list of 64 ASCII-characters (note the leading space): !"#$%&'()*+,-./0123456789:;=?@[\]^_abcdefghijklmnopqrstuvwxyz|~ These charac...
Are there any functional programming languages designed for code golfing? I know that golfscript and CJam fulfill the same category for stack based, but I couldn't find a functional code golfing language.
I love math. But I can't find a single calculator that can multiply correctly. They seem to get everything right except 6*9 (It's the question to life, the universe, and everything! How could they get that wrong?!). So I want you all to write a function for me that can multiply 2 numbers correctly (and 6*9 equals 42 in...
Recently, someone proposed more stringent limits for Python's default line length: Clearly, no program should ever use more than 80 characters per line, for a whole host of reasons. First and foremost, for readability and maintainability, it is important to have a solid standard, so we can adjust the width of our text...
The Challenge: Draw a rectangle of ASCII boxes: [] The Rules: Takes a width and a height input You can assume both of these are numbers Must produce a string with newline characters, \n Examples: 2, 2: [][] [][] 2, 3: [][] [][] [][] Fewest Bytes wins.
Be sure to see the other challenge, Reverse ASCII character map! The ASCII charset (American Standard Code for Information Interchange) is the most widely-used character encoding standard. ASCII codes represent text in computers, telecommunications equipment, and other devices. Challenge Your challenge is to print a ...
Challenge: Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The first program must output the integer 1, the second one 2 and so on. You can not reuse any characters between the programs. So, if the first program is: x==x, then you may not u...
Many people know what a truth machine in programming is. But is time we kick things up a notch. Introducing, the extended truth machine! An extended truth machine takes two things as input, a integer n and a nonempty string s. It outputs s n times with optional trailing whitespace. However, if n is equal to 0, you must...
The reverse of an n-bit number is just its n binary digits in reverse order: 001010010 → 010010100 Given a number n, generate all n-bit integers ([0, 2n-1]) in an arbitrary order, with only one restriction: there must be a splitting point such that the reverse of an integer is on the opposite side of the splitting p...
Introduction Given a String containing an arithmetic expression, your task is to output a truthy or falsey value based on whether it contains unmatched parentheses. Input Your program should take in a String containing an arithmetic expression. It may take input in any way except assuming it to be present in a pre-def...
Challenge Given an integer, n, as input where 0 <= n <= 2^10, output the nth even perfect number. Perfect Numbers A perfect number is a number, x where the sum of its factors (excluding itself) equals x. For example, 6: 6: 1, 2, 3, 6 And, of course, 1 + 2 + 3 = 6, so 6 is perfect. If a perfect number, x, is even, x mo...
Given two numbers n and m, evaluate the infinite power tower: n^(n+1)^(n+2)^(n+3)^(n+4)^... mod m Keep in mind that ^ is right-associative. So 2^3^4 = 2^(3^4). Now how can you possibly assign a value to an infinite sequence of right-associative operators? Define f(n,m,i) as the power tower containing the first i ter...
Challenge An ascii string is made 'dank' when exactly one space is inserted between any two consecutive letters and all capital letters are replaced with lowercase ones. In this challenge I would like you to write a program that takes a string (not necessarily 'dank') as input and outputs a 'dank' version of that strin...
Inspired by a restriction on What do you get when you multiply 6 by 9? (42) By order of the President, we are no longer permitted to use confusing fake numbers (i.e. numbers other than integers from 0 to 99 inclusive), and are instead to use only real numbers, that is, those that are not fake. Unfortunately, most maths...
Consider a binary string S of length n. Indexing from 1, we can compute the Hamming distances between S[1..i+1] and S[n-i..n] for all i in order from 0 to n-1. The Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. For example, S = 01010...
Abbreviate that US state! was fun, but we learnt that efficiently abbreviating US state names is hard with the current system. Let's come up with an alternative state code scheme for efficient golfing. Your task: Write a function (or program) which, given a valid US state name (only the 50 normal states required), ret...
There are many magic squares, but there is just one non-trivial magic hexagon, as Dr. James Grime explained, which is the following: 18 17 3 11 1 7 19 9 6 5 2 16 14 8 4 12 15 13 10 As it is done in Hexagony this is easiest written as just one line, by just reading it row by row: 18 17 3 11 1 7 19 9 6 5 2...