instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Uilta is a minority tungusic language spoken in the far east of Russia. A neat thing about Uilta is that it has pitch accent which can be predicted by a computer program. In this challenge we are going to take Uilta a word and determine where the accent peak is. Let me explain how this can be done. Phonemes The first ...
stackexchange_codegolf
Note that this challenge requires no handling or understanding of complex numbers. Given a non-empty square matrix where every element is a two-element (Re,Im) integer list, determine (giving any truthy/falsy values or any two consistent values) whether this represents a Hermitian matrix. Note that the input is a 3D ar...
stackexchange_codegolf
Introduction The middle-square method is used for the generation of pseudorandom numbers. However, this is not a good method in practice, since its period is usually very short and has some severe weaknesses. How does this work? Let's take an example: For the seed, we pick 123456: Seed 123456 The seed squared (see...
stackexchange_codegolf
Task Your task is to generate a password that is both secure and short in the fewest bytes possible given an integer seed as input. Input No seed Or An integer seed Output A password Scoring Your score is how many seconds the password takes to crack on How secure is my password divided by (bytes * password length) Scor...
stackexchange_codegolf
Given a set of letter grades, output the GPA (grade point average) of those grades, rounded to one decimal place. Valid grades and their corresponding value are the following: A = 4 grade points A- = 3.7 grade points B+ = 3.3 grade points B = 3 grade points B- = 2.7 grade points C+ = 2.3 grade points C = 2 grade points...
stackexchange_codegolf
Who doesn't like to chill on a Sunday morning in summer with a chilled beer and TV or in winter playing badminton or ultimate with friends? I always think knowing how many days you have to chill in a month keeps you well-informed and helps you plan what you want to do. Be it sitting in front of your pc and solving a co...
stackexchange_codegolf
Background Peter's Father, the Teacher of a dance-club, asks Peter a question: Given are two natural numbers (\$\mathbb{N}\$ \$x\$ and \$y\$). \$x\$ is the number of the garment types (e.g. shorts, shirts\$\dots\$) we have \$y\$ is number of colors (e.g. green, blue, \$\dots\$) of each garment we have. In the dance cla...
stackexchange_codegolf
Code-Golf caddy Eddie Brackets was getting tired of quine challenges, which appeared to be much too easy for the grand poobahs. He has this idea to spice up things and is sending quines to the car crusher. Challenge: Write a quine that prints itself "squeezed" for output purposes into an n x n square followed by that s...
stackexchange_codegolf
On CodingGame, there is a Puzzle that ask to write words with ascii art. I solve the puzzle then tried to golf it. What improvement can I do on it? INPUT >>> 20 >>> 11 >>> MANHATTAN >>> .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------...
stackexchange_codegolf
The standard way to round numbers is to choose the nearest whole value, if the initial value is exactly halfway between two values, i.e. there is a tie, then you choose the larger one. However where I work we round in a different way. Everything is measured in powers of two. So wholes, halves, quarters, eights, sixte...
stackexchange_codegolf
This is the cops' thread to a cops-and-robbers challenge. Click the link to find the robbers' thread. The challenge here is very simple. Create two programs of the same size, in the same language, which output (using 1 standard output method) two different natural numbers, \$x\$ and \$y\$. Submit both programs, bot...
stackexchange_codegolf
Background Imagine that I'm creating a really long necklace, consisting of only two characters, A and B. You must count the number of occurrences of the substring AB in the string. However, since it's a necklace, you must also consider if the last character and the first character join to make AB. For example, in BBBA,...
stackexchange_codegolf
Write a "palipolyquine": a program that is a quine, a polyglot, and a palindrome. Rules: The number of polyglot languages is more preferable than code size. The shortest answer (in bytes) wins, in case of a tie. Polyglot and Quine rules see here: Write a Polyquine. My example (I have a repository Freaky-Sources with...
stackexchange_codegolf
Given a string, like potatocarrot, break it into the smallest number of substrings possible. These substrings can consist either be a single character, or one of a list of words passed as input. For example, if [carrot, potato] was the input, the optimal way to break the string up would be [potato][carrot]. If the list...
stackexchange_codegolf
Make a Windows style Loading bar by the following instructions. (notice that this is different than Loading... Forever) Your output should start by [.... ]. Every tick, you should wait 100 ms, then move each dots by one character right. if the dot is on the tenth character, move it to the first. Notice that you s...
stackexchange_codegolf
Your task is to create either a console "app" or a function which allows the user to bet on certain numbers or retire / claim rounds. Bets Your program or function will prompt for a command after an action, and the bet is the most important, crucial to the operation of the app. A bet looks something like this: bet 5 b...
stackexchange_codegolf
A string is pairable if it can be split into subtrings, each of which is a string repeated twice consecutively. For example, aabaaababbbaba is pairable as: aaba aaba b b ba ba Given a non-empty string of a's and b's, output a Truthy value if it's pairable and a Falsey value if it isn't. Pairable: aa abaaba bbababbb aa...
stackexchange_codegolf
My coworker and I work on a legacy piece of software that we hate sometimes. Whenever you run it, debug asserts come flying everywhere, and it's never a guarantee that anything will work. The motivation for this round of code golf came from my coworker saying the following about our software. "It's like every time you ...
stackexchange_codegolf
plorcly borglar is a "mod" created by jan Misali for the constructed language toki pona that makes words sound funny. It involves substituting the 14 toki pona letters for funnier versions plus 2 extra rules. The substitutions are: toki pona letter plorcly borglar letter m bl n gl p b t pl k cl s scr...
stackexchange_codegolf
You are fighting an extensive network of enemy spies. You know that each spy has at least one (sometimes multiple) fake identities they like to use. You'd really like to know how many spies you're actually dealing with. Luckily, your counter-intelligence agents are doing their job and can sometimes figure out when two ...
stackexchange_codegolf
You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now. Rules You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years. Standard...
stackexchange_codegolf
Given a number n, print the nth prime Fermat number, where the Fermat numbers are of the form 22k+1. This code should theoretically work for any n (i.e. don't hardcode it), although it is not expected to terminate for n > 4. (It should not return 4294967297 for n=5, as 4294967297 is not a prime number.) Do note that wh...
stackexchange_codegolf
With challenges like Output with the same length as the code and Create output twice the length of the code, I thought of a separate, but similar challenge. The task is to produce an output. It can either be a string, a list of characters, or whatever is the default output format of your program. However, your output ...
stackexchange_codegolf
Background The sequence in the title is A245788 "n times the number of 1's in the binary expansion of n" ("times" here means multiplication), which starts like this: 1, 2, 6, 4, 10, 12, 21, 8, 18, 20, 33, 24, 39, 42, 60, 16, 34, 36, 57, 40, 63, 66, 92, 48, 75, 78, 108, 84, 116, 120, 155, 3...
stackexchange_codegolf
So, this is a task from one very popular educational site in Russia: https://acmp.ru/index.asp?main=task&id_task=786&ins=1 Mathematically, you need to find the power of two not exceeding the given number, read from the standard input stream, and output their difference in the standard output stream. My python3 solution...
stackexchange_codegolf
Given an integer \$ n \ge 2 \$, you need to calculate \$ \lfloor n \log_2(n) \rfloor \$, assuming all integers in your language are unbounded. However, you may not ignore floating-point errors - for example, in python lambda n:int(n*math.log2(n)) is an invalid solution, because for example for n=10**15, int(n*math.log2...
stackexchange_codegolf
Task A reverse checkers position is a chess position where every piece for one player is on one colour and every piece for the other player is on the other colour. Your task is to find if the given (valid) position meets these criteria. For example, this position does (click for larger images). Every white piece is on ...
stackexchange_codegolf
Synopsis Your goal is to implement the (asymptotically) fastest growing function within bounded code on a fictional CPU utilizing a quite limited, yet (probably) turing-complete instruction set. Environment The CPU utilizes unbounded RAM as well as two registers, the accumulator A and the program counter C, with words ...
stackexchange_codegolf
Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard) and transformed them into challenges. Most of them are still in the sandbox, and I'm not sure yet whether I'll post al...
stackexchange_codegolf
Background A binary tree is a rooted tree whose every node has at most two children. A labelled binary tree is a binary tree whose every node is labelled with a positive integer; moreover, all labels are distinct. A BST (binary search tree) is a labelled binary tree in which the label of each node is greater than the l...
stackexchange_codegolf
Based on this game. Description : Based on Wikipedia's description. The 24 Game is an arithmetical card game in which the objective is to find a way to manipulate four integers so that the end result is 24. For example, for the card with the numbers 4, 7, 8, 8, a possible solution is : \begin{equation} ( 7 − ( 8 ÷ 8 ) ...
stackexchange_codegolf
Any general tips for golfing in VB.net? This, similar to Pascal, is a very rarely used language, thus having very few resources online Visual Basic.NET (VB.NET) is a multi-paradigm, managed, type-safe, object-oriented computer programming language. Along with C# and F#, it is one of the main languages targeting the .NE...
stackexchange_codegolf
Objective Given two Chinese ideographs meaning basic colors, output the ideograph that means the color resulting from mixing them. Basic colors The basic colors are: 靑(U+9751; blue) 赤(U+8D64; red) 黃(U+9EC3; yellow) 白(U+767D; white) 黑(U+9ED1; black) Mixed colors Mixing 靑(blue) and 赤(red) yields 靘(U+9758; purple). Mix...
stackexchange_codegolf
Background Here you have another work-inspired challenge, but from my wife's work in this case. Imagine you have a service that returns the list of nodes in a tree structure (much like the files and folders in a file system), but in no particular order. For every node you get a tuple with its name and the name of its p...
stackexchange_codegolf
A checkerboard program is a program where each individual character's ordinal value alternates from even to odd, excluding the line terminator (which can be any standard line-endings). A triangular program is a program where each line has one additional character than the preceding line, with the first line having one ...
stackexchange_codegolf
Inspiration Given a positive integer \$1 \le n \le 9\$, output all positive \$n\$-digit integers \$i\$ for which the following is true: Each digit from \$1\$ to \$n\$ appears exactly once in \$i\$. Therefore, \$i\$'s digits are a permutation of the digits from \$1\$ to \$n\$. \$i\$ is divisible by \$n\$ Removing the r...
stackexchange_codegolf
Long time ago, when I was spending more time playing RPG, one of the issues what some players had, was to track party movement and to draw proper map. So I come with idea, to check how you guys come deal with this issue. Task is to write a function, which takes as input parameter list of directions (passed as structure...
stackexchange_codegolf
Setup: A block is any rectangular array of squares, specified by its dimensions \$(w,h)\$. A grid is any finite ordered list of blocks. For example, \$\lambda = ((3,2),(3,1),(1,2))\$ defines a grid. Let \$\lambda\$ and \$\mu\$ be two grids with equal area. A tiling of \$\lambda\$ by \$\mu\$ is any rearrangement of the ...
stackexchange_codegolf
In the physical world, invisible ink usually becomes invisible when it dries, and is then is readable if it is exposed to heat or chemicals of some kind. The invisible ink in this challenge will be readable when exposed to highlighting. Create a full program or function that takes in text from the console (using a prom...
stackexchange_codegolf
Sometimes authors will write (s)he as a stand in for she or he and for some reason they don't want to use singular they. This is ok for the nominative but doesn't work so well when you want to write "her or him". You can write h(er)(im) which covers both cases but gives two extra "pronouns" h her him herim In formal...
stackexchange_codegolf
Given two inputs, a distance \$d\$ and a number \$n\$ output a list of \$n\$ random colors which each have distance \$d\$ from the previous. Background A random walk is a path which is defined by choosing a random direction and (usually) fixed distance to go at each step. We will be taking a random walk through the RGB...
stackexchange_codegolf
This is a tips question for golfing in Python concerning the Evil Numbers question on Anarchy Golf. An number is evil if its binary expansion has an even number of 1's. The challenge is to print the first 400 evil numbers 0,3,5,...,795,797,798, one per line. The Python 2 submissions are led by llhuii with a 42-byte so...
stackexchange_codegolf
Animate the text in your terminal The goal The goal is to "animate" the string "Hello world" in your output so that each character gets capitalised after each other. Your program can exit after each letter has been capitalised. For example; # Iteration 1 Hello world # Iteration 2 hEllo world # Iteration 3 heLlo worl...
stackexchange_codegolf
Challenge Return the full contents of your program, but inverted. How do your invert something? Well, Letters: Take the position of the letter in the alphabet, subtract from 26, and use the letter at that position and flip the case of the letter. E.g A becomes z, and p becomes J. Digits: Subtract from 9. E.g 6 becomes ...
stackexchange_codegolf
Given a positive integer n, randomly output n non negative integers that sum to one hundred. n will be at most 200. The output should be present as a list of integers (not sorted). Your random sample should be uniformly sampled from all lists of n non negative integers that sum to one hundred. Your code should run in a...
stackexchange_codegolf
I absolutely hate the digit 1. So, I need your help to convert numbers to their "proper forms". Numbers in proper form never have two 1s in a row. 101 is okay, but 110 is hideous. To convert, simply skip all the improper numbers and count normally. For instance... 1 -> 1 2 -> 2 ... 10 -> 10 11 -> 12 12 -> 13 ... 108 ->...
stackexchange_codegolf
Background Imagine that I'm creating a really long necklace, consisting of only two characters, A and B. You must count the number of occurrences of the substring AB in the string. However, since it's a necklace, you must also consider if the last character and the first character join to make AB. For example, in BBBA,...
stackexchange_codegolf
Some trading cards have real value and can be sold for money. Bending the cards is frowned upon because it takes away their value and makes them look less new. Say you have a deck of trading cards (Pokemon, Magic, etc.) and you want to shuffle them. Instead of doing the bridge that bends all of the cards, another simpl...
stackexchange_codegolf
Challenge: Get the JavaScript string value containing only the "-" character using code only containing the following three symbols: +[]. Note: I'm not sure if this is possible. Scoring criterion: The number of bytes of code used. Why? I've set myself a challenge to be able to write code using only the above three char...
stackexchange_codegolf
I noticed that in Microsoft Word, single quotations are either ‘ or ’, but not in Notepad. Your task today is: given a string q, convert all the ' characters (only) to ‘ or ’, according to these rules, and then output it: If the character before the quote is a space, and after it comes a character, it becomes ‘ If the...
stackexchange_codegolf
We've got quite a few national flag challenges already: AU CH FI FR GB GB IS KR NP US... Here's another, somewhat more advanced one: Return or print the decorative pattern from Belarus's national flag as a matrix of two distinct values for red and white. If your language doesn't support matrices, use a list of lists o...
stackexchange_codegolf
Your task is to generate an emoticon of three characters, the first character being one eye, the second the mouth, and the third another eye. Each eye is a random one of these characters: $'*+-;O^`ox~, and the mouth is a random one of these: ,-._coux. Each eye and the mouth must be on the same general level. These eyes...
stackexchange_codegolf
When I saw this title in the Hot Network Questions I thought it was going to be a PPCG challenge. I was a little disappointed when it was on Mathematica. So now it is on PPCG: Challenge Given an input string, output the ROT13, flipped value. The input will contain characters from the following alphabet: [abcdefghijklmn...
stackexchange_codegolf
Given the number of vertices n ≥ 3 and the "step size" 1 ≤ m < n/2 (indicating the distance between two connected vertices), output a graphical representation of the corresponding regular polygram. If the polygram consist of multiple closed loops, each loop must be rendered in a different line colour. (If this sounds ...
stackexchange_codegolf
Given the name of an HTTP status code, such as OK or Continue, output or return the corresponding number. Your code is limited to 200 bytes, and the winner is the answer that correctly finds the number for the most status codes. For this challenge, the status codes your program should handle are: 100 Continue 101 Switc...
stackexchange_codegolf
Challenge Given a positive integer, find the fastest way to iterate over its digits. Bytecode size doesn't matter as much as speed of execution. Examples For 6875, the program would output 6 8 7 5. For 199182, it would output 1 9 9 1 8 2. For 0, it would output 0.
stackexchange_codegolf
Challenge Generate \$n-1\$ consecutive composite numbers using this prime gap formula $$n!+2,n!+3,...,n!+n$$ Input An integer \$n\$ such that \$3 \leq n \leq 50 \$. Output Sequence of \$n-1\$ consecutive composite numbers. Example Input 3 Output 8 9 Rules Output should be in integer format. Test Cases For \$n > 20\...
stackexchange_codegolf
Background Flow Free is a series of puzzle games whose objective is to connect all the same-colored pairs of dots on the grid. In this challenge, we consider the original game on a rectangular grid (no variations like bridges, warps, or hexagonal grids). A puzzle in Flow Free might look like this: Puzzle Solution ......
stackexchange_codegolf
Challenge Given a positive integer \$n\$, output the \$n\$-dimensional pyramidal list. Example \$n = 1\$: Objects arranged in a 1D pyramid (line) with side length 1 is just by itself. So, the output is {1}. \$n = 2\$: Objects arranged in a 2D pyramid (a triangle) with side length 2 would have one on the first row (...
stackexchange_codegolf
What I want: Quite simply, I want a text based display, that asks for an input, n, then shows that value on the display! But there's a catch. Each of the 'true' 'pixels' (the ones filled in) has to be represented by that number n.. Example : You are given an input n. You can assume n will be a single digit Input: 0 O...
stackexchange_codegolf
Task: Make a random number generator. The catch is that you can't use any built-in randomness functions. Your random numbers must be anything between 0 and 100, though they do not have to be floating point. Rules: It must produce a pseudorandom number. Randomness defined: If you run it x times, then x times again, the...
stackexchange_codegolf
I like pizza! Task Given the radius of a pizza and a list of ingredients, create the corresponding ascii pizza! Example size 4 pizza with mozzarella cheese, olives and ham: ##### #@@@@M# #H@O@@@@# #M@@@H@@# #@OO@@@@# #@@H@@@@# #M@M@@@@# #O@@@H# ##### Input A positive integer r for the size of the pizza and...
stackexchange_codegolf
Challenge: Your task is to use any language to output that language's name times the number of character's in its name. Use the common name or acronym of the language. If there are multiple versions of a language, you need not include the version number. The capitalization matters. Examples: PHP -> PHPPHPPHP Java -> ...
stackexchange_codegolf
Inspired by github.com/JackToaster/Reassuring-Parable-Generator, in turn inspired by xkcd.com/1263. The possible words are derived from the reassuring.cfg of that repository. Having a look at the reassuring.cfg (use the 12th commit) is suggested to see the grammar the output matches (The output is a list of all strings...
stackexchange_codegolf
Energy levels of electrons Electrons are ordered into "shells". However, sometimes electrons get excited, for example by heat, and leave their shell to go to another! These electrons will go back at some point, but they cannot go back to their original shell without emitting energy in the form of radio waves. For examp...
stackexchange_codegolf
Given a string s composed of lowercase letters, such as aabaaababbbbaaba and a positive integer n, such as 4, output a length-n string t such that when t is repeated to the length of s, they have as many chars in common as possible. For the given example, the optimal output would be aaba, because it has thirteen chars...
stackexchange_codegolf
This challenge is inspired by a picture that often roams on Facebook that looks like this. Except our base square will look more like this: ┌─┬───┬─┐ ├─┼─┬─┼─┤ ├─┼─┴─┼─┤ ├─┼─┬─┼─┤ └─┴─┴─┴─┘ The square is made out of n x m 1x1 square, you have to count how many sub-squares (1x1, 2x2, 3x3, 4x4, 5x5, etc.) can fit within...
stackexchange_codegolf
Steganographic Squares Your job is to take in a string, and generate an NxN image that represents this string. You must also write the algorithm that takes in the image and turns it back into a string as well. The scoring will be will include the byte count of both algorithms: "Encryption" Algorithm + "Decryption" Algo...
stackexchange_codegolf
In R print(x, digits=n) does something a little complicated. It always shows all the digits to the left of the decimal point and then, if there are any digits to the right it rounds the whole number so that at most n digits are shown. However, leading 0s are not counted. Here are examples to show how the function work...
stackexchange_codegolf
Introduction A polyglot is a program that is valid in multiple languages at once. An iterative quine is a program that outputs another program that outputs another program that outputs the source of the original program. Note that the number of chained programs does not have to be 3; it could be 2, 4, or 97384. Challen...
stackexchange_codegolf
Write a program or function that takes in the following input in a reasonable format of your choice: Two positive integers W and H that define the width and height of the image you'll be generating. Two RGB colors C1 and C2 that will be used to color the image. A list of 3-tuples of the form (r, x, y) that define circ...
stackexchange_codegolf
BackStory Given a square matrix of alphabets which contain English letters in arbitrary manner. While searching a word in it, you can go left to right horizontally, vertically downwards or diagonally towards left (both upwards and downwards). You have to find the number of matches of a given word in the matrix. For exa...
stackexchange_codegolf
Challenge Implement the 1-indexed sequence A054049, which starts like this: 1, 2, 3, 6, 13, 5, 9, 377, 21, 11, 89, 14, 8, 233, 16, 987, 18, 2584, 20, 6765, 55, 23, 28657, 25, 75025, 27, 196418, 29, 514229, 31, 1346269, 33, 3524578, ... This sequence is the lexicographically smallest sequence of positive integers, so t...
stackexchange_codegolf
Getting the area covered by a rectangle is really easy; just multiply its height by its width. However in this challenge we will be getting the area covered by multiple rectangles. This is equally easy ... so long as the rectangles don't overlap. If the rectangles don't overlap the total area covered is the sum of th...
stackexchange_codegolf
Dowker notation is a common way of representing mathematical knots. Dowker notation can be derived from a knot diagram in the following way (based on the description from the wikipedium): We will label each of the \$n\$ intersections with two numbers whose absolute value is on the range \$1, \dots 2n\$ (one odd one ev...
stackexchange_codegolf
Caves and Cliffs edition Part 1, Very related You're given a piece of ASCII art representing a piece of land, like so: /‾\ _ __ __/ _/ \‾ _/ __/‾\ | / / ‾\ | \_/‾ \_/ But unlike in the previous challenge, the terrain is mountainous, with caves and cliffs, and can turn b...
stackexchange_codegolf
Given two integers greater than one, A and B, output four mathematical expressions in this order: The plain expression A^B (A to the power B). e.g. if A = 2 and B = 3, 2^3. The expansion of A^B in terms of repeated multiplications of A. e.g. 2*2*2. The expansion of A^B in terms of repeated additions of A. e.g. 2+2+2...
stackexchange_codegolf
In this challenge, bots (consisting of JS functions) move around an infinite factory (playing field), collecting characters. These characters can be used to build worker bots, or dropped for other bots to pick up. This challenge is a modified redo of Bot Factory KoTH, which was broken by a mistake in the spec. Results ...
stackexchange_codegolf
The Challenge Write a program that takes an integer N as input, and outputs the stage of life or death that a tree is currently in. N will always be between 0 and 10. The Stages of Life and Death Life: To draw a stage of life, simply draw a base of size N, consisting of ^ characters, then move up and substract 2 from ...
stackexchange_codegolf
Given a non-empty string consisting of only lower and upper case alphabetical characters and spaces ([a-zA-Z ]), reduce it to a snippet of the alphabet, starting with the first character. To reduce a string, begin with the first alphabetical character, then remove every character after it that is not the next letter of...
stackexchange_codegolf
Year of 2010, an Icelandic Vulcano, concisely named Eyjafjallajökull erupted, resulting in my long-planned flight being canceled. In case this ever happens again, I would really like to know in advance, so please help me build a simple visual alert system ! Input Take the Icelandic Meteorological Office volcanic activ...
stackexchange_codegolf
Draw the ionising-radiation-hazard-symbol in an arbitrary colour on a distinctly coloured background. The specific proportions were published in the June 27th 1974 issue of the Federal Register of the US Government. Details As output, writing to a file (raster and vector formats are permitted) or displaying on the scr...
stackexchange_codegolf
Inspired by this blog post. Write a program that outputs 99 distinct programs (in the same language) that output the string I love you. How the programs are separated from one another in the output will be defined by you. However, Each byte of output can only belong to at most 1 of the 99 programs. Constraints for Out...
stackexchange_codegolf
Take the string abcdfghjk. To overwrite it, starting from f, with the string wxyz, you would continue along the original, replacing each character with the one from the replacement string. The result would be abcdwxyzk. Now, consider a string which would be too long to fit, like lmnopqrs. Starting at f you would get ab...
stackexchange_codegolf
Given a boolean function with inputs, check if it's possible to only use IMPLY gate to express it. There's no extra limitation on how you use this gate, and you can use each input for any amount of times. See examples below: \$\begin{matrix} \text{Expression}&&&&&\text{Solution}&\text{Your output}\\ a&0&0&1&1&a&\text{t...
stackexchange_codegolf
Take an arbitrarily sized string as input. This string represents a baseball plate appearance, in which each character represents a pitch as follows: Strike: S Ball: B Foul ball: F Hit by pitch: H Ball in play: X (For those wondering, this is a very very simplified version of Retrosheet's notation) Your program must...
stackexchange_codegolf
Introduction A "lobster number", by my own designation, is a number that contains within itself all of its prime factors. The "lobster" description was inspired by the recent question "Speed of Lobsters". The basic idea is that each prime factor can be made by lobsters munching away digits of the number until you are...
stackexchange_codegolf
A "Giza number", also colloquially known as a Timmy Number is any number where the digits represent a pyramid (A134810). For example, "12321" is a giza number because it can be visualized like this: 3 2 2 1 1 However, something like "123321" is not a Giza number because there are two digits at the top of the py...
stackexchange_codegolf
Introduction In the strange world of integer numbers, divisors are like assets and they use to call "rich" the numbers having more divisors than their reversal, while they call "poor" the ones having less divisors than their reversal. For example, the number \$2401\$ has five divisors : \$1,7,49,343,2401\$, while its r...
stackexchange_codegolf
The Interview: The Front Nine This is the first of a series of challenges inspired by programming job interview questions. You walk into the office where your potential future boss sits. "Come on in and sit down", he says. You nervously sit down, making sure your snappy yet professional attire is free of wrinkles. He a...
stackexchange_codegolf
You are to accept, on standard input, one number. You will then output the negation of that number. Your code will do nothing else. You may accept various formats if you wish (like "one" or ("uno+2.4e10i"). You may also output it how ever you wish. Note that these formats mush have existed somewhere on the internet bef...
stackexchange_codegolf
Task Continuously print a random character (a-z, A-Z, 0-9) not separated by a newline (\n). Expected output b7gFDRtgFc67h90h8H76f5dD55f7GJ6GRT86hG7TH6T7302f2f4 ... Note: output should be randomised. Requirements/Rules Output must be continuous (i.e. never ending), Output may not comprise of newlines, Output must b...
stackexchange_codegolf
Here is a list of some common ligatures in Unicode (the ones I could create with my Compose key on Debian): Orig Ascii Lig ae [ae] æ AE [AE] Æ oe [oe] œ OE [OE] Œ ij [ij] ij IJ [IJ] IJ ff [ff] ff fi [fi] fi fl [fl] fl ffi [ffi] ffi ffl [ffl] ffl You have two options in this ...
stackexchange_codegolf
Goal Given an input number, round it off to the nearest number with one significant figure. Requirements Input A floating point number. Assume the input number results in an output within the data type's limits (ie. ignore overflow errors.) 0 is an invalid input. Numbers that cannot be accurately represented in the fl...
stackexchange_codegolf
A jigsaw puzzle consists of (usually rectangular-ish) pieces. On each side of a piece, there is either an edge or a connector (a term I made up). A connector is either a tab sticking out (outie) or a slot facing inwards (innie). Two pieces can be joined if the outie tab can fit into the innie slot. The goal is to assem...
stackexchange_codegolf
I was looking for a very easy task to look how short of a code can be produced on a beginners exercise. The goal is to produce a simple table that looks like this common java/c# code is about 4 lines. So get your golfing-languages ready ;) Try to align the matrix in any way it is readable. 1 2 3 .. 10 2 4 6 .. ...
stackexchange_codegolf
Print all the numbers from 0-100 in the right order using the Danish way of counting How they count Like English, they have dedicated words for 0-20, 30, 40 and 100 Instead of saying twenty-one and twenty-two, they say one and twenty and two and twenty Starting with fifty they say multiples of 10 as n*20 50 = half thi...
stackexchange_codegolf
Given two positive integers X and Y, output any combination of the following three ASCII-art animals such that the output contains exactly X commas (,) and Y periods (.), if it is possible. Koala: 1 comma, 2 periods <.,.> Crab: 2 commas, 2 periods ,<..>, Commapillar: 3 or more commas, 1 period <,,,.> or <,,,,.> or ...
stackexchange_codegolf
Make a snake fill any maze (until it gets stuck). The snake The snake starts at a given starting point, pointing EAST. It moves by always having a wall or a part of its body immediately to the LEFT of its head ("left-hand rule wall follower"), until it gets stuck because all four directions around its head are occupied...
stackexchange_codegolf
Introduction We define twin primes as two natural numbers p,p+2 which both are prime. Example: 5 and 7 are twin primes. Let's define the twin number of some set of numbers as the number of twin prime numbers in that set Example: {6,7,11,13,18,29,31} has a twin number 4, since there are four twin primes; 11,13 and 29,3...
stackexchange_codegolf