instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Your task Given a integer input, \$ n \$ (such that \$ n > 1 \$), decide whether it can be written as the sum of (at least 2) consecutive square numbers. Test cases Truthy: Input Explanation 5 1 + 4 13 4 + 9 14 1 + 4 + 9 25 9 + 16 29 4 + 9 + 16 30 1 + 4 + 9 + 16 41 16 + 25 50 9 + 16 + ...
stackexchange_codegolf
In this game, you can look inside one box at a time chosen by you. When you do that, you can see how many coins there are in that box. The wizard has one last twist for you. At any point, you can choose to give up on this set of boxes and get him to start the whole process again (with a new random \$x\$). Of course, i...
stackexchange_codegolf
I created a programming language for manipulating strings called Stringy. It's very different from other programming languages, since you only have one string (for manipulation) and some variables. With the various commands you can manipulate that one string. I created it because it might be useful for some challenges ...
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
Given a strictly positive integer, N, produce an output satisfying the following: Produce an array of length N. Every string (i.e. "word") in the array is of length N. Every letter in the word is unique. Every first letter of the words are unique between each other. The remaining items of each word are equal to each o...
stackexchange_codegolf
Art stolen from What size is the digit? 7-segment digits can be represented in ASCII using _| characters. Here are the digits 0-9: _ _ _ _ _ _ _ _ | | | _| _| |_| |_ |_ | |_| |_| |_| | |_ _| | _| |_| | |_| _| Your job is to parse the art into normal numbers. Notes on numbers Each digit ...
stackexchange_codegolf
Inspired by a challenge from the OUCC 2022 Seniors competition. Background Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of time. The attacking players each have one soft ball they can throw at the defenders. Teams ge...
stackexchange_codegolf
The sequence A109648 starts with the following numbers 53, 51, 44, 32, 53, 49, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32, 53, 51, 44, 32, 52, 57, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32, 53, 50, 44, 32, 53, 50, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32, 53, 49, 44, 32, 53, 48, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32, 53, 51, 4...
stackexchange_codegolf
Introduction One day, you were showing your kid how to draw on a computer. You type mspaint.exe in the run bar. To your horror, it says "No items match your search". You must create a simple version of paint so your kid can draw! Challenge You must create a simple drawing program. To do this, open a white display windo...
stackexchange_codegolf
Background Complex floor is a domain extension of the mathematical floor function for complex numbers. This is used in some APL languages to implement floor ⌊, ceiling ⌈, residue |, GCD ∨, and LCM ∧ on complex numbers. For the rest of this challenge, an integer refers to a Gaussian integer, i.e. a complex number whose ...
stackexchange_codegolf
Write an infinite list of triangle codes, defined as code where the i-th line has i bytes for all lines, such that the i-th code generates (i-1)th code and has 1 more line than the (i-1)th code. The score is the number of lines in the initial code. Lowest score wins. For example, if . .. ... .... is outputted by . .. ...
stackexchange_codegolf
Suzhou numerals (蘇州碼子; also 花碼) are Chinese decimal numerals: 0 〇 1 〡 一 2 〢 二 3 〣 三 4 〤 5 〥 6 〦 7 〧 8 〨 9 〩 They pretty much work like Arabic numerals, except that when there are consecutive digits belonging to the set {1, 2, 3}, the digits alternate between vertical stroke notation {〡,〢,〣} and horizontal stroke notat...
stackexchange_codegolf
I honestly can't believe this challenge does not already exist. The challenge Write a function. The specifics Your program must define some sort of callable function. This includes anything commonly known as a function, a lambda function, or a subroutine. All of these types of callables will be referred to as a "funct...
stackexchange_codegolf
There has already been a 9 Hole Challenge (and another one here), but that was soooo last year. And besides, I have only been around for 2 months (although it seems like forever). And it is considerably different. Leader Board: (note that weighting for holes are not established yet) +---------------+------------+------...
stackexchange_codegolf
This question is inspired by this awesome answer. The challenge is to write a program or function which takes in a positive integer, and outputs "Happy new year to you" or a slight variation thereof, such that the character codes of that string add up to the inputted number. The space counts towards the sum of characte...
stackexchange_codegolf
TL;DR Record (left-right)/length for each pair of consecutive elements. If they're 0 or negative, don't record it. Once this is done, take these actions. Don't update quotients: Increment right and decrement left for (0, .3) Remove from the array at >=.3 Print both elements for >.5 Print the remaining array. Have s...
stackexchange_codegolf
Given a number n, calculate the amount of bases in the range of [2, n) in which b(n) is a Palindrome. Example n = 8 has the base conversions: 2 = 1000 3 = 22 4 = 20 5 = 13 6 = 12 7 = 11 Of which 2 of them, 3 = 22 and 7 = 11 are palindromes. So return 2. Clarifications For the sake of convenience, Your answer only ne...
stackexchange_codegolf
Your company lately hired a new bunch of extremely dedicated sysadmins. They feel that just watching computer screens is quite limiting (I mean, 60Hz refresh rate is just NOT enough), so they hooked up the CPU data bus to an DAC and play that on a speaker through the server room so that they can hear up to 20kHz. One p...
stackexchange_codegolf
Setting the Scene: It is an average afternoon, as you unwind after a long day by engaging in your favorite pastime: answering the plethora of captivating questions on PPCG. It hasn't been a good day for you; those damned Pyth programmers keep getting best answer and it's killing your vibe. Suddenly, you notice a new qu...
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
Migrated from chat Given two non-empty non-negative integer matrices A and B, answer the number of times A occurs as a contiguous, possibly overlapping, submatrix in B. Examples/Rules 0. There may not be any submatrices A: [[3,1], [1,4]] B: [[1,4], [3,1]] Answer: 0 1. Submatrices must be contiguous A: [[1,4], [3,1]]...
stackexchange_codegolf
Challenge: Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal places. The size of the ASCII-art root also depends on \$A\$ and \$B\$. Example: \$a=123\$, \$b=1234\$ ____ 123 /123...
stackexchange_codegolf
I was surprised to not find this asked already, though there is a great question on darts checkouts: Darts meets Codegolf Your challenge is to calculate which scores are not possible with 'n' darts below the maximum score for 'n' darts. E.g. for n=3, the maximum possible score is 180 so you would return [163,166,169,17...
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
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
A port of my other question: Double Prime Words Consider a word/string of n alphanumeric characters with sum of the characters, s, using their numeric position in the alphabet (a=1, B=2, c=3, etc.) or numeric value (0,1, 2, 3 - 9). Numeric characters should be taken at individual value. (66 is two 6 characters for a su...
stackexchange_codegolf
The task here is pretty simple. You should write a program that takes a string as input and outputs it (that is a cat program). Additionally when the \$n\$th byte of your program is removed (without replacement) the augmented program should take a string as input and remove the \$n\$th character. If the input to your...
stackexchange_codegolf
Does anyone have tips on how to golf in this language? Please one tip per answer and avoid posting simple and general tips such as "remove whitespace". Here is the github link and here is the esolang page.
stackexchange_codegolf
In Emoji Math, a user created module for the video game Keep Talking And Nobody Explodes, numbers are written as strings of emoticons, where each emoticon represents a base 10 digit. Below is the conversion table between digits and emoticons. Digit | Emoticon 0 | :) 1 | =( 2 | (: 3 | )= ...
stackexchange_codegolf
For our purposes, a trend is a contiguous subsequence of an array that falls into one of three categories: increasing, e.g. [1,2,3,10,239] decreasing, e.g. [8,5,0,-3,-50] stable, e.g. [7,7,7,7] Note that [1,1,2,3] is not a valid trend. It can be broken up into a stable trend [1,1] and an increasing trend [1,2,3]. In ...
stackexchange_codegolf
In the musical rendition of Les Miserables, a song appears called "Red and Black." Here is part of that song: Red - the blood of angry men! Black - the dark of ages past! Red - a world about to dawn! Black - the night that ends at last! Source. Your task is to turn input into a resounding "Red and Black" anthem. Inpu...
stackexchange_codegolf
The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. The challenge is to compute the average Levenshtein distance between two independent and uniformly random chosen binary strings of length n each. Your...
stackexchange_codegolf
Write a program that prints the name of its source file. REPL environments are not allowed for this challenge. Your code must work in any file that your language's interpreter will accept. Your answer must also be a full program, not just a function. The source code's file extension must be printed. Leading or trailing...
stackexchange_codegolf
Stack Exchange doesn't know how to transpose tables. Let's help. Given a markdown table, transpose it. Input assumptions: There will be at least two rows (including header) and two columns Either all cells have no leading space or all cells have exactly one leading space (you must handle both) If the cells have a lead...
stackexchange_codegolf
Golf Golf! This is my first challenge, so please be gentle! The challenge is to write a program that will output the correct score for a layout in the card game "Golf." The card game Golf has many variations. The house rules I use follow the standard rules for Six-Card Golf given by Pagat, with one slight difference. T...
stackexchange_codegolf
If you haven't played the game Baba is You, I think you really should. Whether you’ve played it or not, have a go at implementing it as a code golf. The idea behind this challenge is to have a bit more complicated, non-standard task with a bit longer answers. Game rules Alas, the challenge is not to implement the entir...
stackexchange_codegolf
Steganography hides a given message inside a given carrier, producing a package that does not look suspicious. For this challenge, you will write a program that takes an ASCII message and an ASCII carrier as input, and return or print a package that is identical to the carrier except characters corresponding to the mes...
stackexchange_codegolf
This is a copy cat question of Simplify ijk string applied to the other nonabelian group of order 8. See also Dihedral group composition with custom labels. Challenge Given a string made of r and s interpret it as the product of elements of the dihedral group \$D_8\$ and simplify it into one of the eight possible value...
stackexchange_codegolf
I want to read two strings on separate lines, each string the same length and containing only 0's and 1's, and determine if the first is the one's complement of the second. How succinctly can this be done in Python3? (Sorry to specify the language, but this is for my son who's studying Python) A list comprehension see...
stackexchange_codegolf
Given a grid of directions and a start and end position, determine the minimum number of substitutions in the direction grid that needs to be made to complete the path between the two points. The grid is doubly-cylindrical. This is clearer given an example. Example Let's take the following grid as an example: >>>>v >>>...
stackexchange_codegolf
I'm always forgetting Pokemon type matchups. This is a challenge to print the pokemon type chart! Attacking Type No Fi Fl Po Gr Ro Bu Gh St Fr Wa Gr El Ps Ic Dr Da Fa Normal 1.0 2.0 1.0 1.0 1.0 1.0 1.0 0...
stackexchange_codegolf
Rearrange a given list such that all the odd numbers appear before all the even numbers. Besides for this requirement, the output list may be in any order. The input will only contain integers, but they may be negative and there may be duplicates, and they may appear in any order. Shortest solution wins. Test cases [1,...
stackexchange_codegolf
A simple way to scramble a 2x2x2 Rubik's cube is to make a sequence random moves. This is not how official scrambles are done, but can get pretty close to a uniform distribution of all possible scramble states. Due to the way a 2x2 only has two layers, doing one turn on one face is equivalent (without considering the p...
stackexchange_codegolf
An Indian legend tells the story of the alleged inventor of the chess game, who impressed the emperor of India with his game so much that he would get rewarded with anything asked. The man said he wanted to be paid in rice. He wanted a grain of rice for the first square of the chessboard, two for the second, four for t...
stackexchange_codegolf
This challenge is not code golf. Please read the scoring before you attempt to submit an answer. You will be given a multi-line string as input. You should output the size of the largest contiguous chunk of non-space characters. Contiguous just means that the chunk is a single piece rather than multiple disconnect...
stackexchange_codegolf
This challenge sounds too simple to not already exist, so let me know if it is a duplicate. The task Print Hello, world! The rules Your code has to be in "byte order". This means that every character / byte has a higher or equal byte value than the preceding character / byte. Exceptions to this rule are the whitespace ...
stackexchange_codegolf
Background In the sport of Table Tennis (aka Ping-Pong or Whiff Whaff), two opponents play a sequence of rounds, where each round consists of players hitting a ball back and forth until one player (may or may not be the server) gains a point. Table Tennis has some official rules that make for a good game, but we will u...
stackexchange_codegolf
A self number (also called a Colombian or Devlali number) is a natural number, x, where the equation n + <digit sum of n> = x has no solutions for any natural number n. For example, 21 is not a self number, as n = 15 results in 15 + 1 + 5 = 21. On the other hand, 20 is a self number, as no n can be found which satisfie...
stackexchange_codegolf
Given an integer between 0 and 141 (inclusive), list all 24-hour times whose hour, minute, and second units add to that integer. Rules of addition Numbers are added by their time units, not by single digits. For example, take 17:43:59 17+43+59=119 Remember, that is an example of digits being added. In reality, you wou...
stackexchange_codegolf
Inspired by @AviFS. Given a string containing brackets, e.g. [xyz]]abc[[def]hij[ You can parse through it with a stack of brackets. When you find an open bracket, push a value to the stack, when you find a close bracket, pop from the stack. If you make these values indices, you know where you need to remove brackets. ...
stackexchange_codegolf
I suspect Gomoku may be one of the simplest games to implement in code. https://en.wikipedia.org/wiki/Gomoku The game is this: players BLACK and WHITE take turns putting down black and white stones. Black traditionally goes first. If, when a player puts down their stone, they now have 5 in a row of their color, they wi...
stackexchange_codegolf
Consider all 2^n different binary strings of length n and assume n > 2. You are allowed to delete exactly b < n/2 bits from each of the binary strings, leaving strings of length n-b remaining. The number of distinct strings remaining depends on which bits you delete. Assuming your aim is to leave as few remaining diff...
stackexchange_codegolf
Challenge Given an input of an integer, \$n\$ (where \$0<n<50\$), output the graph of \$y=\mathrm{Re}((-n)^x)\$ from \$x = -3\$ to \$x = 3\$ inclusive. Where \$\mathrm{Re}(p)\$ is the real part of the complex number \$p\$. Note that \$\mathrm{Re}((-n)^x) = n^x \cos{(\pi x)}\$ Output The output may be in any form you wi...
stackexchange_codegolf
This challenge is related to some of the MATL language's features, as part of the May 2018 Language of the Month event. Associated challenge: Function clipboard: paste. Introduction MATL has several clipboards, where you can store values (copy) to be retrieved later (paste). Some clipboards are automatic, which means...
stackexchange_codegolf
Your task is, given a family tree, to calculate the Coefficient of Inbreeding for a given person in it. Definition The Coefficient of Inbreeding is equal to the Coefficient of Relationship of the parents. The Coefficient of Relationship between two people is defined as weighed sum over all common ancestry as follows: E...
stackexchange_codegolf
Introduction Consider two strings A and B of the same length L, and an integer K ≥ 0. For the purposes of this challenge, we say that the strings are K-compatible, if there exists a string C of length K such that A is a contiguous substring of the concatenation BCB. Note that A is a substring of BAB, so A and B are alw...
stackexchange_codegolf
UTF-1 is one of the methods to transform ISO/IEC 10646 and Unicode into a sequence of bytes. It was originally for ISO 10646. The UTF-1 encodes every character with variable length of byte sequence, just like UTF-8 does. It was designed to avoid control codes. But it was not designed to avoid duplication of a slash cha...
stackexchange_codegolf
A prime gap is the difference between two consecutive primes. More specifically, if p and q are primes with p <q and p+1, p+2, ..., _q_−1 are not primes, the primes p and q define a gap of n = q_−_p. The gap is said to be started by p, and to have length n. It is known that arbitrarily large prime gaps exist. That is, ...
stackexchange_codegolf
The edit distance between two strings is the minimum number of single character insertions, deletions and substitutions needed to transform one string into the other. This task is simply to write code that determines if two strings have edit distance at most 3 from each other. The twist is that your code must run in l...
stackexchange_codegolf
Given a matrix consisting of positive integers, output the path with the lowest sum when traversing from the upper left element to the bottom right. You may move vertically, horizontally and diagonally. Note that it's possible to move both up/down, right/left and diagonally to all sides. Example: 1* 9 7 3 10...
stackexchange_codegolf
You are little speck on a Cartesian plane. Pondering your existence, you decide to roam around your plane and touch things. You notice that every coordinate pair you visit has a light switch. To entertain yourself, you decide to toggle every switch that you come across. The Challenge: Create a program that will take an...
stackexchange_codegolf
256-color Xterm-compatible terminals add 240 colors on top of the usual 16 system colors. Colors 16-231 use 6 levels (0, 95, 135, 175, 215, 255) of red, green, and blue, ordered lexicographically. Colors 232-255 are simply 24 levels of gray (8...238 by 10s). To get a better idea of what I'm talking about, see this tabl...
stackexchange_codegolf
Given two line segments, determine if the line segments intersect and if so, where. In the case that the two given line segments are co-linear and overlap, determine the midpoint of the overlapping segment. Lines will be specified in pairs of (x, y) coordinates. Examples [(-1, -1), (1, 1)], [(-1, 1), (1, -1)] => (0, 0...
stackexchange_codegolf
Let us define the "multiplicative deltas" of values \$[\; a_0, \cdots a_N, \;]\$ as: $$ [\; a_1 / a_0, \cdots, a_{i+1} / a_i, \cdots, a_N / a_{N-1} \;] $$ The reverse operation - namely "multiplicative undelta" - returns values such that the above operation results in the given values. Example Given values \$[\; 1, 5, ...
stackexchange_codegolf
An easy way to understand the unit n-dimensional hypercube is to consider the region of space in n dimensions that you can get if every coordinate component lies in [0, 1]. So for one dimension it's the line segment from 0 to 1, for two dimensions it's the square with corners (0, 0) and (1, 1), etc. Write a program or ...
stackexchange_codegolf
Minecraft 1.12 will be released tomorrow, so let's celebrate! Write code that takes in a non-negative integer N which represents the number of items of something in Minecraft. Output it in a way more helpful to players, giving the number of chests, stacks, and items N is equivalent to. Use the format XcYsZi where X i...
stackexchange_codegolf
Given a polynomial \$p(x)\$ with integral coefficients and a constant term of \$p(0) = \pm 1\$, and a non-negative integer \$N\$, return the \$N\$-th coefficient of the power series (sometimes called "Taylor series") of \$f(x) = \frac{1}{p(x)}\$ developed at \$x_0 = 0\$, i.e., the coefficient of the monomial of degree ...
stackexchange_codegolf
Black Box is a board game, Your task is to reveal all clues. What is black box Black box is a board game with hidden atoms, Your task is given input, All atoms, reveal all clues. I/O Input The atoms can be any 1-char that is not newline (Used for separator) Like this. O.... ...O. ..O.. ..... ....O Output When the code...
stackexchange_codegolf
Make a program that outputs the number of seconds from the beginning of today (00:00:00 of the day you run it) to the second you ran it. However, if this number is divisible by three, print Fizz instead. If it is divisible by five, print Buzz instead. If it is divisible by three and five, print FizzBuzz. Don't pad the ...
stackexchange_codegolf
Introduction Some ASCII characters are just so expensive these days... To save money you've decided to write a program that encodes expensive characters using inexpensive ones. However, character prices change frequently and you don't want to modify your program every time you need to encode or decode a different chara...
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
Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C. Program B, when run in language B produces Program A, and running program B in language A produces program C. Program C, when run in language A or language B, prints "Wrong language!". Prog...
stackexchange_codegolf
Introduction One day, you were just relaxing in your office in the CIA, when suddenly you see an alert on your computer. Your programs have just intercepted hundreds of coded messages! A quick examination reveals the rule for encoding, but you need a program in order to decode fast. Challenge You will be given a list...
stackexchange_codegolf
Given a string s and a non-negative number n less than the length of s, output the character at the n-th position of s. 0-indexing and 1-indexing are allowed. For 1-indexing, n will be positive and less than or equal to the length of s. s will consist of printable characters only. Any reasonable input/output is permitt...
stackexchange_codegolf
Introduction: The best options for the glass of your house will: 1. Let through as little heat as possible in both directions (insulation-value Ug). (2. Let through as much sunbeams as possible from the outside to the inside.) (3. Let through as much light as possible from the outside to the inside.) We only care about...
stackexchange_codegolf
Gaussian integers are complex numbers \$x+yi\$ such that \$x\$ and \$y\$ are both integers, and \$i^2 = -1\$. The norm of a Gaussian integer \$N(x+yi)\$ is defined as \$x^2 + y^2 = |x+yi|^2\$. It is possible to define a Euclidean division for Gaussian integers, which means that it is possible to define a Euclidean algo...
stackexchange_codegolf
We consider two integers to be similar if, when written in decimal, have the same length, and if we compare characters in any two positions for both decimal strings, the comparison results (less, equal or greater) must be the same in both strings. Formally, for two number that can be written as decimal strings \$a_1a_2...
stackexchange_codegolf
Sandbox Adapted from exercise 8 of 100 little Keg exercises String manipulation is a very important part of any programming language. Consequently, that is what this challenge is about. The Challenge I want you to write a program that: Takes a series of characters as input and, Then takes another input (integer/letter...
stackexchange_codegolf
Introduction: Apparently I keep coming up with word search related challenges lately. :) When I do the word search in the Dutch news paper, some words are very easy to find because they contain letters that aren't too common in Dutch words, like x or q. So although I usually look for the first letter or prefix of a wor...
stackexchange_codegolf
Inspired by this Game of Life question. Wireworld simulates "electrons" flowing through "wires", simple arrangements of which produce typical logic gate behavior. I challenge you to build a digital clock in the Wireworld cellular automaton. Your clock must count upwards from 00:00 to 23:59 in the usual fashion, or to 1...
stackexchange_codegolf
We're getting markdown tables! I assume this is what they look like: data data data data --------------------- | | | | | | | | Your task is to make a program or function to generate one of these tables. You'll be given input (string, list of ...
stackexchange_codegolf
Introduction I have an even number of bottles, all of different sizes. Unfortunately, I only know the size of the smallest bottle: 300ml. I also know the following: Half of the bottles are twice the size of the other half, meaning that the smallest small bottle and the smallest large bottle are in a ratio of 2:1. The...
stackexchange_codegolf
I did the IMC this year. Did anyone else here do it? In a UKMT Intermediate Maths Challenge paper, there are twenty-five questions. The first fifteen questions give you five marks if you get them right. For the other ten questions, you get six marks for getting them right. In the last ten questions, you lose marks if y...
stackexchange_codegolf
Introduction We have 22 Collatz conjecture-related challenges as of October 2020, but none of which cares about the restrictions on counter-examples, if any exists, to the conjecture. Considering a variant of the operation defined in the conjecture: $$f(x)= \cases{ \frac{x}{2}&for even x \cr \frac{3x+1}{2}&for odd x }...
stackexchange_codegolf
Background Stack Cats is a reversible esoteric language made by Martin Ender. Each command in Stack Cats is either the inverse of itself (represented as a symmetric character, such as -_:T|), or has its inverse command (represented as the mirror image, such as () {} [] <>). Stack Cats has a strong syntactic requirement...
stackexchange_codegolf
Overview I was playing with Desmos and discovered a really cool spiral: Doing some research, I discovered that this spiral was the Archimedian spiral. Every point on the spiral is exactly \$\theta\$ away from the origin, where \$\theta\$ is the angle from the origin. That is, any point on the spiral has the polar coo...
stackexchange_codegolf
Introduction In most interpreted languages, there is an operation that will run code generated at runtime. It generally requires alphanumeric characters to refer to this operation. Write a program, using as few alphanumeric characters as possible, that is able to download and execute any string in the language you're w...
stackexchange_codegolf
The Goal The goal of this question is to put a twist on this question. Your answer should be able to convert an array of words associated with integers into those integers. As an extra challenge, allow support for , +, -, and _ in between numbers such as sixty seven, sixty+seven, sixty-seven, or sixty_seven. Examples ...
stackexchange_codegolf
Today we'll look at a sequence \$a\$, related to the Collatz function \$f\$: $$f = \begin{cases} n/2 & \text{if } n \equiv 0 \text{ (mod }2) \\ 3n+1 & \text{if } n \equiv 1 \text{ (mod }2) \\ \end{cases}$$ We call a sequence of the form \$z, f(z), f(f(z)), …\$ a Collatz sequence. The first number in our sequence, \$a(...
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
Note: the first half of this challenge comes from Martin Ender's previous challenge, Visualize Bit Weaving. The esoteric programming language evil has an interesting operation on byte values which it calls "weaving". It is essentially a permutation of the eight bits of the byte (it doesn't matter which end we start cou...
stackexchange_codegolf
Definition The maxima and minima of a given function are the largest and smallest values of the function either within a given range or otherwise within the entire domain of the function. Challenge The challenge is to find the local maxima and minima of a given polynomial function using any method you may like. Don't w...
stackexchange_codegolf
Hertzprung's Problem (OEIS A002464) is the number of solutions to a variant of the Eight Queens Puzzle, where instead of placing \$n\$ queens, you place \$n\$ rook-king fairy pieces (can attack like both a rook and a king); in other words, it's how many possible positions you can place \$n\$ rook-kings on an \$n \times...
stackexchange_codegolf
In this challenge you will remove one of my least favorite features, operator precedence from traditional math notation, to acheive the syntax of one of my favorite languages, APL. The APL subset we will be working with includes only a few functions and single digit numbers. (No arrays!) Here is the grammar of the inpu...
stackexchange_codegolf
Write a program fragment so that, when repeated N times it prints the Nth Fibonacci number. For example, if your program is print(x) then: print(x) should print 1 print(x)print(x) should print 1 print(x)print(x)print(x) should print 2 print(x)print(x)print(x)print(x) should print 3 print(x)print(x)print(x)print(x)prin...
stackexchange_codegolf
Given an ordered list of numbers (possibly with leading zeros), arrange the numbers vertically, then let all zeros drop all the way to the bottom and all overhangs drop to the bottom-most open slot. Output the resulting integers, removing leading zeros. Worked Example Say we were given the following as input: ['0000312...
stackexchange_codegolf
Introduction As you all know, German has umlauts. They're these things: ¨ However, most keyboards don't have an umlaut key. That's fine, though, because you can write ö, ä, and ü as oe, ae, and ue. Challenge Your job is to to replace ö, ä, and ü with oe, ae, and ue (and likewise for their capital versions). You have t...
stackexchange_codegolf
This task builds on: Find all reflexicons using roman numerals An autogram is a sentence that lists the count of its own letters. Below is one of the first documented autograms found by Lee Sallows in 1983: This pangram lists four a’s, one b, one c, two d’s, twenty-nine e’s, eight f’s, three g’s, five h’s, eleven i’s,...
stackexchange_codegolf
I'm sure you're all familiar with Z̃͗̇̚͟Ḁ̬̹̈̊̂̏̚L̜̼͊ͣ̈́̿̚G̱̮ͩ̃͑̆ͤ̂̚Õ̷͇͉̺̜̲ͩ́ͪͬͦ͐ ̪̀ͤͨ͛̍̈͢ĝ̭͇̻̊ͮ̾͂e̬̤͔̩̋ͮ̊̈ͭ̓̃n͖͎̘̭̯̳͎͒͂̏̃̾ͯe͕̖̋ͧ͑ͪ̑r̛ͩa̴͕̥̺̺̫̾ͭ͂ͥ̄ͧ͆t͍̻̘̆o͓̥ͤͫ̃̈̂r̹̤͇̰̻̯̐ͮ̈́ͦ͂͞. If not, you can play with the classical generator a bit. Zalgo text is unicode text that started as English text and had a bunch of combining ...
stackexchange_codegolf
Write some code that acts as a cat program. That is, to input a string and output it as is. But the normal reversion of your code must output the normal reversion of the input string. And the visual reversion of your code must output the visual reversion of the input string. The normal reversion is the reversed charact...
stackexchange_codegolf