instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Background As you maybe know Ramanujan made this magic square by \$4x4\$ Matrix: This works like all magic squares. But the special thing in this square is that his birthdate is hidden in the first row, the 22\$^{nd}\$ Dec 1887. Challenge Can you make one for your birthdate? Input The User will give Input in this form...
stackexchange_codegolf
English is such an inefficient language. We've got enormous words when there are plenty of two or three letter words we never used! As computer scientists, every keystroke matters. We need to be more efficient. Just think of how many words we could have had! In fact, don't think about it, tell me. Given a string (or li...
stackexchange_codegolf
Consider a list of subject, grade pairs. E.g. [("Latin", "A"), ("French", "A*"), ("Math", "B"), ("Latin", "A*")] The task is to return the same list but with each subject given at most once. Where a subject occurred more than once originally, the returned list should have the highest grade for that subject. Using th...
stackexchange_codegolf
In mathematics, the factorial, shortened "fact" of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! is 1 * 2 * 3 * 4 * 5 = 120 The factorial of 0 is 1, according to the convention for an empty product. These are the regular facts we are used to. ...
stackexchange_codegolf
Consider a NxN pixel grid with up to M objects drawn on it, either squares or diamonds: square    diamond The objects may overlap, so recognition is hard. The task is to give the minimal possible numbers of objects per shape that can be "seen" in the picture and tell how many squares, how many diamonds, and how many ob...
stackexchange_codegolf
A sign sequence is an infinite sequence consisting entirely of \$1\$ and \$-1\$. These can be constructed a number of ways, for example: Alternating signs: \$1, -1, 1, -1, ...\$ \$-1\$ for primes, \$1\$ for non-primes: \$1, -1, -1, 1, -1, 1, -1, ...\$ All \$1\$s: \$1, 1, 1, ...\$ Your task is to write a piece of code...
stackexchange_codegolf
Challenge: Given an expressions made of additions and multiplications, output an expression that is a sum of products. The output must be equivalent to the input modulo the law of distribution. For example, \$1 + ((2 + 5\times 6) \times(3+4))\$ becomes \$1 + 2 \times 3 + 2 \times 4 + 5\times6\times3 + 5 \times 6 \times...
stackexchange_codegolf
Inspiration. Inverse. Evaluate a given omnifix expression. Omnifix is like normal mathematics' infix notation, but with additional copies of each symbol surrounding the arguments. The outer symbols take the place of parentheses, and there is therefore no need for additional parentheses. You must support addition, subtr...
stackexchange_codegolf
Given one of the following inputs: Sweet Onion Chicken Teriyaki Oven Roasted Chicken Turkey Breast Italian BMT Tuna Black Forest Ham Meatball Marinara output a number from 1-7 (or 0-6) representing the day of the week that you get that deal, starting with Monday as the lowest number. Input can be all lowercase or uppe...
stackexchange_codegolf
Related to, but not a duplicate of, this challenge. Basics This is a clock: ****** ** | ** ** | ** * | * * | * * | * * | * * | * * ...
stackexchange_codegolf
Backstory I was fiddling around with the Evolution of Trust and thought of this.Warning: I recommend you go check it out first before attempting this challenge. Summary for people who haven’t played A quick summary of what it says on the site: there is a machine. If you put in one coin, your opponent gets three coins (...
stackexchange_codegolf
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...
stackexchange_codegolf
My Precalc teacher has one of his favorite problems that he made up (or more likely stole inspired by xkcd) that involves a row of n urinals. "Checkmate" is a situation in which every urinal is already occupied OR has an occupied urinal next to them. For instance, if a person is an X, then X-X--X is considered checkmat...
stackexchange_codegolf
Write a program (or function) (let's call it P1), that when run, outputs another program P2 of the same language and exactly 1 byte longer than P1. Program P2 when run, should output a 3rd program P3 that's 1 byte longer than P2. P3 must output a program P4 that's one byte longer than P3, etc. The same for P5, P6, ...,...
stackexchange_codegolf
This is a cops and robbers challenge - Cop's Thread Each of the cops have been tasked to write a program that terminates after exactly 60 seconds, or as close as possible. For example: #include <unistd.h> int main(int argc, char **argv){ sleep(60); return 0; } Your goal is to take any of the uncracked submissi...
stackexchange_codegolf
Task Implement a kind of "some users are typing" system, which can be found in Discord and some other chat clients. If 1 user (say, Bubbler) is typing, output Bubbler is typing... If 2 users (say, Bubbler and user) are typing, output Bubbler and user are typing... If 3 or more users are typing (say, Bubbler, randomuse...
stackexchange_codegolf
Challenge Write a program or function that takes a number \$n\$ and returns the smallest \$k\$ such that concatenation \$n'k\$ is a square. This sequence is described by A071176 on the OEIS. I/O Examples input --> output 1 --> 6 (4^2) 10 --> 0 (10^2) 35 --> 344 (188^2) 164 --> 836 (406^2) 284 --> 2596 (168...
stackexchange_codegolf
This is an answer-chaining challenge in which each answer builds on the previous answer. Taking no input, you are to output the most recent submission to this thread. I would HIGHLY suggest sorting by oldest and skipping to the last page to find the most recent answer. Scoring The winner will be chosen based on a point...
stackexchange_codegolf
You will be given two integers \$M\$ and \$N\$. Find the number of pairs \$(x,y)\$ such that \$1 \le x \le M\$, \$1 \le y \le N\$ and \$(x+y)\bmod5 = 0\$. For example, if \$M = 6\$ and \$N = 12\$, pairs which satisfies such conditions are, \$(1,4), (4,1), (1,9), (2,3), (2,8), (3,2), (3,7), (3,12), (4,6), (6,4), (4,11),...
stackexchange_codegolf
Rules Given an ISO3166-1-Alpha-2 country code your task is to decide on the traffic direction for that country: Input will be a valid country code (valid as in it's an element of the two lists provided) Input may be a list of two characters instead of a string if it helps You may choose to take input in lowercase You ...
stackexchange_codegolf
First 15 numbers of the A046173: 1, 99, 9701, 950599, 93149001, 9127651499, 894416697901, 87643708742799, 8588189040096401, 841554882220704499, 82463790268588944501, 8080609891439495856599, 791817305570802005002201, 77590015336047156994359099, 7603029685627050583442189501 Your task is simple, output the first 20 numbe...
stackexchange_codegolf
Given a positive integer as input, output that integer, but with its bits rotated two times to the right. Also, think of the number as a donut of bits, eg. 21 -> (10101). If all of the bits suddenly decided to move to the right, they would wrap around. eg. rRot(21) -> (11010) = 26. Do what i explained 2 times (at the s...
stackexchange_codegolf
Fourward (Introduction) I have an unhealthy obsession with the number 4. I love it so much, in fact, that seeing any other digit is frustrating to me. I therefour wish to create a 'Fourier Transformation': a way to represent any integer value with an expression that uses only the digit 4. Fourmat (Challenge) I wish to ...
stackexchange_codegolf
Challenge Given a polynomial \$p\$ with real coefficients of order \$1\$ and degree \$n\$, find another polynomial \$q\$ of degree at most \$n\$ such that \$(p∘q)(X) = p(q(X)) \equiv X \mod X^{n+1}\$, or in other words such that \$p(q(X)) = X + h(X)\$ where \$h\$ is an arbitrary polynomial with \$ord(h) \geqslant n+1\...
stackexchange_codegolf
Write a function, f, that takes in a positive integer and returns a function. The new function returned should be identical to f. However, when the "termination call" happens, f should instead return the sum of all integers passed. For example, g=f(4) (if f is the first function) should set g to another function. h=g(...
stackexchange_codegolf
A set of n positive numbers has 2^n subsets. We'll call a set "nice" if none of those subsets have the same sum. {2, 4, 5, 8} is one such nice set. Since none of the subsets has the same sum, we can sort the subsets by sum: [{}, {2}, {4}, {5}, {2, 4}, {2, 5}, {8}, {4, 5}, {2, 8}, {2, 4, 5}, {4, 8}, {5, 8}, {2, 4, 8}, {...
stackexchange_codegolf
I enjoy participating in math competitions run by Mu Alpha Theta, a mathematics honor society in the United States. At competitions, I take a 30-question multiple choice test. There are five choices per question, labeled A through E. My score on a test is four points for each correct answer, zero points for a question ...
stackexchange_codegolf
Help! Here is my good friend Mr. Snowman: \(.,.) < Hello! ( : )> He is an amazing dancer, but he tends to get stage fright. He knows all the moves, but just needs someone to tell him which moves to do. Here are all of his moves: Arms Up \(.,.)/ ( : ) Arms Down (.,.) <( : )> Right Arm Up \(.,.) ( : )> Left Arm Up ...
stackexchange_codegolf
Convert short date format into English long date in as few bytes as possible. Input Input will be in the form of a string with format, yyyy-mm-dd, with zero padding optional for all values. You can assume that this is syntactically correct, but not necessarily a valid date. Negative year values do not need to be suppor...
stackexchange_codegolf
Today is Tax Day! Oops. Well, today is tax day if you are a resident of Maine or Massachusetts. So you're probably still completing your return and need a calculator for when you get to Line 44. Given an input of taxable income (US$, accurate to 2 decimal places) and a string representing filing status, output the amou...
stackexchange_codegolf
All-pairs shortest paths is a standard pathfinding problem. This is a twist on that. Definitions We are searching for paths on a directed graph. Graphs are defined by square matrices, for example 0 3 2.5 1 0 1 0 -1 0 Write M(r,c) = value in M at row r, column c is the cost to travel from node r to node c. The gra...
stackexchange_codegolf
Number Splitting Instructions Oh no, my numbers have stuck together! Luckily, we can split them apart with code. Your code should be a function that takes an integer input from stdin or as an argument. You must split the number into single digits, keeping the order and possible duplicates of these digits. The output sh...
stackexchange_codegolf
I am in desperate need of some ear defenders, so I can program in peace. Unfortunately, I don't have ear defenders. But I do have a pair of headphones, a microphone and a microcontroller, so I thought I'd make some noise-cancelling headphones. However, there is one tiny problem. I can't program in noisy environments! S...
stackexchange_codegolf
Output this exact text: 1 i 12 hi 123 ghi 1234 fghi 12345 efghi 123456 defghi 1234567 cdefghi 12345678 bcdefghi 123456789abcdefghi 12345678 bcdefghi 1234567 cdefghi 123456 defghi 12345 efghi 1234 fghi 123 ghi 12 ...
stackexchange_codegolf
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...
stackexchange_codegolf
Your input is a ragged list of positive integers and a positive integer. Your task is to find that positive integer and return it's index, or if the positive integer doesn't exist, indicate it's nonexistence. How are indices in ragged lists defined? They are simply lists of indices that when used consecutively to index...
stackexchange_codegolf
Background Scrabble is a word game in which players collaboratively build a board consisting of letter tiles that spell words. Each word must be connected to another word, and players gain points based on the letters they use and where they are placed. Words can be spelled either from left-to-right or top-to-bottom, an...
stackexchange_codegolf
They say that hate is a strong word. I wanted to find out why, so I had a good look at the word. I noticed that every consonant had a vowel after it. That made it look quite strong to me, so I decided that that's what makes a word strong. I want to find more strong words, so I'll need a program for it! Finding strong w...
stackexchange_codegolf
Recreational languages win at code golf too much. This challenge is simple, when using higher level functions. The task is as follows: Given any valid url, which is guaranteed to result in a valid HTML document (for example https://en.wikipedia.org/wiki/Ruby_on_Rails, which has 9 images), count the number of images di...
stackexchange_codegolf
A Pillai prime is a prime number \$p\$ for which there exists some positive \$m\$ such that \$(m! + 1) \equiv 0 \:(\text{mod } p)\$ and \$p \not\equiv 1\:(\text{mod }m)\$. In other words, an integer \$p\$ is a Pillai prime if it is a prime number, if there exists another positive integer \$m\$ such that the factorial...
stackexchange_codegolf
You work for a social media platform, and are told to create a program in a language of your choice that will automatically flag certain post titles as "spam". Your program must take the title as a string as input and output a truthy value if the title is spam, and a falsey value if not. To qualify as non-spam, a title...
stackexchange_codegolf
Given a list of case-insensitive ASCII letter strings ("words"), output whether the entire list can be found on some four-by-four configuration ("board") of letter squares, in which no square can be used more than once in a word, and in which words are formed by moving from any square to any adjacent square including d...
stackexchange_codegolf
The Collatz Conjecture The famous Collatz Conjecture (which we will assume to be true for the challenge) defines a sequence for each natural number, and hypothesizes that every such sequence will ultimately reach 1. For a given starting number N, the following rules are repeatedly applied until the result is 1: While N...
stackexchange_codegolf
Given some positive integer \$n\$ generate all derangements of \$n\$ objects. Details A derangement is a permutation with no fixed point. (This means in every derangement number \$i\$ cannot be in the \$i\$-th entry). The output should consist of derangements of the numbers \$(1,2,\ldots,n)\$ (or alternatively \$(0,1,...
stackexchange_codegolf
There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever. Your task is to create a program that gives the next word in sequence giv...
stackexchange_codegolf
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...
stackexchange_codegolf
Task Given \$n\$, output position of the last odd digit in the decimal representation of \$2^n\$ (counting from the end). Rules There are no odd digits for \$n=1,2,3,6,11\$ \$(2, 4, 8, 64, 2048)\$ - you may output anything that is not a positive integer for them (no need to be consistent). You choose whether to handle...
stackexchange_codegolf
Challenge : Sort the vowels (only vowels) in the given string . Note : Vowels are the following characters: A, E, I, O, U Vowel sorting is cyclic i.e. After rearrangement the first vowel of sorted string goes where the original first vowel was Input : A string line, the original line (consisting of alphabets and wh...
stackexchange_codegolf
I thought of a new way to generate my passwords, and even though it's probably not very clever in the long run, it could still make for a fun code-golf. Taking a string of words, the password is generated thus: Pick the nth character in the nth word If n is larger than the word, continue counting backwards Example: T...
stackexchange_codegolf
Background Page 219 of A New Kind of Science (a book by Stephen Wolfram, the creator of Mathematica) shows an interesting 2D pattern generated by constraints. The relevant section in the book starts at page 210; you can browse other pages for more context. In short, the large binary image is the result generated by 12...
stackexchange_codegolf
Challenge: Here we have the first 100 items of a sequence: 6,5,4,3,2,1,66,65,64,63,62,61,56,55,54,53,52,51,46,45,44,43,42,41,36,35,34,33,32,31,26,25,24,23,22,21,16,15,14,13,12,11,666,665,664,663,662,661,656,655,654,653,652,651,646,645,644,643,642,641,636,635,634,633,632,631,626,625,624,623,622,621,616,615,614,613,612,6...
stackexchange_codegolf
This is part of a cops-and-robbers challenge. Go here for the robbers' part. The Cops' Challenge You should write a program or function in a language of your choice, which outputs the string Haystack. However, it must be possible to remove some subset of characters from your program (without reordering the rest), such ...
stackexchange_codegolf
The goal of this challenge is to generalise the bitwise XOR function to other bases. Given two non-negative integers \$ x \$ and \$ y \$, and another integer \$ b \$ such that \$ b \geq 2 \$, write a program/function which computes the generalised XOR, described the following algorithm: First, find the base \$ b \$ re...
stackexchange_codegolf
Given 2 inputs (m=minimum starting id, n=number of ids), generate a sequential list of ids, starting at >=m, made up of the digits 0-9 where no 2 contiguous numbers are the same, e.g. 1232 is ok, 1233 is not (contains 2 '3's next to each other). Example for m=985, n=6, below shows what ids would be generated/skipped .....
stackexchange_codegolf
Given an initial \$n\$-tuple \$t_0=(t_{0,1},...,t_{0,n})\$, we can obtain its corresponding Ducci sequence \$\{t_0, t_1, ...\}\$ by the recurrence \$\displaystyle t_{i+1}=\left(\left|t_{i,1}-t_{i,2}\right|,\left|t_{i,2}-t_{i,3}\right|,...\left|t_{i,n}-t_{i,1}\right|\right)\$. That is, to obtain the next term of the seq...
stackexchange_codegolf
The challenge Given two strings, each of length up to 30, consisting of printable ASCII characters (codes \$[32, 126]\$), put them onto a balance scale in the fewest bytes of code! This consists of the following steps: Calculate and compare the weights of the strings Choose the appropriately tilted ASCII-art scale Pla...
stackexchange_codegolf
Statement You are given a still of a series of balls falling in a 2D grid. This grid is surrounded by immutable and unbreakable walls so all the action is contained within them. Your task is to determine what the state of the scenario will be after gravity does all it's work. Elements inside grid - Floor, doesn't alt...
stackexchange_codegolf
The task is to find the smallest paper size on which it is possible to print a picture of the dimensions given in milimetres. The image will be printed without margins. Input: Two integers (bigger than zero) and a letter a, b, or c, for example: 290 200 A Output: Paper size, for example: A4 Another examples: 218,297...
stackexchange_codegolf
Wren is a small, fast, class-based concurrent scripting language. Does anyone have any tips for this language? Please make sure to post 1 tip per answer, and don't post answers like "remove whitespace".
stackexchange_codegolf
Introduction: I think everyone knows what a Lava Lamp is, but in case they do not: (Image source) They're basically glass tubes that contain wax in a translucent liquid. The bottom part is heated when the lamp is turned on, causing a change in density and thus the wax floats to the top. When it cools down, it falls do...
stackexchange_codegolf
This challenge is a riff on Dion's challenge "Is this a rectangle?". The goal of this challenge is to write a program to decide whether or not some collection of tuples of integers represents a hypercube of some dimension. Background A hypercube is a generalization of a square. A \$0\$-cube is a single point. A \$1\$...
stackexchange_codegolf
Challenge Given a Youtube playlist, output the number of videos in it. I/O The playlist will be given as an URL; for example, https://www.youtube.com/playlist?list=PL_3jnZNPYn7qUatgDYBS5NShkfXoehSRC (this is a playlist a friend sent me to try to get me to listen to K-Pop because she's obsessed with it and I don't like ...
stackexchange_codegolf
The goal is to get all combinations of hold'em starting hands (every two card combination) in the shortest amount of code. A hold'em hand is two distinct cards dealt from a standard deck of 52 cards, with deal-order being irrelevant, as such there are 52*51/2 = 1326, hands. There is also a commonly used notation for th...
stackexchange_codegolf
Your goal is to alternate uppercase and lowercase letters, while ignoring non-alphaneumeric characters. Input => Output abc => aBc OR AbC a c => A c OR a C abc123abc => AbC123aBc OR aBc123AbC Shortest answer wins.
stackexchange_codegolf
https://www.youtube.com/watch?v=6vAhPeqlODg Ok—jig's up—this one's only related to smash in name, but it'll give you something to burn your time with while you wait 'til December 7th Given a color string s of form #rgb(in hex, so #000000 to #ffffff, dont worry about the three digit ones: #123) you must average the rgb ...
stackexchange_codegolf
In this question, we will only focus on losing weight by doing exercise, although there are still many ways to lose weight. Different sports burn different amount of calories. For example, playing billiards for an hour can burn 102 calories[1], while playing basketball for 15 minutes can already burn 119 calories [1], ...
stackexchange_codegolf
Your task today is to implement a time limit for getting input, a task I've found rather annoying to achieve in most languages. You will create a program function which prompts the user for input. Immediatly after the user supplies input, print the message input received and end execution/return. However, if the user w...
stackexchange_codegolf
Your task is to write a program, function, or snippet that will output one value if run forward, and another if run backward. The program must run without errors. The output can be any two distinct values, of the same data type. For example, 1 and 3, true and false, or 't' and 'f'. In languages without a concept of dat...
stackexchange_codegolf
Context So the Dutch "Ministerie van Binnenlandse Zaken en Koninkrijksrelaties" (NL) - "Ministry of the Interior and Kingdom Relations" (EN) recently released the source code of their digid-app. They have some goofy code in there, which led to mockery and memes on reddit Source code of the offending method can be found...
stackexchange_codegolf
Story: The π was recently computed with accuracy to 100 trillions digits, but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits of them! Challenge: Your task will be to write program or function which takes string of digits including dec...
stackexchange_codegolf
Are there any tricks to shorten defined function names like setInterval, onkeydown, onkeyup, createLinearGradient or even return? When using it more than once it's nice to put it as a string into a variable and reuse it afterwards but most functions I only need once. I know that ES6 has arrowed functions - maybe there ...
stackexchange_codegolf
Goal Given a deal result from Duplicate Contract Bridge, calculate the deal score. Basically the same as iBug's question, which was deleted. I figured out this scoring system while trying to answer that question. Input Input is a deal result, and whether or not the declaring side is vulnerable. The deal result is a str...
stackexchange_codegolf
Strings with Context For the purposes of this challenge, a string with context is a triple of strings, called the left context, the data part, and the right context. It represents a substring of a longer string. We use the vertical pipe | as a separator, so an example of a string with context is cod|e-go|lf, where the ...
stackexchange_codegolf
Given an expression like 4 / 2 + 3, determine whether the expression has the same value in Python 2 and Python 3. Recall that in Python 2 division rounds down (so that 5 / 2 -> 2), whereas in Python 3 division returns a float (so that 5 / 2 -> 2.5). For simplicity's sake, we will only consider expressions of the form: ...
stackexchange_codegolf
Husk is a quite new golfing language, created by PPCG users Leo and Zgarb. It has begun being more and more competitive, often staying close or even beating languages known to be very terse, such as Jelly and 05AB1E. Let's list some of the golfing techniques that are somewhat specific to Husk. As always, please post on...
stackexchange_codegolf
The challenge Given two strings, each of length up to 30, consisting of printable ASCII characters (codes \$[32, 126]\$), put them onto a balance scale in the fewest bytes of code! This consists of the following steps: Calculate and compare the weights of the strings Choose the appropriately tilted ASCII-art scale Pla...
stackexchange_codegolf
Let's assume we've got an imaginary assembler. The assembler supports numerical labels. An infinite loop example: :1 jmp 1 Your task is, to write a preprocessor for this assembler supporting named labels (instead of numerical ones; with up to 8 characters in length), so the label name is replaced to it's numerical...
stackexchange_codegolf
Inspired by I reverse the source code, ... Your task, if you wish to accept it, is to reverse text and mirror select characters. Yes, yes, I know. Very surprising. Input A string, stdin, an array of characters, or any other source of text. All characters of the input are guaranteed to be in the printable ASCII range (3...
stackexchange_codegolf
I was messing around on my 'ol TI-84 CE and made a program that produced this output (it was actually bigger but that is not the point): * * * * * * * * * * * * * * * * * ... I evolved it to take input text and make the triangle waves out of that. The final step was to also take a number to specify th...
stackexchange_codegolf
Introduction In many programming languages, within syntax exceptions, it is often pointed out to the programmer exactly which character or line is the culprit. This challenge will be a bit of a modification of that - specifically, using an arrow to point out any specific character of an input string. The challenge Your...
stackexchange_codegolf
Challenge: Given an index integer n, either output the n'th item in this sequence, or output the sequence up to and including index n: 25,25,7,28,29,20,21,22,23,14,35,26,7,28,29,20,16,29,12,15,28,21,14,17,30,13,16,29,12,15,28,21,10,6,12,18,15,11,7,13,19,17,13,9,15,21,18,14,10,16,22,19,15,11,17,23,20,16,12,18,24,21,17,1...
stackexchange_codegolf
Programming problem: In BotLand, Robots can understand all words of any combination of letters and letters with leading or trailing (not both) numeric value. Given a word W (string of alphanumeric). Write a function to check if W is Bot word. Don't use library functions/ regex. Example: Input: BotLand Output: Bot word ...
stackexchange_codegolf
In this challenge, users will take turns completeing three fairly simple coding tasks in programming languages that are allowed to be progressively older. The first answer must use a programming language that was made in the year 2015. Once there is at least one answer from a 2015 language, answers may use programming ...
stackexchange_codegolf
Every palindrome with an even number of digits is divisible by 11, so 11 is the only [palindromic prime] with an even number of digits. - David Wasserman, OEIS I learned this today the manual way, before I did my research, when my program skipped numbers with an even number of digits (except 11) when calculating pali...
stackexchange_codegolf
Last time when I tried to come up with something easy that wasn't a duplicate, it ended up being way too hard.. So hopefully this time it's indeed something newcomers can try as well. Input: An array/list with integers/decimals. (Or a string representing an array with integers/decimals.) Output: Loop through the number...
stackexchange_codegolf
Output this table: -2* -1* - 0 - 1 2 -1* 0 1 - 2 3 4 1 2 3 - 4 5 6 3 4 - 5 - 6 7 5 6 - 7 - 8 9 6 7 8 - 9 10 11 8 9 10 - 11 12 13 10 11 - 12 - 13 14 You can output one string with two types of split, 1D string array with one type of split, or 2D string array If your language support mix...
stackexchange_codegolf
Introduction Decide whether a Hexagony program composed solely of the characters .)_|\/><@ will halt using least bytes. Challenge Hexagony is a language developed by Martin Ender in which the source code is presented in the form of a hexagon. It has been extensively used in PPCG and there has been many impressive submi...
stackexchange_codegolf
There is currently a meme on the internet that consist of taking a sentence, reverse the meaning and adding n't at the end. For example, I am small becomes I am talln't Challenge For the sake of the challenge, we'll simplify this : Your task will be to detect whenever there is a negation in a sentence, and replace it w...
stackexchange_codegolf
If a positive integer \$N > 2\$ has (strictly) less prime factors (without counting multiplicities) than its successor and its predecessor, we will call it a factor-poor number. In other words, \$\omega(N) < \omega(N - 1)\$ and \$\omega(N) < \omega(N + 1)\$, where \$\omega(N)\$ is the number of unique prime factors of...
stackexchange_codegolf
Challenge : Given a string split at specific positions and capitalize the first character of the given word. Capitalize the first word's first char if and only if it was already capitalized Input : A string s and a character c. Ouput : The string with each occurrence of c replaced with the first char capitalized Exam...
stackexchange_codegolf
Output the provided table of English pronouns exactly, in as few bytes as possible. Code rules The code will take no input The table is tab-delimited Each line begins with a single tab \t if there is no row heading Each line ends in a single newline \n (not \r\n), including the last line There are four tabs between "P...
stackexchange_codegolf
Inspired by my geography class, Sandboxed Simulate weathering / erosion. Input Input will be given as a string of any 2 characters (or see below) you like in the shape of the rock (here i use spaces and hashes): ### #### ##### ####### ####### ######## Or if your language doesn't support strings, a square matrix ...
stackexchange_codegolf
Related: Name the poker hand A straight flush is a poker hand containing five cards of sequential rank, all of the same suit. As part of a straight flush, an ace can rank either above a king or below a two. An ace can rank either high (e.g. A♥ K♥ Q♥ J♥ 10♥ is an ace-high straight flush) or low (e.g. 5♦ 4♦ 3♦ 2♦ A♦ is ...
stackexchange_codegolf
What general tips do you have for golfing in BQN? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to BQN (e.g. "remove comments" is not an answer). Please post one tip per answer. At the moment of writing, the official BQN site is the most comprehensive res...
stackexchange_codegolf
Everyone knows the Fibonacci sequence: You take a square, attach an equal square to it, then repeatedly attach a square whose side length is equal to the largest side length of the resulting rectangle. The result is a beautiful spiral of squares whose sequence of numbers is the Fibonacci sequence: But, what if we didn...
stackexchange_codegolf
The flick input method is a way of inputting Japanese kana on a modern smartphone. It is arranged in a 12-key layout, with the following labels: あかさ たなは まやら 小わ、 When a key is tapped, it produces its respective kana. However, when the key is flicked in one of the four cardinal directions (up, down, left, right) it prod...
stackexchange_codegolf
Take a square matrix containing positive integers as input, and calculate the "rotated sum" of the matrix. Rotated sum: Take the sum of the original matrix and the same matrix rotated 90, 180 and 270 degrees. Suppose the matrix is: 2 5 8 3 12 8 6 6 10 then the rotated sum will be: 2 5 8 8 ...
stackexchange_codegolf
Seven countries lay official claims to parts of Antarctica: Argentina, Australia, Chile, France, New Zealand, Norway, and the United Kingdom. We will focus only on the claims of the main Antarctic landmass south of 60° S, which are: Chile: between 90° W and 53° W United Kingdom: between 80° W and 20° W Argentina: betw...
stackexchange_codegolf
Sandbox Post Intro The information panels are everywhere. When the technology became cheaper, the paper posters were transformed into luminous signs that show words that appear on one side and come out on the other, like the one on the figure: When one of these signs starts up, it usually starts empty and the text lea...
stackexchange_codegolf
Vyxal is a golfing language that has 500+ different commands (achieved through overloads), and is a known beater of Jelly, 05AB1E and most golfing languages. Henceforth, it seems like a good idea to share some of the tips and tricks of the industry used to get terse programs in Vyxal. One tip per answer, and no stupid ...
stackexchange_codegolf