instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Not to be confused with Is my OS 32-bit or 64-bit. This one is very simple, tell me whether or not my CPU supports 64-bit instructions. If my CPU supports 32-bit instructions, print '32', if my CPU supports 64 bit instructions, print '64', if my processor naitively supports other lengths of instructions, print 'other'....
stackexchange_codegolf
At the Code-Golf™ Psychological Society, you are delighted to present a new method of measuring mental age: Abstract Capacity™. To get the Abstract Capacity of a person, you take their actual age divided by 4, take their IQ divided by 9, then add the two values together. Then, round this sum down to find the Abstract C...
stackexchange_codegolf
This is the robbers' challenge. To post a cop, go here. In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into the interpreter, trans...
stackexchange_codegolf
In the Bitcoin protocol, 2016 is a very special number. The "difficulty" of finding a hash to create a new block is adjusted every 2,016 blocks to approximate changing once every two weeks. This number was chosen is because the difficulty adjusts itself so that every block takes about 10 minutes to be found, and in two...
stackexchange_codegolf
I got the following question at a test: Write a function f with the following type a -> b -> (a -> b). a and b should not be bound in any sense, the shorter the code, the better. I came up with f a b = \x -> snd ([a,x],b). Can you find something tinier? Currently the winner is: f _=(.f).const
stackexchange_codegolf
Inspired by Display a chain of little mountains with an odd number on the top of it! by @sygmei. Why have a chain of mountains when you can have one massive one? Make a program that takes an input number and prints a mountain with every odd number up to the input number. (Where "south west" means directly below and to ...
stackexchange_codegolf
Objective: Code two programs where each of the programs outputs both source codes interlaced per character like a zipper, a Double-slit Quine. The output from a Double-slit Quine is starting with the first character from the source code of the first program. If the source code of one of the programs is shorter i...
stackexchange_codegolf
You're a plumber working on a house, and there's some pipes that must be connected at weird angles. You have 8°, 11.25°, 22.5°, 45°, and 90° fittings at your disposal, and you want to use as few as possible to match the angle as closely as possible. Goal Match the desired angle as closely as possible, with as few fitt...
stackexchange_codegolf
What are some tips on how to shorten this code even further? The code is meant to compute the parallel resistance of an electric circuit. Using scanf float r;main(){float a;scanf("%f",&a);r+=1/a;printf("%f",1/r);main();} Using command-line arguments #include<stdlib.h> float r;main(c,v)char**v;{for(int i=1;i<c;)r+=1/at...
stackexchange_codegolf
BrainFlow What is BrainFlow? BrainFlow is an extension of BrainF**k (BFk) with 3 additional commands for added functionality and confusion. What commands? In addition to the normal BFk commands, we also have: ^ Jumps to the cell # depending on the value in the cell. Ex: If we are at cell # 0 with a value of 4, ^ wil...
stackexchange_codegolf
I have a hardware that has a 32-bit input register. The register has the following characteristics: The 32-bit register consists of eight 4-bit fields. Each 4-bit field holds a value in signed-magnitude; it can hold an integer between -7 and +7 inclusive, including -0 and +0 (signed zeroes). For example, the hexadeci...
stackexchange_codegolf
There is a site called "Return True to Win" with interesting tasks for Javascript programmers. The goal is to find arguments to a given function that force it to return true. The following is one of the tasks: function total(x) { return (x < x) && (x == x) && (x > x); } The users must find snippets for the value of ...
stackexchange_codegolf
Euler's totient function, \$\varphi(n)\$, counts the number of integers \$1 \le k \le n\$ such that \$\gcd(k, n) = 1\$. For example, \$\varphi(9) = 6\$ as \$1,2,4,5,7,8\$ are all coprime to \$9\$. However, \$\varphi(n)\$ is not injective, meaning that there are distinct integers \$m, n\$ such that \$\varphi(m) = \varph...
stackexchange_codegolf
You are a Computer Science professor teaching the C programming language. One principle you seek to impart to the students is modularity. Unfortunately, past classes have tended not to get the message, submitting assignments with the entire program inside main(). Therefore, for this semester you have issued strict modu...
stackexchange_codegolf
Background In most reasonable programming languages, it's very easy to rotate the rows or columns of a 2D array. In this challenge, your task is to rotate the anti-diagonals instead. Recall that the anti-diagonals of a 2D array are its 1D slices taken in the northeast direction ↗. Input A non-empty rectangular 2D array...
stackexchange_codegolf
Inspired by this challenge, which got closed. This is meant to be an easier, but no less interesting version of that. This is the cops thread of a cops-and-robbers challenge. For the robbers thread, see here. Cops will provide a program/function and a flag. Robbers will try to guess a password such that, when the passw...
stackexchange_codegolf
Knight is the Language of the Month for August 2022, and I noticed that it didn't have a tips page, so here it is! I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Knight (e.g. "remove comments" is not an answer). Please post only one tip per answer.
stackexchange_codegolf
Introduction This challenge was originally the "Among Us" challenge in the "Misc" category of YASCON CTF 2020. (The link includes an answer to that challenge. Click at your own risk.) You're given a lot of files, 1 of which is different from every other files. Your job is to find that 1 different file. Challenge Input...
stackexchange_codegolf
Create a function which takes in a input integer and then returns the number of factors it has, like if you pass 25 then it will return 3 since it has 3 factors i.e. 1,5,25. Challenge: Make the fastest and the smallest code!
stackexchange_codegolf
Alternate name: ChessMoveQ Given a list of up to 32 elements, each consisting of 4 elements, and a second list with 4 elements, determine whether the move detailed in the second input is a valid chess move. The first list indicates the position of all 32 pieces on the board. Each element will follow the structure <colo...
stackexchange_codegolf
Load an image into this stack snippet and move your mouse over it. A black curve that follows the hue angle, starting at your cursor point, will be drawn: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><style>canvas{border:1px solid black;}</style>Load an image: <input type='f...
stackexchange_codegolf
You and your friend want to send each other secret messages. However, because you are conspiracy theorists and think that the government has a quantum computer that can crack any standard encryption. Therefore, you are inventing one of your own. The first step of this is as follows: taking an input string, you check...
stackexchange_codegolf
Create a program or function to unjumble a 9x9x9 cube of digits by rotating individual 3x3 cubes within it. This is similar to (but, I suspect, a bit harder than) my Flippin' Squares question. Input Input will be a 9x9x9 cube. I'm not going to be as strict over the input as I was last time, 3d arrays are allowed, array...
stackexchange_codegolf
Draw lines between every pair of distinct points for n points arranged in a circle, producing something like the below result. Shortest code (in bytes) wins! Your lines don't have to be transparent, but it looks better that way. The output must be a vector graphic, or be an image at least 600 pixels by 600 pixels (eith...
stackexchange_codegolf
Halley's Comet is the only comet that may appear (i.e. become visible to the naked eye on Earth) twice in a human lifetime. The orbital period of Halley's Comet is not constant: it has varied between 75 to 79 Earth years since the first definite apparition was recorded in 240 BCE. This variability is mainly driven by g...
stackexchange_codegolf
An intriguing MathsSE question asked if there were large N-queens solutions where no three queens lie on a line. That question's body included the unique 4×4 solution up to symmetries . Q . . . . . Q Q . . . . . Q . and noted that there are no solutions for 5×5 to 7×7 because of knight lines. However, joriki over ther...
stackexchange_codegolf
Challenge Given the formula of a chemical, output the Mr of the compound. Equation Each element in the compound is followed by a number that denotes the number of said atom in the compound. If there isn't a number, there is only one of that atom in the compound. Some examples are: Ethanol (C2H6O) would be C2H6O where ...
stackexchange_codegolf
String Stairs Disclaimer: This is the first challenge I propose. Any and all feedback is welcome. If this is a duplicate, please point it out. Here's a link to the sandbox post. Goal The goal of this challenge is to, given a string and an integer, print the string into blocks of that integer's size. If a word has more ...
stackexchange_codegolf
Just over seven years ago, everybody suddenly stopped talking about the Maya people. It is time to rectify that! For clarification, I am talking about the Mesoamerican Long Count Calendar. Your program will have as input a date in the Gregorian Calendar, and as output the corresponding date from the aforementioned Meso...
stackexchange_codegolf
There's only one question for machine-language golfing, and it's for the ia32 and amd64 architectures. Here's one for a predecessor of them: the Zilog Z80! The ISA is available here. As usual, if your tip is only applicable to a certain environment/calling convention, please indicate that in your answer. Only one tip ...
stackexchange_codegolf
To "shift" over a number n places, do the following: Remove the last n digits Add n copies of the first digit to the beginning of the number For example, to shift the number 31415 three places, take out the last three digits to get 31, and then add three more copies of the first digit, 3, to the end, giving 33331. If...
stackexchange_codegolf
A listening party is an event where a bunch of people get together to listen to some music (like a viewing party, but for music). In the age of the internet you can do Listening Parties online with friends, where you just all hit play together. The problem is on the internet everyone is in different time-zones so you ...
stackexchange_codegolf
Let \$p(x)\$ be a polynomial. We say \$a\$ is a root of multiplicity \$k\$ of \$p(x)\$, if there is another polynomial \$s(x)\$ such that \$p(x)=s(x)(x-a)^k\$ and \$s(a)\ne0\$. For example, the polynomial \$p(x)=x^3+2x^2-7x+4=(x+4)(x-1)^2\$ has \$1\$ and \$-4\$ as roots. \$1\$ is a root of multiplicity \$2\$. \$-4\$ is...
stackexchange_codegolf
Given the following input: An integer n where n > 0. A string s where s is not empty and s~=[0-9A-Z]+ (alpha-numeric capitals only). Using a standard, simplified QWERTY keyboard (as shown below): 1234567890 QWERTYUIOP ASDFGHJKL ZXCVBNM Perform the following operation: Find the original row that each character is in...
stackexchange_codegolf
I have a colleague at work that works from home every Tuesday and Thursday. At around 8:00 AM he sends us a message with the following text: Hello today I'm working from home In order to relieve him from the burden of doing this every day he stays at home, we would like to automate this task for him. The challenge Wr...
stackexchange_codegolf
Background The Thousand Character Classic is a chinese poem written around the 4th Century CE in China, and memorized by large populations since then. The name comes from not only its length, but its number of characters: each character occurs only once in the text. It is commonly used to teach children chinese charact...
stackexchange_codegolf
Draw the parabolic trajectory of a thrown ball. The input is the ball's initial upward velocity, a positive integer v. Every second, the ball moves 1 space right and v spaces vertically, and then v decreases by 1 to due to gravity. So, the upward velocity eventually steps down from v to 0 and down to -v, finally falli...
stackexchange_codegolf
Goal Write a program or function that returns the day of the week for a date, eg. 01/06/2020 -> Mon However, it's unknown if the date is in the format mm/dd/yyyy or dd/mm/yyyy. If you can be certain of the day of the week, return it. If there is uncertainty, return an error. 02/07/2020 -> Err (Thu? Fri?) Input...
stackexchange_codegolf
My boss* does not understand why her programmers react negatively to users changing program requirements. Help her understand! On every answer, create a new requirement. Then, write a program/function that solves that requirement and all prior requirements, while in a new programming language. Examples User 1 posts the...
stackexchange_codegolf
Write a program or function that takes in three positive integers, W, H, and N. Print or return a W×H grid of .'s where every Nth . in normal English reading order is replaced with an X. For example, given W = 7, H = 3, N = 3, the grid is 7 characters wide and 3 high, and every third character reading from the top left...
stackexchange_codegolf
Given a string that represents a bunch of tables stacked on top of each other and/or arranged side-by-side, disassemble all the tables. Tables A table looks like this: ------- | | | | More formally, a table has a tabletop, composed of n dashes, and two visible legs. (Obviously, there are two hidden behind, but...
stackexchange_codegolf
In Java/.NET/C/JavaScript/etc. you can use ternary-ifs to shorten if-statements. For example (in Java): // there is a String `s` and an int `i` if(i<0)s="Neg";else if(i>0)s="Pos";else s="Neut"; Can be shortened with a ternary-if to: s=i<0?"Neg":i>0?"Pos":"Neut"; Challenge: Input: A regular if-else (possible with nes...
stackexchange_codegolf
Given a string, replace all left-double-quotes into two backticks and all right-double-quotes into two single-quotes. Left-quotes means the quotes that starts a quote. Right-quotes means the quotes that ends a quote. Quotes cannot be nested. You may assume that there are an even number of double-quotes in the string. E...
stackexchange_codegolf
Lets say your job is to paint poles, and a client asks you to paint a pole with 4 red sections and 3 yellow sections. You can do that pretty easily as follows: r y r y r y r With just yellow and red stripes. Now lets say your client asks you to paint a pole with 2 red sections, 2 yellow sections, and 1 green section...
stackexchange_codegolf
Introduction We all love StackExchange, therefore it would be essential to download all gems hidden on Stack Overflow repositories in the simplest possible way. Challenge/Task Your task is to write a script or program which would: Fetch the list of all (within current page) repositories under Stack Overflow GitHub acc...
stackexchange_codegolf
Given a positive integer (0 and above, no maximum), convert it into a grade following these rules: A = 100+ B = 90 - 99 C = 80 - 89 D = 70 - 79 E = 60 - 69 F = 59 and less. This felt a little boring, so make the grade a + if it's 7,8 or 9 and a - if it's 0,1 or 2. Ignore this for the F and A cases. An exampl...
stackexchange_codegolf
Let's define f(n) as the maximal number of regions obtained by joining n points around a circle by straight lines. For example, two points would split the circle into two pieces, three into four, like this: Make sure when you are drawing the lines, you don't have an intersection of more than two lines. Your task Given...
stackexchange_codegolf
It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words! Walking words Walking words are words which will respond to certain characters. For the purpose of this challenge the trigger characters are [u, d, r, l] from up down right left. Whenever you encounter su...
stackexchange_codegolf
In this question I asked you to guess an anagram quine based on its output. However it looks like we don't have a question asking to golf an anagram quine yet. So your task will be to make the shortest anagram quine that you can. What is an anagram quine? An anagram quine is a non empty program that prints an anagram...
stackexchange_codegolf
Why was 6 afraid of 7? Because 7 8 9! Given a string apply the following transformations: If there is a 6 next to a 7 remove the 6 (6 is afraid of 7) If the sequence "789" appears remove the 8 and the 9 (7 ate 9) (If I'm not mistaken it doesn't matter what order you do the transformations in) Keep applying these tran...
stackexchange_codegolf
Input: A list of integers (which will never contain a zero) Output: A list of the same size with counts based on the following: If the current item is negative: Look at all items before this item, and count how many times the digits occurred in those other numbers If the current item is positive instead: Look at all i...
stackexchange_codegolf
This question wants you to golf batch programms. In Batch you can use set x=averylongbatchcommand %x% arg1 which expands to set x=averylongbatchcommand averylongbatchcommand arg1 Your task is it to expand these statements. As you can also use set for arithmetic purposes like this: set x = 0 set /a x= %x%+1 you sho...
stackexchange_codegolf
Context Consider square matrices with n columns and rows containing the first n^2 (i.e. n squared) positive integers, where n is odd. The elements of the matrices are arranged such that the integers 1 through n^2 are placed sequentially in a counterclockwise spiral starting at the center and initially moving to the lef...
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'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
There have been a couple of challenges involving doubling source code: here and here. The task we have here is a bit harder, but should be doable in almost every language. In this challenge, you will take in an arbitrary positive integer. Your program must output that integer doubled. When your source code is doubled, ...
stackexchange_codegolf
It is only Tuesday, ugh. I deserve a treat. Golf me a Castle. The Least amount of bytes wins! Taken no input and output this image exactly: /\ /\ / \ / \ ---- ---- | |^^^^^^^^^| | ----------------- | _ | | | | | | | | | | | Edit Build me a brick wall! 36 votes...
stackexchange_codegolf
Your challenge is to compute the Lambert W function. \$W(x)\$ is defined to be the real value(s) \$y\$ such that $$y = W(x) \text{ if } x = ye^y$$ where \$e = 2.718281828...\$ is Euler's number. Sometimes, \$y\$ may not be real. Examples W(-1) = non-real W(-0.1) = -0.11183, -3.57715 W(1) = 0.56714 W(2) = 0.85261 Here'...
stackexchange_codegolf
For this challenge, you are to output the result of the sum of some numbers. What are these numbers? Well, you are given input, (a, b), which are integers (positive, negative, or zero) , a != b, and a < b , and each integer within a and b (including them) will have exponents according to the Fibonacci numbers. That's c...
stackexchange_codegolf
Background This is the first part of a 3-hole golf course on text processing. The over-arching idea is that if you take an input text and pipe it through the solutions to all three challenges (with a small amount of glue code), it will spit out a beautifully formatted paragraph. In this first challenge, your task is a ...
stackexchange_codegolf
Let's assume that $$ f(x) = \frac{Ax+B}{Cx+D} $$ Where, \$x\$ is a variable and \$A\$,\$B\$,\$C\$,\$D\$ are constants. Now we have to find out the inverse function of \$f(x)\$, mathematically \$f^{-1}(x)\$, To do this first we assume, $$ y = f(x) \\\rightarrow y=\frac{Ax+B}{Cx+D} \\\rightarrow Cxy+Dy=Ax+B \\\rightarrow...
stackexchange_codegolf
Problem: Given a string representing a mathematical expression with constants (pi, e, psi, i), basic arithmetic operations (+, -, *, /), parentheses, fractions, and exponentiation, write a program or function to convert a string to its equivalent LaTeX code. The input string will only contain digits, arithmetic operato...
stackexchange_codegolf
In the description of this challenge, the following board will be used as a reference for positions: ABC DEF GHI For instance, in a game of ordinary tic-tac-toe, B E A C G D F H I describes the following: -X- -X- XX- XXO XXO XXO XXO XXO XXO --- -O- -O- -O- -O- OO- OOX OOX OOX --- --- ...
stackexchange_codegolf
Your challenge is to take some source code as input, and output which programming language it is written in. For example, you could have the input class A{public static void main(String[]a){System.out.println("Hello, World!");}} And output Java Your two main goals are diversity (how many programming languages you can...
stackexchange_codegolf
This is the cops' thread. See the robbers' thread here. In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the robbers will try to come up with their algorithm. The catch is, the 'algorithm' must be a single closed-form mathematical e...
stackexchange_codegolf
Power Grid Resource Costs Introduction In the board game Power Grid, an integral part of the game is the act of buying resources to fuel your power stations. There are four types of resource used in the game (five, if you include renewable energy, but obviously you can't buy resources for that). These are Coal, Oil, Ga...
stackexchange_codegolf
Given a sequence of integers and an integer N, output the number of contiguous subsequences that contain at least N distinct integers. Each integer in the sequence is non-negative and will not be larger than the size of the sequence. For example, with the sequence 1,2,2,3 and N=2, there are 5 contiguous subsequences t...
stackexchange_codegolf
Given a constructible point \$(x, y) \in \mathbb R^2\$, output the steps required to construct \$(x, y)\$ Constructing a point Consider the following "construction" of a point \$(\alpha, \beta)\$ in the Cartesian plane: Begin with the points \$(0, 0)\$ and \$(1, 0)\$. Then, more points can be added by performing a fini...
stackexchange_codegolf
Introduction In chess, Knights can move two squares in one direction, and then one square in an orthogonal direction. On an x/y plane, these can be thought of as being a relative change of coordinates, such as (+1, -2). Challenge Your task is to output all 8 possible moves as pairs of relative x/y coordinates, in any o...
stackexchange_codegolf
Given an xxd hexdump such as this one: 00000000: 1f8b 0808 4920 2258 0003 7069 6c6c 6f77 ....I "X..pillow 00000010: 2e74 7874 00d3 d707 8218 10d0 2799 c545 .txt........'..E 00000020: ba96 41a1 994c 7d60 d650 d53c 44a3 8a22 ..A..L}`.P.<D.." 00000030: cd43 34aa 28d2 3c44 a38a 22cd 4334 aa28 .C4.(.<D..".C4.( 00000040:...
stackexchange_codegolf
I've enjoyed reading this site; this is my first question. Edits are welcome. Given positive integers \$n\$ and \$m\$, compute all ordered partitions of \$m\$ into exactly \$n\$ positive integer parts, and print them delimited by commas and newlines. Any order is fine, but each partition must appear exactly once. For e...
stackexchange_codegolf
This challenge is about converting 2D mazes into 1D mazes. Overview +-+-+-+-+-+-+ +-+-+-+-+-+-+ graph { | | | | |A| | B| A B A -- D + + + + +-+-+ + + + + +-+-+ \ | C -- D | | | | | | | | \ | D -- E +-+-+ +-+-+ + +-+-+...
stackexchange_codegolf
Introduction To draw a Fibonacci series of square, you start by drawing a one-unit square: _ |_| Then another one to the left: _ _ |_|_| Then a two-unit one on top: _ _ | | |_ _| |_|_| Then a three-unit one on the right: _ _ _ _ _ | | | |_ _| | |_|_|_ _ _| Then a five-unit one on the bottom: _ _ _ ...
stackexchange_codegolf
Output/print this block of text: 1234567890 2468013579 3691470258 4815926037 5049382716 6172839405 7306295184 8520741963 9753108642 0987654321 Acceptable formats include: Trailing newlines/whitespace List of strings List of lists of characters List of lists of integers However, list of integers is not acceptable bec...
stackexchange_codegolf
The goal of this challenge is to compare how well different programming languages support functional programming, by seeing how much code it takes to implement BLC8, the simplest functional programming language BLC8 is the bytewise variant of Binary Lambda Calculus, as described in my 2012 IOCCC entry at https://www.io...
stackexchange_codegolf
Background An Eisenstein integer is a complex number of the form \$ z = a + b\omega \$ where \$a, b\$ are integers and \$\omega\$ is the third root of unity \$\frac{1-\sqrt3i}{2}\$. The Eisenstein integers can be viewed as the triangular lattice points, as shown in the image below (from Wikipedia): Following the trian...
stackexchange_codegolf
Create a program that, given a name as input, will generate a Valentine’s day greeting card featuring that name, with its source code also having a Valentine’s day theme. The greeting can be either ASCII art or a generated picture. Additional conditions: The source code has to look like something Valentine's day theme...
stackexchange_codegolf
A long period prime is a prime number \$p\$ such that decimal expansion of \$1/p\$ has period of length \$(p-1)\$. Your task is to output this number sequence. For purposes of this challenge we will consider only odd primes. Period of a decimal expansion of a rational number is the smallest period \$k\$ that makes the ...
stackexchange_codegolf
You have to write an interpreter for a cool language called Chicken! You should read a Chicken program from a file, standard input, program or function arguments, or whatever is most convenient for your language, as well as input to the program. You should print or return the result of interpreting the program accordi...
stackexchange_codegolf
Intro (semi fictional) I'm the solo developer of a game, I'm already struggling with character design as is. Hence I've thought of a smart solution, I'll just use images for regular monsters, outline them a bit and suddenly they are boss monsters! That will save me from thinking up new bosses yay. However, I have appro...
stackexchange_codegolf
Introduction I would like to drawn a nice spinner by using eight braille patterns on two lines, drawing a square of 8x8 pixel, for showing a kind of snake growing and reducing: declare -a shapes=([0]=$'\E[A⠁⠀⠀⠀\E[B\E[4D⠀⠀⠀⠀' [1]=$'\E[A⠈⠀⠀⠀\E[B\E[4D⠀⠀⠀⠀' [2]=$'\E[A⠀⠁⠀⠀\E[B\E[4D⠀⠀⠀⠀' [3]=$'\E[A⠀⠈⠀⠀\E[B\E[4D⠀⠀⠀⠀' [4]=$'\E...
stackexchange_codegolf
You are a historian studying a long forgotten language. You have just discovered a clay tablet which seems to list all known words in the language, in alphabetical order. Your task is to find this alphabet's order, if it exists. The Task Given an ordered list of words, try to output an ordered list of characters such t...
stackexchange_codegolf
I know, I know, yet another primes challenge... Related A lonely (or isolated) prime is a prime number p such that p-2, p+2, p-4, p+4 ... p-2k, p+2k for some k are all composite. We call such a prime a kth-times-isolated prime. For example, a 5th-times-isolated prime is 211, since all of 201, 203, 205, 207, 209, 213, 2...
stackexchange_codegolf
To quote http://brainfuck.org/utm.b: A tag-system transforms strings over an alphabet A = {a[1], a[2], ... a[n], a[n+1]} as follows: a positive integer m is chosen, and so is a function P that maps each a[i] for 1<=i<=n to a string P(a[i]) over the alphabet A. Now: if the string being transformed has fewer than m ele...
stackexchange_codegolf
The challenge Well, I think it is quite clear, isn't it? You have to make a function or a program that takes a string as an argument and outputs the corrispondent Yoda-speaking. This is code-golf, so least number of bytes wins. The input The input could be any string without linefeed. You can translate a string if it i...
stackexchange_codegolf
Objective Given a nonnegative integer, calculate its NDos-size as defined below, and output it. NDos' numeral system The concept of NDos-size comes from the numeral system I made. It represents every nonnegative integer by a nested list, as follows: With the binary expansion of given nonnegative integer, each entry of...
stackexchange_codegolf
I encountered some silly code from a game and I figured this would actually turn into a fun golfing problem, so: Given any ASCII string in the limited char range specified below. Append as few characters as possible such that, given: i = 1 sum = 0 for char in string sum += char.intval * i++ end for sum % 1000 == 0 W...
stackexchange_codegolf
I think is about time to do another Pokemon challenge! Even if Pokémon Go is not as mainstream as it used to be... The task. Just draw a MISSINGNO. MISSINGNO is an unofficial Pokémon species found in the video games Pokémon Red and Blue. IGN has noted MISSINGNO appearance in Pokémon Red and Blue as one of the most fam...
stackexchange_codegolf
Input: Two strings without newlines or whitespaces. Output: Both input strings on separate lines, with spaces where necessary† for one of the two strings. And a third line with the characters A, R, M and , representing added, removed, modified, and unchanged. † We add spaces to either the top or bottom input string (if...
stackexchange_codegolf
Santa's Shortest Path Problem Trying to be as time-efficient as possible Santa needs to plan his trips carefully. Given a 5X5 grid representing a map of villages it is your task to be Santa's flight controller. Show santa the shortest and therefor fastest route to fly his sleigh and give him a list of coördinates (or d...
stackexchange_codegolf
Part of Advent of Code Golf 2021 event. See the linked meta post for details. The story continues from AoC2015 Day 5, Part 2. Santa needs help figuring out which strings in his text file are naughty or nice. He has already tried two sets of rules, but they're totally ad-hoc, cumbersome, and janky, so he comes up with ...
stackexchange_codegolf
It's one of these again :D Your task, if you wish to accept it, is to write a program/function (without any uppercase letters) that outputs/returns its string input/argument. The tricky part is that if I convert your source code to uppercase, the output must be reversed. For simplicity, you can assume that the input is...
stackexchange_codegolf
On 4chan, a popular game is get. Every post on the site gets a sequential post ID. Since you can't influence or determine them, people try to guess (at least a part of) their own post number, usually the first few digits. Another version of the game is called dubs, and it's goal is to get repeating digits at the end of...
stackexchange_codegolf
Write the shortest program that waits for every key of a Standard 101 key US Keyboard* to be pressed and then exits writing OK! Every time a key is pressed the program displays on a new line the remaining number of unpressed unique keys that need to be pressed until all key are pressed at least once. The program should...
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
Executive summary Given input k, find a partition of integers 1 to n into k sum-free subsets for the largest n you can within 10 minutes. Background: Schur numbers A set A is sum-free if its self-sum A + A = { x + y | x, y in A} has no elements in common with it. For every positive integer k there is a largest integer ...
stackexchange_codegolf
In Imperial China, ranks in society were not decided by birth or wealth, but by a person's ability to excel in the Imperial Examinations. The Jade Emperor, divine ruler of the Heavens, has called for all his subjects to be examined to determine their worth, and whom to next give the Divine Mandate to rule China. Rules ...
stackexchange_codegolf
The purpose of this challenge is to graphically depict a walk on the plane, where the direction of each step \$k\$ is determined by the primality of \$k\$ and the parity of its binary expansion. Specifically, Initial direction is fixed, say North. All steps have the same length. The direction of step \$k\$ can be Nort...
stackexchange_codegolf
Challenge Write a program P, taking no input, such that the proposition “the execution of P eventually terminates” is independent of Peano arithmetic. Formal rules (In case you are a mathematical logician who thinks the above description is too informal.) One can, in principle, convert some Universal Turing machine U (...
stackexchange_codegolf
Your task is "simple" should you choose to accept it. Write an HQ9+ compiler in a language of your choice. HQ9+ has four commands (as you may be able to tell) H prints "Hello, World!" Q prints out the source code (this can either be the compiled source or HQ9+ source for the purpose of this challenge),9 prints out the...
stackexchange_codegolf