instruction
stringlengths
34
53.1k
Your goal in this code golf is to compile all the Stack Exchange sites' favicons. Getting the Domains The domains you will be using will be: *.stackexchange.com stackexchange.com stackoverflow.com superuser.com serverfault.com askubuntu.com mathoverflow.net stackapps.com stackauth.com Everything but stackexchange.co...
Write a program or function that outputs an L if run on a little endian architecture or a B if run on a big endian architecture. Lower case output l or b is also acceptable. There is no input. Scoring is code golf, so the code with the fewest bytes wins. Edit: As per the comments below, I am clarifying that the entry m...
Prime Wednesdays Your task is to count the number of Wednesdays that fall on a prime day of the month in a particular year. For instance, 7-13-16 is a prime Wednesday. For consistency use the Gregorian calendar for all dates. Input The input to your program/function will be a year (eg 2016) and is flexible. The year wi...
CAPTCHA Modified by Evil Mathematician I accidentally incurred the wrath of an eccentric passive-aggressive mathematician. As part of his demented idea of payback, he modified the CAPTCHA system on my favorite website. Up until now, it would just ask a moderately challenging math question, like 3+2^4, and I would simpl...
Number to String Instructions Convert a signed 32-bit integer to a string (base-10 preferably) without any string formatting calls (or built in type coercion that will directly convert a number to a string). Negative numbers must include leading -. Score Calculation Shortest byte length; Tie breaker by efficiency (exec...
Everyone knows how to add numbers by hand, right?––Well, I hope so, but for anyone who needs a quick reminder: To add 17282 and 1342, you proceed as follows: place the larger (value wise, not number of digits) number above the smaller number and match up the digits 17282 1342 draw the plus sign (+) to the left of th...
Pokerface Introduction Leo enjoys playing poker, but his job at Tech Inc. is too demanding for him to learn how to play well. Leo, being a computer scientist, is not discouraged. He decides to take more time than it would have taken to just learn poker, and use it to write a poker bot to help him play better. But now L...
A collection of positive integers d_1 d_2 ... d_k is a factorisation of a positive integer n if d_1 * d_2 * ... * d_k = n Each positive integer has a unique prime factorisation, but in general they also have factorisations in which some of the terms are composite. E.g. 12 = 6 * 2 = 4 * 3 = 3 * 2 * 2 Write a program, ...
The coin change problem is very well documented. Given an infinite supply of coins of denominations x_1 to x_m you need to find the number of combinations which add up to y. For example, given x = {1,2,3} and y = 4 we have four combinations: {1,1,1,1} {1,1,2} {1,3} {2,2} Introduction There are several variations of t...
In the spirit of Patch the Image, here's a similar challenge but with text. Challenge Bit rot has afflicted your precious text! Given a paragraph composed of ASCII characters, with a rectangular hole somewhere in it, your program should try to fill in the hole with appropriate text, so that the paragraph blends as best...
An algebraic curve is a certain "1D subset" of the "2D-plane" that can be described as set of zeros {(x,y) in R^2 : f(x,y)=0 }of a polynomial f. Here we consider the 2D-plane as the real plane R^2 such that we can easily imagine what such a curve could look like, basically a thing you can draw with a pencil. Examples: ...
Definition a(1) = 1 a(2) = 1 a(n) = a(n-a(n-1)) + a(n-a(n-2)) for n > 2 where n is an integer Task Given positive integer n, generate a(n). Testcases n a(n) 1 1 2 1 3 2 4 3 5 3 6 4 7 5 8 5 9 6 10 6 11 6 12 8 13 8 14 8 15 10 16 9 17 10 18 11 19 11 20 12 Reference Obligatory OEIS A005185
Executive summary Given input representing two vectors and their respective "weights", produce output that also represents the weighted sum of those vectors. Challenge The input will consist of one or more lines of the following characters: exactly one occurrence of the digit 0, which represents the origin in a two-di...
Your goal in this code-golf is to pick a random character from a string. If a character appears X times, and there are Y characters, then the chance of that character being picked will be X/Y. Input The program takes a string as an input. Output Your program outputs a character. Examples xyz: x, y, or z xxX: x, x, or ...
Definition Fibonacci sequence F(n), on the positive integers, are defined as such: 1. F(1) = 1 2. F(2) = 1 3. F(n) = F(n-1) + F(n-2), where n is an integer and n > 2 The Fibonacci-orial of a positive integer is the product of [F(1), F(2), ..., F(n)]. Task Given positive integer n, find the Fibonacci-orial of n. Specs ...
What are Fibonacci networks? In 1202, an Italian mathematician known as Fibonacci posed the following problem: "A male and a female rabbit are born at the beginning of the year. We assume the following conditions: 1.After reaching the age of two months, each pair produces a mixed pair, (one male, one female), and then...
Definition Wolstenholme's theorem states that: where a and b are positive integers and p is prime, and the big parentheses thingy is Binomial coefficient. Task To verify that, you will be given three inputs: a, b, p, where a and b are positive integers and p is prime. Compute: where a and b are positive integers an...
The Tabula Recta (sometimes called a 'Vigenere Table'), was created by Johannes Trithemius, and has been used in several ciphers, including all variants of Bellaso's Vigenere cipher and the Trithemius cipher. It looks like this: ABCDEFGHIJKLMNOPQRSTUVWXYZ BCDEFGHIJKLMNOPQRSTUVWXYZA CDEFGHIJKLMNOPQRSTUVWXYZAB DEFGHIJKLM...
Origins tl;dw (too lazy, didn't write): thought of it right before I fell asleep Challenge Breaking a number is defined as the following steps: Take a number or a parseable data type as input in any allowed way. Duplicate the first digit (64 -> 664) Subtract 4 from the last digit (664 -> 660) If the subtraction gets...
The goal of this challenge is given a finite directed acyclic graph (DAG), determine if the graph is a transitive reduction. A brief explanation of what a DAG and transitive reductions are: A DAG is a graph with directed edges (i.e. you can only travel in one direction on that edge) such that given any starting node on...
Inspired by George Gibson's Print a Tabula Recta. You are to print/output this exact text: ABCDEFGHIJKLMNOPQRSTUVWXYZ BBCDEFGHIJKLMNOPQRSTUVWXYZ CCCDEFGHIJKLMNOPQRSTUVWXYZ DDDDEFGHIJKLMNOPQRSTUVWXYZ EEEEEFGHIJKLMNOPQRSTUVWXYZ FFFFFFGHIJKLMNOPQRSTUVWXYZ GGGGGGGHIJKLMNOPQRSTUVWXYZ HHHHHHHHIJKLMNOPQRSTUVWXYZ IIIIIIIIIJKLM...
Definition According to Wikipedia: The Cooke and Wheatstone telegraph was an early electrical telegraph system dating from the 1830s invented by English inventor William Fothergill Cooke and English scientist Charles Wheatstone. It was the first telegraph system to be put into commercial service. The receiver consiste...
I recently found out about the Fishing language, and it is now a favorite of mine. However, I'm finding it difficult to do anything cool with it, including code golf. Are there any tips for golfing with Fishing to use the least characters? And any string manipulation tricks would be cool, as I am finding that difficult...
Challenge The challenge is simple: print a snake. You will get the length of the snake as input. A snake of length 2 looks like this: ==(:)- A snake of length 7 looks like this: =======(:)- In other words, the length of a snake is how many equal signs are before the head. Usage Let's say I made a C++ implementation a...
According to Alexa rankings, the top 10 websites are: google.com youtube.com facebook.com baidu.com yahoo.com wikipedia.org amazon.com twitter.com qq.com google.co.in Being the top 10 visited websites, these are probably also the top 10 misspelled websites [Citation Needed]. Your task Your goal is to write a program o...
Definition The infinite spiral used in this question has 0 on the position (0,0), and continues like this: 16-15-14-13-12 | | 17 4--3--2 11 | | | | 18 5 0--1 10 | | | 19 6--7--8--9 | 20--21... It is to be interpreted as a Cartesian plane. For example, 1 is on the position (1,0), and 2 i...
Well, although this challenge turned out to be a huge success, it also turned out to be very trivial to solve. Therefore, for those of looking for more of a challenge, I created a sequel to this challenge in which you must now count the number of unique rectangles. Check it out! Now, for those of you looking to solve ...
Challenge Create a new file and write the string Hello World to it. Restrictions Your challenge must write to a file on disk, in the file system. The file may not be a log file generated during normal operation of the interpreter. The file must contain only the string Hello World. It is allowed to contain a trailing n...
Input: An integer. Output: First convert the integer to it's equivalent Roman Numeral. Then convert each capital letter of that Roman Numeral to their ASCII/UNICODE decimal value. And output the sum of those. Example: 1991 -> MCMXCI -> 77+67+77+88+67+73 -> 449 ^ input ^ output Roman Nu...
Definition From the description on OEIS A006345: To find a(n), consider either a 1 or a 2. For each, find the longest repeated suffix, that is, for each of a(n)=1,2, find the longest sequence s with the property that the sequence a(1),...,a(n) ends with ss. Use the digit that results in the shorter such suffix. a(1) =...
A compound word is a word that contains 2 or more words in it. We can do better than that, though. We need you to create 1 (nonsensical) word that contains every word. However, we want this word to be as short as possible. We can use overlapping letters to achieve this. For example, if your word list was ["cat", "at...
Consider a permutation of the integers 1, ..., n, such as this one for n = 6: [5,2,4,3,6,1] If you view the permutation as a mapping from [1,2,3,4,5,6] to [5,2,4,3,6,1], the permutation can be decomponsed into disjoint cycles. A cycle is a subset of elements that map to each other. For example, 1 gets mapped to 5, whi...
Write a program or function that takes in a nonempty single-line string of printable ascii characters excluding space: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ You may assume the input is valid. Based on the input, draw a new string arranged on a textual grid of sp...
Definition \$a(0) = 0\$ \$a(n) = n-a(a(a(n-1)))\$ for integer \$n > 0\$ Task Given non-negative integer \$n\$, output \$a(n)\$. Testcases n a(n) 0 0 1 1 2 1 3 2 4 3 5 4 6 4 7 5 8 5 9 6 10 7 11 7 12 8 13 9 14 10 15 10 16 11 17 12 18 13 19 13 20 ...
Cheddar is a high-level, functional + object-oriented programming language created by our user Downgoat designed to make programming easier, faster, and more intuitive. What general tips do you have for golfing in Cheddar? I'm looking for ideas which can be applied to code-golf problems and which are also at least som...
Your task is to assemble the integers from 1 to N (given as input) into a rectangle of width W and height H (also given as input). Individual numbers may be rotated by any multiple of 90 degrees, but they must appear as contiguous blocks in the rectangle. That is, you cannot break one of the numbers into multiple digit...
Definition \$a(1) = 1\$ \$a(2) = 2\$ \$a(n)\$ is smallest number \$k>a(n-1)\$ which avoids any 3-term arithmetic progression in \$a(1), a(2), ..., a(n-1), k\$. In other words, \$a(n)\$ is the smallest number \$k>a(n-1)\$ such that there does not exist \$x, y\$ where \$0<x<y<n\$ and \$a(y)-a(x) = k-a(y)\$. Worked out ...
Background I have a collection of "weekday socks", which are seven pairs of socks labeled by the days of the week. When I wash my socks, they end up in a pile, and I must arrange them into the correct pairs before putting them into the closet. My strategy is to pull one random sock from the pile at a time and put it on...
For this challenge, you need to compress a diff. A diff is some data that represents the difference between two strings. For this challenge, you need to provide one or more programs that can: Input A and B, and output a diff, C Input A and C, and output B Input B and C, and output A The goal is to make the diff, C,...
The Challenge Given either a string (may have newlines), or a two dimensional array, and a positive integer n, output the position of the platforms n turns after the initial position. U, D, R, L are platforms. ^, v, >, < are arrows that change the directions of the platforms. U, D, R, L move up, down, right and left,...
Challenge description You have a music library with many tracks recorded by many bands, each of which has a name, like Queen, Aerosmith, Sunny Day Real Estate, The Strokes . When an audio player displays your library alphabetically by band name, it usually skips the The part, as many band names start with The, making i...
King of the Torus! Your job is to conquer the torus, but wait, there are multiple other players banded together in teams facing you! You will need to use your wit's to conquer the torus. There are three teams: red, blue and green. Teams are self-assigned arbitrarily. If the teams are even you may join the team of your ...
Martin Ender recently hit 100K, and has come up with some pretty awesome languages. We're going to have a bit of fun with one of them, Hexagony (and a bit of regex for Retina) As a brief overview, you need to write a program that inputs a Hexagony grid and determines if there is a path on that grid that matches a stri...
You are to print this exact text: A ABA ABCBA ABCDCBA ABCDEDCBA ABCDEFEDCBA ABCDEFGFEDCBA ABCDEFGHGFEDCBA ABCDEFGHIHGFEDCBA ABCDEFGHIJIHGFEDCBA ABCDEFGHIJKJIHGFEDCBA ABCDEFGHIJKLKJIHGFEDCBA ABCDEFGHIJKLMLKJIHGFEDCBA ABCDEFGHIJKLMNMLKJIHGFEDCBA ABCDEFGHIJKLMNONMLKJIHGFEDCBA ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA ABCDEFGHIJKLMN...
In my last challenge, you were asked to find all rectangles given a m x n grid of them. However, it turned out to be very trivial as there actually was a mathematical formula I did not even know about to solve the problem! So now, for a little bit more of a challenge, how about calculating the number of unique rectangl...
Take the vector of unknowns , and apply some generic differentiable function . The Jacobian is then given by a matrix such that: For example, suppose m=3 and n=2. Then (using 0-based indexing) The Jacobian of f is then The goal of this challenge is to print this Jacobian matrix. Input Your program/function should ...
As a follow-up to this challenge, we now want to count the number of rectangles in grid with r rows and c columns where there is a line crossing through every diagonal of a square in the grid. Now, we are still counting the the same rectangles as before, but this time we must also include rectangles that are tilted by ...
"The Nobel Prize in mathematics was awarded to a California professor who has discovered a new number! The number is bleen, which he claims belongs between 6 and 7." --George Carlin In this challenge, you will print all Integers, inclusive, within the given input range. Print numbers ascending or descending according...
Given six unique non-negative integers, print the two 3-digit integers comprised of those numbers that sum to the smallest amount. Additionally, If there is more than one set of numbers that meets the smallest-sum requirement, print the two that have the greatest difference. For example, 269 + 157 = 267 + 159 = 426; ...
Definition A vector a containing n elements is said to majorize or dominate a vector b with n elements iff for all values k such that 1 ≤ k ≤ n, the sum of the first element of a↓ through the kth element of a↓ is greater than or equal to the sum of the first through kth elements of b↓, where v↓ represents the vector v ...
Write a program or function that takes in a positive integer and prints or returns a stack of that many ASCII-art turtles, where each turtle is larger than the one above it. Specifically, if the input is 1, the output should be: __ /,,\o If the input is 2: __ o/,,\ ____ /,__,\o If the input is 3: __ /,,\o ...
In a far-off kingdom, a chess queen takes a daily walk across a spiral path, numbered from 1 to n, not caring to follow the spiral itself, but simply making queen's moves as she would on a chessboard. The queen is beloved by her subjects, and they make a note of every square she visits on her path. Given that the queen...
The Collatz conjecture is a very well-known conjecture. Take a positive integer; if it's even, divide by 2, else, multiply by 3 and add 1. Repeat until you reach 1 or something else happens. The conjecture is that this process always reaches 1. You can also reverse the process. Start at 1, multiply by 2, and to branch ...
Background This is a standard textbook example to demonstrate for loops. This is one of the first programs I learnt when I started learning programming ~10 years ago. Task You are to print this exact text: ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** Spe...
A positive integer \$k\$ is a Loeschian number if \$k\$ can be expressed as \$i^2 + j^2 + i\times j\$ for \$i\$, \$j\$ integers. For example, the first positive Loeschian numbers are: \$1\$ (\$i=1, j=0\$); \$3\$ (\$i=j=1\$); \$4\$ (\$i=2, j=0\$); \$7\$ (\$i=2, j=1\$); \$9\$ (\$i=-3, j=3\$); ... Note that \$i, j\$ for...
Previously, we computed the Bit-Reversal Permutation where we found how the order of indices would be permuted. In that case, we received an input n which was the order of the permutation of the indices where the length was 2n. However, this time, we are given a string of length m = 2k for some k. Now we want to apply ...
Your task is to build a Game of Life simulation representing a digital clock, which satisfies the following properties: The clock displays the hours and minutes in decimal (e.g. 12:00, 3:59, 7:24) with a different state for each of the 1,440 minutes of the day — either the hours will go from 0 to 23 or from 1 to 12 wi...
Inspired by this Game of Life question. Wireworld simulates "electrons" flowing through "wires", simple arrangements of which produce typical logic gate behavior. I challenge you to build a digital clock in the Wireworld cellular automaton. Your clock must count upwards from 00:00 to 23:59 in the usual fashion, or to 1...
The scenario Lately you have been noticing some strange behavior with your favorite text editor. At first it seemed that it was ignoring random characters in your code when writing to disk. After a while you noticed a pattern; characters with odd ASCII values were being ignored. Under further inspection you discovered ...
Mr Short likes to play chess. Mr Short is also a very traditional man. Hence, Mr Short is disturbed by the recent trend of using Algebraic notation in modern chess, and he would rather use Descriptive notation, like his father and his father's father before him. Note To simplify this challenge, I chose not to deal with...
Jellyfish is a two-dimensional esoteric programming language inspired by J and written in Python 3. It was inspired by a challenge on PPCG. The name was suggested in PPCG chat as a combination of Jelly, a golfing language inspired by J, and Fish, a two-dimensional esoteric language. What general tips do you have for ...
This is a very simple challenge. The joke language InterpretMe consists of one command; *, which causes the program to take input of an InterpretMe program and execute it. An InterpretMe program will interpret as many InterpretMe programs as there are * in input. Your goal is to create a program that interprets Inte...
Challenge description Let's define an W x H grid as a two-dimensional array of length H whose each subarray is of length W. Example: a 2x3 grid (. character used as a blank): .. .. .. A unit is a single point of a grid. A block is either a single unit or a set of contiguous units (meaning each unit of a block has at l...
Background The Fibonacci sequence is defined as $$f(1) = 1 \\ f(2) = 1 \\ f(n) = f(n-1) + f(n-2)$$ The Fibonorial, similar to the factorial, is the product of the first \$n\$ Fibonacci numbers. $$g(n) = f(1) \times f(2) \times ... \times f(n-1) \times f(n)$$ The Fibonomial coefficient, similar to the binomial coefficie...
My PPCG holiday is over :D Intro Fractional time is the year + (the value (minute of year) / number of minutes in the year). Example calculation You should assume that February always has 28 days and the year is always 365 days long. Let's say we want to convert the time: 17:34 3rd March 2013 to fractional time. Firstl...
The Challenge Given a string, output the text in the shape of a square. You can assume that the text will always fit in a square, and that it will never be an empty string. You can also assume it will never have newlines. Example Input: Hi, world Output: Hi, wo rld Test Cases Input: Hi, world! Hello Output: Hi, wo...
The Chinese Remainder Theorem can be quite useful in modular arithmetic. For example, consider the following set of congruence relations: For sets of congruence relations like this, where all the bases (3, 5, 7 in this example) are co-prime with each other, there will be one and only one integer n between 1 and the pr...
Task Your task is to convert a text into medieval orthography. Details j is converted to i and J to I. u and U at the beginning of words are converted to v and V respectively. v and V at anywhere except the beginning of words are converted to u and U respectively. s is converted to ſ (U+017F) unless at the end of the ...
Cops section The robbers section can be found here. Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions. Challenge Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4...
Robbers section The cops section can be found here. Challenge Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only...
Text adventure games have a pretty set formula; there's a world composed of a series of rooms / spaces, the player can move around these rooms, and there are some items in the rooms. Items can be picked up by the player, put down, used to access other rooms (e.g. keys), and combined with other items to make new items. ...
In this code-golf challenge, you must output an ascii-art of a random die roll. like this: ________ /\ \ / \ 6 \ { 4 }-------} \ / 5 / \/_______/ Please note that: ________ /\ \ / \ 3 \ { 4 }-------} \ / 5 / \/_______/ is invalid output, because that is not a possib...
The VIC cipher is one of the most complicated pencil and paper ciphers ever devised. Used in the 1950s by Soviet spy Reino Häyhänen, codenamed "VICTOR", its main principle is security through obfuscation; a lot of obfuscation. Your task is to write a program or function that will take a message and encode it using the ...
You've received a coded message from your ally that you know is encoded with the VIC cipher. As you know that the VIC cipher is notoriously convoluted, you want to write a program that will decode the VIC cipher but is small enough to hide from the enemy if you are captured, and thus uses as few bytes as possible. Your...
Given a Gaussian integer \$a+bi\$ where \$a\$,\$b\$ are integers and \$i = \exp\left(\pi i/2\right)\$ is the imaginary unit, return the closest (w.r.t to the Euclidean distance) Eisenstein integer \$k+l\omega\$ where \$k\$,\$l\$ are integers and \$\omega = \exp(2\pi i/3) = (-1+i\sqrt{3})/2\$. Background It is probably ...
From what I've seen throughout my time here on PPCG, most JavaScript entries involving fat arrow functions tend to be one of two camps: The simple ones that are capable of running as a single statement and returning an answer, straight off the bat, like x=(a,b)=>a*a+b The more complex ones that usually have curly brac...
The Challenge Given an algebraic expression (eg 2ab, change it so it follows standard convention rules. The Rules Letters should be in alphabetical order. ie 2ab is allowed but not 2ba. Numbers should always go first. ie 2ab is allowed but ab2 is not. Exponentiation will be given as a^b to mean a to the power of b....
Taking some output from xxd and turning it into usable shellcode by hand is no fun, so your job is to automate the process. Rules Your submission can be a function, lambda, script, or any reasonable equivalent of those. You may print the result, or if your submission is a function/lambda then you may also return it. Yo...
See also: Make a move on a Go board. Task Go is a board game where two players (Black and White) place stones on the intersections of grid lines on a 19×19 board. Black moves first — for example, on D4:         In this challenge, you must take a Go board coordinate like D4 as input, and output an ASCII representation ...
Taken from this question at Stack Overflow. Thanks also to @miles and @Dada for suggesting test inputs that address some corner cases. The challenge Given an array of integer values, remove all zeros that are not flanked by some nonzero value. Equivalently, an entry should be kept either if it's a nonzero or if it's a ...
Write a program or function that given two integers a, b outputs a string containing a decimal number representing the fraction a/b exactly. If a/b is integer, simply output the value, without a decimal dot or leading zeroes: 123562375921304812375087183597 / 2777 -> 44494913907563850333124661 81 / 3 -> 27 -6 / 2 -> -3 ...
What general tips do you have for golfing in Common Lisp? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Common Lisp (e.g. "remove comments" is not an answer). Please post one tip per answer.
Of course, the SE network is very knowledgeable about how to be respectful in the restroom, but for those of you who need a recap, being respectful means flushing the toilet, etc. Most importantly, though, it means using the stall as far away from others as possible. The challenge Given a blueprint of a set of stalls ...
Given an input number n from 1 to 26 (or 0 to 25), output the alphabet reading left-to-right up to and including that corresponding letter, with a=1, b=2, c=3, .... The twist is the letters must also be repeated vertically corresponding to their position in the alphabet. Odd numbers (when 1-indexed) should be balanced ...
Y'know, we've had a lot of "alphabet" challenges recently. (one two three four five.) While I love a good challenge, and those challenges were very fun, I think it's time for a change of pace. We need to exclude such challenges in the future. It's time for automation! You're going to find some alphabets for me, and for...
You are to print this exact text: ABABABABABABABABABABABABAB BCBCBCBCBCBCBCBCBCBCBCBCBC CDCDCDCDCDCDCDCDCDCDCDCDCD DEDEDEDEDEDEDEDEDEDEDEDEDE EFEFEFEFEFEFEFEFEFEFEFEFEF FGFGFGFGFGFGFGFGFGFGFGFGFG GHGHGHGHGHGHGHGHGHGHGHGHGH HIHIHIHIHIHIHIHIHIHIHIHIHI IJIJIJIJIJIJIJIJIJIJIJIJIJ JKJKJKJKJKJKJKJKJKJKJKJKJK KLKLKLKLKLKLKLKL...
For all you American folk out there, remove the "s" in "maths". Ugh, my maths teacher gave me so much algebra to do. There's just lines and lines of meaningless junk like Expand (x+1)(x+6) and Factorise x^2+2x+1. My hands are literally dying from the inside. So I figured out a way to hack the system - why not write a p...
Challenge description Multiplification (totally not a made-up word) is a process in which you take two positive integers: a and b, and produce another integer which is equal to a repeated ("glued together") b times. For example, multiplifying 3 by 7 gives 3333333. Similarly, 103 multiplified by 5 is 103103103103103. In...
There are so many different ways to express whether something is true or not! The goal of this challenge is to produce a standardized output of truthy or falsy for various input truthy and falsy values. For the purposes of this challenge, the following inputs are considered truthy: A string representing a signed integ...
The goal of this challenge is to reduce a list of string to a shorter more general list of string. Input The Input is provided with space between the string (a b c) or in list form (["a","b", "c"]). It's a list list of string that can be of the following form : aaa aaaX aaaX/Y With aaa any set of non capital alphabet...
We see a lot of challenges here asking for a function to create a sequence from the OEIS. While these challenges are fun, as a programmer I see an opportunity for automation. Your challenge is to make a program that takes the index of a sequence (e.g. A172141) and some integer n (e.g. 7), and pulls the appropriate val...
Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. However, this is a multiple-holes (common theme is manipulation of data of any type and structure, especially special handling of empty data) code-golf version of the Phase I problems – open to any language. Enjoy! Objec...
Intro The challenge is to create a program/function that prints the intersection of its own source code and a given string input. This is code golf and to be more precise: Let I be the input set {"a","b","c"} Let S be the source code set {"b","f"} Then the intersection is what they share I ∩ S = {"b"} Inpu...
For this challenge, you will be writing a program or function which outputs (or prints) (in a reasonable format, i.e single string or an array of lines) a chess board which indicates all the possible moves of a piece given an empty board. There are 5 chess pieces (for this challenge a pawn may be ignored): Bishop (Mo...
Write a program or function that takes in a nonempty single-line string. You may assume it only contains printable ASCII excluding space. Print or return an ASCII art lozenge shape similar to a lemon or lime made from the prefixes of the string. Suppose the input string is n letters long. Then, such a shape consists of...
A Proth number, named after François Proth, is a number that can be expressed as $$N = k \times 2^n + 1$$ Where \$k\$ is an odd positive integer and \$n\$ is a positive integer such that \$2^n > k\$. Let's use a more concrete example. Take 3. 3 is a Proth number because it can be written as $$ 3 = (1 \times 2^1) + 1 $$...
Write a function or program that takes string inputs, fully-spelled, English month names in title case: January, February, March, etc. (null/CR/LF terminated OK, delimited with some non-alpha character if you so choose) and either compares two inputs, returning a Truthy value if the second input is greater (in month o...
Write a program or a function in your favorite programming language that will take as input a number n (integer or non-integer) between 0 and 100 inclusive, and output the corresponding grade as outlined below: If 0 < n <= 40, then output E. If 40 < n <= 55, then output D. If 55 < n <= 65, then output C. If 65 < n <= ...
Introduction Inspired by Dyalog Ltd.'s 2016 student competition. The challenge there is to write good APL code, but this is a code-golf and it is open to all languages. Derived from this closed challenge. The real challenge here is to combine the various (quite trivial) parts of the problem in a byte-efficient way by r...
The Challenge Output a list of years that starts with the current year and ends 120 years ago. The birth year of every living human would be included in this list. Details The list should be in descending order. Every built-in function to manipulate arrays and/or lists is allowed. Shortest code in bytes wins. When run ...