instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Background The special linear group \$ SL_2(\mathbb{Z}) \$ is a multiplicative group of \$ 2 \times 2 \$ matrices whose elements are integers and determinant is 1. It is known that every member of \$ SL_2(\mathbb{Z}) \$ is a product of some sequence of the following two matrices \$ S \$ and \$ T \$ (reference pdf): $$ ...
stackexchange_codegolf
You will need to evaluate the definite integral (bounded by \$a\$ and \$b\$) of a certain polynomial function that takes the form of: $$\int_a^b \left( k_n x^n + k_{n-1} x^{n-1} + \cdots + k_2x^2 + k_1x + k_0 \: \right) dx$$ Normally, this can be done using the fundamental theorem of calculus and power rules. For examp...
stackexchange_codegolf
Someone I know has no coding experience, but has proposed an algorithm* to determine the character limit of text fields they find online. They copy a string containing the numbers from 1 to 1,000 inclusive, not separated in any way, and they read the last few digits it displays. For example, after pasting, they might s...
stackexchange_codegolf
Introduction Given a set of text-based "screenshots" consisting of printable ASCII chars merge them so that all of them form one long screenshot so that nobody has to do it themselves when reading it. Challenge Take input as a list of strings (referred to as "screenshots"). Each screenshot consists of several lines of ...
stackexchange_codegolf
Write a program that takes a single line string that you can assume will only contain the characters /\_‾. (That's forward and backward slash, underline and overline. You can use ~ in place of overline if you need since overline is not convenient ASCII.) For example, one possible input is: __/‾‾\/\_/‾ Your program nee...
stackexchange_codegolf
Whilst trying to golf several of my answers, I've needed to write large integers in as few characters as possible. Now I know the best way to do that: I'll be getting you to be writing this program. The challenge Write a program that when given a positive integer, outputs a program that prints it to stdout or equivale...
stackexchange_codegolf
A matrix can be thought of as the altitudes of a surface in 3D space. Consider the 8 neighbours (orthogonal and diagonal) of a cell as a cyclic sequence in clockwise (or anticlockwise) order. Some neighbours may be higher than the original cell, some lower, and some levelled at the same height as the original cell. We ...
stackexchange_codegolf
With the recent Python bashing, here's an attempt to show Python's strengths. Your challenge is to write a program that calculates the factorial of as high a number n as possible within 10 seconds. Your score will be (highest n for your program on your machine)/(highest n for my program on your machine) Rules You must...
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
Oof! You've been coding the whole day and you even had no time for Stack Exchange! Now, you just want to rest and answer some questions. You have T minutes of free time. You enter the site and see N new questions. To write an answer for each you'll need ti minutes. Of course, as a dedicated reputation gatherer, you wa...
stackexchange_codegolf
It seems that many people would like to have this, so it's now a sequel to this challenge! Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n is a natural number. Task: Given a prime power pn > 1, return the power n. Testcases: input output 9 2 16 4 343 ...
stackexchange_codegolf
The Challenge Given an integer n>0 output a n+1 X n+1 matrix containing all integers from 1 to 2n as shown in the test cases bellow Test Cases n=1 1 2 2 2 n=2 1 2 4 2 3 4 4 4 4 n=5 1 2 3 4 5 10 2 3 4 5 6 10 3 4 5 6 7 10 4 5 6 7 8 10 5 6 7...
stackexchange_codegolf
Blackjack, also known as twenty-one, is a comparing card game between yourself and a dealer, where each player in turn competes against the dealer, but players do not play against each other. Play goes as follows, the dealer deals you a card. The dealer then deals them-self a card, face down. The dealer then deals yo...
stackexchange_codegolf
There are many generalizations of Conway's Game of Life. One of them is the isotropic non-totalistic rulespace, in which the state of a cell in the next generation depends not just on its state and the amount of alive cells around it, but also the relative positions of the cells around it. Given an rulestring correspon...
stackexchange_codegolf
About Hangul As I'm Korean, I'm really proud of Korean character, Hangul(한글). Hangul is a syllabary invented by King Sejong the great, 4th king of Joseon dynasty, in 1443. Because today (October 9th) is Hangul day in Korea, I'll give you a challenge: Make some Hangul ascii-art List of characters So, To make ASCII art, ...
stackexchange_codegolf
It turns out that my toaster is a tad broken. It lost WiFi (You know, it's one of those newfangled smart toasters), and its been going bonkers! Since it no longer works, I've been having to hack into my breakfast's source code and run Plate.bread.toastAs(3); every morning. Will you help? My toaster takes one input: the...
stackexchange_codegolf
The cops thread can be found here: The Mystery String Printer (Cops) Your challenge Choose a submission from the cops thread, and print out the string from an answer in that thread. The submission that you choose must not be safe (it must be newer than 7 days). Your program, function, or REPL script needs to follow th...
stackexchange_codegolf
Task Write a program/function that, given three integers n,a,b prints a regular expression which matches all of the base-n integers from a to b (and no integers outside of that range). Your algorithm should, in theory, work for arbitrarily large integers. In practice, you may assume that the input can be stored in your...
stackexchange_codegolf
Siteswap is a notation for juggling patterns. The other siteswap puzzle is great and it explains siteswap in greater detail than here. This puzzle is meant to be a bit simpler! Numberphile recently interviewed Colin Wright which helped develop the notation. The part at ~16min will be useful for this challenge. Another ...
stackexchange_codegolf
It's 2050, and people have decided to write numbers in a new way. They want less to memorize, and number to be able to be written quicker. For every place value(ones, tens, hundreds, etc.) the number is written with the number in that place, a hyphen, and the place value name. "zero" and it's place value does not need ...
stackexchange_codegolf
Given two sets of strings, \$ D \$ and \$ R \$, find the shortest string which contains every string in \$ D \$, but contains none of the strings in \$ R \$. There are almost always multiple possible outputs; you should output at least one of them, but you can output more. You can assume this is possible with the input...
stackexchange_codegolf
You probably know Conway's Game of Life, the famous cellular automaton invented by mathematician John Conway. Life is a set of rules that, together, allow you to simulate a two-dimensional board of cells. The rules decide which cells on the board live and which ones die. With some imagination, you could say that Life ...
stackexchange_codegolf
Who are they? Primus-Orderus Primes (POP) are primes which contain their order in the sequence of primes. So the nth prime, in order to be POP, must contain all the digits of n in a certain way which I'll explain. Examples Let's get things clearer: All digits of n must appear among the digits of POP in the same order t...
stackexchange_codegolf
What general tips do you have for golfing in Octave? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Octave (e.g. "remove comments" is not an answer). Please post one tip per answer.
stackexchange_codegolf
Ex :- Input: n = 12, k = 5 Output: ans = 2 Sorted list S: ["1", "10", "11", "12", "2", "3", "4", "5", ...., "9"] ans = 2
stackexchange_codegolf
How well do you know the site? Let's find out. This is a cops-and-robbers challenge. Robber's thread. As a cop, you need to: Find a non-deleted, non-closed challenge on this site to answer. The challenge cannot have the following tags: cops-and-robbers, popularity-contest, code-trolling, underhanded, busy-beaver, k...
stackexchange_codegolf
Moderator note: https://strawpoll.me has officially shut down, and the linked API no longer appears to work or provide data. Therefore, new answers cannot actually do the task and so the challenge has been closed to prevent any new answers. Strawpolls are great, and we use them in chat all the time for getting opinio...
stackexchange_codegolf
Context Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. This is the basic skeleton almost everyone follows. Task Your task, should you choose to accept it, is to write a program/f...
stackexchange_codegolf
You met a 4-th dimensional being who challenged you to a game of dice. The rules are simple: each player rolls 3 6-sided dice and takes the sum of each combination of 2 dice. The player with the highest sum wins. If the first-highest sum is a tie, consider the second-highest sum, and so on. Your opponent's dice look no...
stackexchange_codegolf
Consider the infinite string of all nonnegative decimal integers concatenated together in order (akin to Champernowne's constant): 0123456789101112131415161718192021222324252627282930...979899100101102103... Write a program or function that takes in a nonnegative integer that indexes (0-based) into this infinite strin...
stackexchange_codegolf
Background There are self-extracting .ZIP files. Typically they have the extension .EXE (and by executing the file they will be extracted) but when renaming them to .ZIP, you can open the file with some ZIP extracting software. (This is possible because .EXE files require a certain header but .ZIP files require a certa...
stackexchange_codegolf
You have two values each of which is either 0 representing "unknown", or one of 1,2,3. Merge them into a single value as follows: If both values are nonzero and equal, output that value: (3,3) -> 3 If both values are nonzero but unequal, output 0 for unknown: (1,2) -> 0 If one value is zero and the other is not, outpu...
stackexchange_codegolf
Suppose you have a set of sets of integers. It's possible that some of the sets will overlap (i.e. sharing elements). You could get rid of the overlaps by deleting elements from the sets, but then some of them might end up empty; that would be a shame. Can we make all the sets disjoint without emptying any of them? Not...
stackexchange_codegolf
This was related to a program I am writing. Although the title is simple, the challenge is a lot more complicated. Your challenge You must write a program that takes an input, and your answer must match the sample outputs in this question. What the program should be is that you must output "HelloWorld" with the length ...
stackexchange_codegolf
Background For my code-golf submissions in C, I need a processing tool. Like in many other languages, whitespace is mostly irrelevant in C source (but not always!) -- still makes the code much more comprehensible for humans. A fully golfed C program that doesn't contain a single redundant whitespace often is barely rea...
stackexchange_codegolf
Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any character more than once across your snippets. Rules You may use the same character multiple times in one (and only one) sni...
stackexchange_codegolf
Your toy in this challenge is a special abacus of 4 rows and 8 positions per row. There's one bead on the first row, 2 beads on the 2nd row, 3 beads on the 3rd row and 4 beads on the 4th row. Beads on a same row are glued together, which means that they can only be moved as a block. Below is a valid configuration of th...
stackexchange_codegolf
Your task: Create a program that encrypts a string with another string using a key, using the vigenere cipher. What a vigenere cipher does Ciphertext: string Key: keya | | v v string keyake | v (18)(19)(17)(08)(13)(06) (10)(04)(24)(00)(10)(04) | v (28)(23)(41)(08)(23)(10) ...
stackexchange_codegolf
There was recently (a few years back) some buzz on programming websites about an implementation of Tetris in 140 Bytes. ... It turns out that although it is small, it is a simplified version of Tetris, and not even a complete implementation. Only the core logic function fits in 140 bytes of Javascript. To actually run ...
stackexchange_codegolf
Task Take input string separated by space. Sort the words alphabetically. Print them out vertically in 3 columns separated by space(s). Challenge All three column's heights should be as evenly weighted as possible. All three column's should be left aligned. This is code-golf, so shortest code wins! Example If the i...
stackexchange_codegolf
As an exercise, I've created a simple solution for this challenge, in x86 Assembly Language. I'm running this with FASM on Windows. Here's my source code: format PE console entry start include 'WIN32A.inc' section '.text' code executable start: push char ; Start at 'A' call [printf] ; ...
stackexchange_codegolf
Lost is a 2-Dimensional programming language where the instruction pointer starts at a random location, moving in a random direction. A description of the language can be found at the bottom of the post for completeness' sake and a tutorial for the language can be found in the above link. The task here is simple to de...
stackexchange_codegolf
Inspired by a now deleted StackOverflow question. Can you come up with a way to get a particular method executed, without explicitly calling it? The more indirect it is, the better. Here's what I mean, exactly (C used just for exemplification, all languages accepted): // Call this. void the_function(void) { printf...
stackexchange_codegolf
Your task is to build a function in any language that takes a message m, an encryption e, and a modulus k (all positive integers), and takes m to the power of e modulo k. Your solution must not be a theoretical one, but one that would work on a reasonable computer such as your own, for RSA keys of currently used sizes ...
stackexchange_codegolf
Before you leave, you do not have to understand much musical notation to do this challenge. EXPLANATION In standard sheet music, double clefs go across the page serving as reference points to the notes, letting you know what note should be played. If you are not already familiar with the treble and bass clef, here i...
stackexchange_codegolf
Unsurprisingly, fibonacci primes are primes that are also Fibonacci numbers. There are currently 34 known Fibonacci primes and an additional 15 probable Fibonacci primes. For the purpose of this challenge, the Fibonacci numbers are the sequence \$F_n\$ defined as \$F_1 = 1\$, \$F_2 = 1\$, and \$F_n = F_{n-1} + F_{n-2}\...
stackexchange_codegolf
Challenge Given two lists of strings where each string is of length 50 and each list is also of length 50 generate the shortest regex you can that fully matches all the strings in the first list and does not match any of the strings in the second list. Scoring Your score will be the average length of the regexes your p...
stackexchange_codegolf
The keypad on my office phone has the following layout: [1] [2] [3] /.@ ABC DEF [4] [5] [6] GHI JKL MNO [7] [8] [9] PQRS TUV WXYZ [*] [0] [#] + _ Task: Write a program that, given an input string, returns a list of instructions that my fingers need to follow in order the type/dial the message/number...
stackexchange_codegolf
Background This challenge is about Convolutional neural networks, and its two main building blocks, namely Convolutional layer and Pooling layer. For simplicity, we ignore the "depth" of the images and intermediate tensors, and just look at the width and height. Convolutional layer A convolutional layer works like a ke...
stackexchange_codegolf
Conways' Game of Life is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves according to rules indefinitely. Those rules are: Any live cell with 2 or 3 living neighbours (the 8 cells immediately around it) lives ...
stackexchange_codegolf
The flag of Bangladesh is very simple. It looks like below: The flag will be in bottle green (#006a4e) and rectangular in size in the proportion of length to width of 10:6, with a red circle in near middle. The red circle (#f42a41) will have a radius of one-fifth of the length of the flag. This image will help you to ...
stackexchange_codegolf
My dog is called Rex. Every time I scold him, he seems not very impressed and the only times I see him react is when I pronounce his name. If I say Rex, I told you not to do this! You're making me angry Rex! all he hears is Rex, * **** *** *** ** ** ****! ***'** ****** ** ***** Rex! The challenge : given an input str...
stackexchange_codegolf
Given a string containing only the characters -, |, + and newline determine the longest straight line contained in it. A straight line is either an uninterupted run of -s and +s in a single row or an uninterupted run of |s and +s in a single column. So for example: | | ---- | --+-- ...
stackexchange_codegolf
Weather conditions at airports are reported to pilots in METAR (METeorological Aerodrome Report) format. This format could be described as being "golfed." Here are some examples: METAR KPDX 241653Z 16003KT 1/4SM R10R/4500VP6000FT FG SCT000 01/M01 A3040 RMK AO2 SLP293 FG SCT000 T00061006 $ METAR PAMR 241753Z 00000KT 10...
stackexchange_codegolf
Sandbox Have y'all ever written an answer with unprintable ASCII characters in it and wished that there was an easy way to represent those characters in a printable way? Well, that's why the Control Pictures Unicode block was invented. However, manually substituting these characters into one's answer is time-consumin...
stackexchange_codegolf
Starting an the origin on an infinite grid, you follow a predetermined path going up (U), down (D), left (L), or right (R). You paint every square you visit, including the square you started at and the square you finish at. Using this method, we can paint the number six using the instructions RRDDLLUUUURR: The origin ...
stackexchange_codegolf
Here is a 1.2Mb ASCII text file containing the text of Herman Melville's Moby-Dick; or, The Whale. Your task is to write a program or function (or class, etc. -- see below) which will be given this file one character at a time, and at each step must guess the next character. This is code-challenge. Your score will be 2...
stackexchange_codegolf
You will be given a String consisting of printable ASCII (without newlines). Your task is to build a nice Stairway for my Castle. How to build a nice Stairway? First off, you should get all the rotations of the String. For example, the String abcd has the following rotations: abcd, bcda, cdab, dabc (each character is ...
stackexchange_codegolf
Given the coordinates of the upper left corners of two squares and their side lengths, determine whether the squares overlap. A square includes the top and left lines, but not the bottom and right lines. That is, a point (a,b) is inside a square with side length k that starts at (x,y) if and only if x <= a < x+k and y ...
stackexchange_codegolf
Given a list of strings s_0, s_1, ..., s_n find the shortest string S that contains each of s_0, s_1, ..., s_n as a substring. Examples: S('LOREM', 'DOLOR', 'SED', 'DO', 'MAGNA', 'AD', 'DOLORE')='SEDOLOREMAGNAD' S('ABCDE', 'BCD', 'C')='ABCDE' Write the shortest program (or function) that solves this problem. You can...
stackexchange_codegolf
Given a string containing only the characters -, |, + and newline determine the longest straight line contained in it. A straight line is either an uninterupted run of -s and +s in a single row or an uninterupted run of |s and +s in a single column. So for example: | | ---- | --+-- ...
stackexchange_codegolf
Make 2d ASCII buildings depending on what the input is. The submissions can either be a program that takes input, or a function that accepts input via its parameters. e.g. An input of 5,3,6 would output ┌──┐ │┌┐│ ┌──┐ │└┘│ │┌┐│ │┌┐│ │└┘│ │└┘│ │┌┐│ │┌┐│ │└┘│ ┌──┐ │└┘│ │┌┐│ │┌┐│ │┌...
stackexchange_codegolf
As the title says, your task is to print the largest string using the shortest code without taking any input value. Rules The program must take no input and print the largest string to STDOUT The string must contain only ASCII Characters. If you don't know the ASCII Characters, take a look at the table No Loops are a...
stackexchange_codegolf
I want to avoid responding to illegal or spoofed addresses. One type that's easy to detect is an address that should not exist on a packet received by my router: a special-use address. Challenge Given an IPv4 32-bit address, identify whether it is valid general-use address. Challenge rules Special-use addresses, as de...
stackexchange_codegolf
Introduction: Some times using a 24-hour clock are formatted in a nice pattern. For these patterns, we'll have four different categories: All the same (pattern A:AA or AA:AA): 0:00 1:11 2:22 3:33 4:44 5:55 11:11 22:22 Increasing (pattern B:CD or AB:CD, where D==C+1==B+2==A+3): 0:12 1:23 2:34 3:45 4:56 12:34...
stackexchange_codegolf
You have two values each of which is either 0 representing "unknown", or one of 1,2,3. Merge them into a single value as follows: If both values are nonzero and equal, output that value: (3,3) -> 3 If both values are nonzero but unequal, output 0 for unknown: (1,2) -> 0 If one value is zero and the other is not, outpu...
stackexchange_codegolf
Context From Wikipedia: A polyomino is a plane geometric figure formed by joining one or more equal squares edge to edge. one-sided polyominoes are distinct when none is a translation or rotation of another (pieces that cannot be flipped over). Translating or rotating a one-sided polyomino does not change its shape. In...
stackexchange_codegolf
Overview Shue (Simplified Thue) is a language that was designed by AnttiP for this challenge. A Shue program consists of the possible outputs and a list of string replacements. For example, the following program prints "yes" if an unary string is even: yes no 11=2 12=1 22=2 1=no 2=yes Try it online! The possible outpu...
stackexchange_codegolf
Your Task You will write a program or function to return a truthy value if the integer inputted to it is a square repdigit, and a falsy value if it is not. A repdigit is an integer that contains only one digit (e.g. 2, 44, 9999). For the purpose of this challenge, a square repdigit is a repdigit that is the square of...
stackexchange_codegolf
In the IRC protocol, raw messages look similar to this: command arg1 arg2 :arg3 with spaces :arg4 with spaces :arg5 In a shell environment (e.g. bash), that would be equivalent to: command arg1 arg2 "arg3 with spaces" "arg4 with spaces" arg5 The format specification is as follows: Raw messages will only contain prin...
stackexchange_codegolf
The matrix tornado is just like any other tornado: it consists of things rotating around a center. In this case, elements of the matrix instead of air. Here is an example of a matrix tornado: First we start by sectioning the matrix into square rings, each section consists of elements that are farther away from the bor...
stackexchange_codegolf
Recently, I created a binary word search that got me working with grids. It was fun, so I wanted to create some more similar content. Meet Pythagoras' Golfing grid: Each of d, e, f, g, h, i, j, k and T represent a numeric value. Now consider an orthogonal triangle along the lower diagonal of this grid (so the vertical...
stackexchange_codegolf
Challenge Given a positive-length string \$S\$, a divisor of \$S\$ is another (not necessarily distinct) string for which there exists a number \$a\$ such that when we repeat the divisor \$a\$ times, we get the string \$S\$. For example, the string abcd is a divisor of the string abcdabcd with \$a=2\$. Your challenge i...
stackexchange_codegolf
I struggle to easily encode big numbers in ><>. If only there was a program that could find the best way for me? What is ><> ><>, pronounced "fish", is a esoteric 2dimentional programing language. We will consider a subset here, consisting of the following commands: 0123456789 push one number to the stack, equal to th...
stackexchange_codegolf
Given a positive integer, we can form a new number that's described by its digits taken pairwise (with a leading 0 added for numbers with odd number of digits). For eg.: 1234 can be read as one 2, three 4s - so, the output for 1234 is 2444. 643 has an odd number of digits, so a leading zero is added to make it even....
stackexchange_codegolf
Background In Haskell and many other functional languages, function application f(x) is simply written as f x. Also, this form of function application is left-associative, which means f x y z is ((f x) y) z, or ((f(x))(y))(z). Haskell also has a binary operator called $. f $ x does function application just like f x, b...
stackexchange_codegolf
This is my first attempt at a Code Golf question. If it needs obvious edits, please feel free to make them. Below is a description of the basic Dropsort algorithm. Dropsort is run on a list of numbers by examining the numbers in sequence, beginning with the second number in the list. If the number being examined is l...
stackexchange_codegolf
Input The input is a single positive integer n Output The output isn with its most significant bit set to 0. Test Cases 1 -> 0 2 -> 0 10 -> 2 16 -> 0 100 -> 36 267 -> 11 350 -> 94 500 -> 244 For example: 350 in binary is 101011110. Setting its most significant bit (i.e. the leftmost 1 bit) to 0 turns it into 001011110...
stackexchange_codegolf
The task is simple. Write an interpreter for the language *. Here's a bigger link to the wiki. There are only three valid * programs: * Prints "Hello World"  *  Prints a random number between 0 and 2,147,483,647 *+* Runs forever. The third case must be an infinite loop according to the specifications in this question...
stackexchange_codegolf
Related Your goal, is to write a set of programs, that progresses from one to the other, one character at a time. For example. Given the starting program abcd and the ending program wxyz, you should have 5 valid programs, with the respective outputs. abcd -> wbcd wbcd -> wxcd wxcd -> wxyd wxyd -> wxyz wxyz -> wxyz As ...
stackexchange_codegolf
Wikipedia says about Polar Coordinates: In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a reference point and an angle from a reference direction. This seems perfect for describing hexagonal grids. Take the following he...
stackexchange_codegolf
Dotcomma is a simple esolang I made a while ago that only uses four operators: [.,]. In this challenge, you'll determine if a dotcomma program consisting only of [.] halts. Without ,, there is no input, output, or queue, making this challenge possible. Blocks: Any code wrapped in [] is a block. All blocks and operators...
stackexchange_codegolf
Step one In a new google sheet insert an image into cell A1 with Insert > Image > Image In Cell Step two Create a formula to return TRUE (if the cell contains an image) and FALSE (if the image is missing) Rules Only vanilla formulas are allowed. The shortest code in bytes wins.
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 doubles pickleball group often has five people. Four are playing and one is awaiting the next game. We can represent the state of the game with a string of five characters like abCde. This indicates that a and b are playing against c and d with c serving. We want to write a routine that gives the possible positions ...
stackexchange_codegolf
Background A staircase polyomino is a polyomino made of unit squares whose shape resembles a staircase. More formally, a staircase polyomino of size \$n\$ is defined as follows: A staircase polyomino of size 1 is a single unit square. A staircase polyomino of size \$n\$ is the same as that of size \$n-1\$ with a horiz...
stackexchange_codegolf
Introduction Time is a really simple concept. Seconds pass, one after the other, all the same. But humans love making it hard. This Stackoverflow question has gathered many answers and even though they are surprisingly long and complex, most of them will still fail for certain inputs. Can you format a number of seconds...
stackexchange_codegolf
A string is called a "prime string" if it can't be written as a concatenation of more than one of the same string. Your task is to write a program that, given a sequence of letters of length N (5 < N < 100), determines if it is prime or not. Examples Input: AABBAA Output: not prime, false, 0, etc. Input: FDFJKEHKLJHD...
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
This page is not for Visual Basic Tips Visual Basic .NET (VB.NET) is an multi-paradigm dialect of basic that was developed and released by Microsoft in 2002 as a replacement for Visual Basic. The current version of VB.Net as of Feb 2018 is Visual Basic .NET 15.0. Unlike Visual Basic (VB), Visual Basic .NET (VB.NET) is ...
stackexchange_codegolf
Task Given a UTF-8 string (by any means) answer (by any means) an equivalent list where every element is the number of bytes used to encode the corresponding input character. Examples ! → 1 Ciao → 1 1 1 1 tʃaʊ → 1 2 1 2 Adám → 1 1 2 1 ĉaŭ → 2 1 2 (single characters) ĉaŭ → 1 2 1 1 2 (uses combining overlays) チャオ → 3 3...
stackexchange_codegolf
Introduction I've always liked the idea of finding the most possible bang-for-your-buck squeezed out of a tiny chip, like the 6502. Of course, I'll need to start small. Filling the screen on 6502asm.com should be easy enough. Challenge Fill the entire program output screen on 6502asm.com with the color white using the ...
stackexchange_codegolf
Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any character more than once across your snippets. Rules You may use the same character multiple times in one (and only one) sni...
stackexchange_codegolf
Task Given an integer matrix M and a modulus m, find an inverse of M modulo m. If the matrix M is not invertible modulo m, the behaviour is left unspecified. Matrix inverse If M is a square matrix, its inverse exists if and only if its determinant is not 0. Similarly, when we are talking about matrices modulo m, the in...
stackexchange_codegolf
Someone gave my wife a decorative calendar consisting of four cubes. Here it is showing today's date (as of the posting of this challenge) on the front: When I first saw it, I looked at it from the wrong angle (from directly above) and couldn't figure out why it gave this information: [["February", "January"], [3], [7...
stackexchange_codegolf
Inspired by this stack of little statues that are currently on my desk at work, given to me by my colleagues from Sri Lanka when they visited The Netherlands: This is split into two different challenges due to popular demand: Part 1) Determine the amount of statues Part 2) Can the statues be stacked? (this challenge) ...
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
Introduction In this challenge, we will be dealing with a certain infinite undirected graph, which I call the high divisor graph. Its nodes are the integers starting from 2. There is an edge between two nodes a < b if a divides b and a2 ≥ b. The subgraph formed by the range from 2 to 18 looks like this: 16-8 12 18 \|...
stackexchange_codegolf
Most of us are probably familiar with the concept of triangular and square numbers. However, there are also pentagonal numbers, hexagonal numbers, septagonal numbers, octagonal numbers, etc. The Nth Nagonal number is defined as the Nth number of the sequence formed with a polygon of N sides. Obviously, N >= 3, as th...
stackexchange_codegolf
Create a bootloader that executes given Brainfuck program. This is code-golf, so the program with least bytes wins. Being a bootloader, the size of the program is counted in non-zero bytes in the compiled code. Brainfuck 30000 8-bit overflowing cells. Pointer wraps over. Some notes about operations: Input must be read...
stackexchange_codegolf