instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Write a program or function that takes in a string through STDIN or function parameters, tokenizes it by parenthesis, and outputs the tokens on different lines. If the string contains a parentheses error, the program/function must output a falsey value or error message.
Examples:
Input: abc(def)ghi
Output:
abc ghi
... | stackexchange_codegolf |
I've been doing word searches recently, and I thought it would be so much easier if all of the words read left-to-right. But rewriting all the lines takes a lot of effort! So I'm enlisting code golfers to help.
(Disclaimer: The above story may or may not be remotely accurate.)
Your code will take a rectangular grid and... | stackexchange_codegolf |
Backstory, skip if you like
Generating high quality pseudo random numbers is a tricky business but the fine engineers at < enter company you love to hate > have mastered it. Their progress bars effortlessly rise above the primitive notion of linearly passing time and add an exhilarating sense of unpredictability to the... | stackexchange_codegolf |
A hill number is a number that has the same digit in the first & the last, but that's not all. In a hill number the first digits are strictly increasing until the largest digit, and after the largest digit, the last digits are strictly decreasing. The largest digit can be repeated but consecutively only, meaning no gap... | stackexchange_codegolf |
Introduction:
Ever used Dropbox with some other people and you both modified the same file? Ever had a multi-user application with a relational database, and two people were modifying (or worse, one was deleting and the other modifying) the same object? Well, let's simulate that with this challenge (sort-of).
For the s... | stackexchange_codegolf |
Input:
An array containing three integers: 0, 1 and 2 in any order (i.e. [2, 0, 1])
And a string of length >= 2 only containing alphabetic letters (both lower- and uppercase) and digits (i.e. a1B2c3)
Output:
Based on the array we sort and output the string.
How does this work?
The array indicates the order precedenc... | stackexchange_codegolf |
For the purposes of this challenge, a polyphthong is defined as a contiguous slice of a String, that only contains vowels, and has length at least 2. Given a non-empty String as input, your task is to output all the polyphthongs it contains.
For example, "abeoic" has the following contiguous slices (space-separated):
a... | stackexchange_codegolf |
Given a single integer x where 0 <= x <= 91 output a stack of bottles of beer with that many bottles (and shelves) missing. For simplicity sake I'll only show the first 6 bottles and what it would be for each of the first inputs.
Here's the stack of bottles, each number is the bottle you should remove for that input (1... | stackexchange_codegolf |
Let's for once do something useful.
Given the text from a Try It Online codegolf submission, produce the equivalent Chat Mini Challenge submission, which is of the form
Language, N bytes: [`code`](URL)
or (if submission is a single byte – TIO will add a trailing s on the first line only if needed)
Language, 1 byte: [`... | stackexchange_codegolf |
Description
I guess everyone knows the fairy tale of Rapunzel and the prince. For those who do not: read it here. However, Rapunzel had just had her hair cut, so it might not be long enough to let her prince climb up! She may get very sad..
Challenge
Your task is to write a function that evaluates what Rapunzel will be... | stackexchange_codegolf |
Given a square matrix, output the matrix's eigenvalues. Each eigenvalue should be repeated a number of times equal to its algebraic multiplicity.
The eigenvalues of a matrix A are scalar values λ such that, for some column vector v, A*v = λ*v. They are also the solutions to the characteristic polynomial of A: det(A - λ... | stackexchange_codegolf |
Introduction
Consider a sequence of integers \$f\$ defined as follows:
\$f(2) = 2\$
If \$n\$ is an odd prime, then \$f(n) = \frac{f(n-1) + f(n+1)}2\$
If \$n = p\cdot q\$ is composite, then \$f(n) = f(p)\cdot f(q)\$
It's not very hard to see that \$f(n) = n\$ for every \$n \ge 2\$, and thus computing \$f\$ wouldn't be... | stackexchange_codegolf |
In Skyrim, the player character can use powerful magic shouts (Thu'ums) to achieve their goals. Every shout consists of three words, however, the player can use the first one or two words to achieve the same effect with less power but at a shorter cooldown.
Given a lowercase ASCII Thu'um phrase without punctuation or s... | stackexchange_codegolf |
Description :
Given a string as input, check if it is a valid ordinal number in English or not. If it is valid return truthy value otherwise return falsy value. (Suggested by @Arnauld. Thanks . Also by @JoKing)
For users who want to know about ordinal numbers go here :
https://www.mathsisfun.com/numbers/cardinal-ordina... | stackexchange_codegolf |
Given a positive integer n, compute the value of the Mertens function \$M(n)\$ where:
$$M(n) = \Sigma_{k=1}^{n}\mu(k)$$
and \$\mu(k)\$ is the Möbius function where \$μ(k) = 1\$ if \$k\$ has an even number of distinct prime factors, \$-1\$ if \$k\$ has an odd number of distinct prime factors, and \$0\$ if the prime fact... | stackexchange_codegolf |
The goal of this challenge is to write a program where the length of the following three are exactly the same:
the length of the source code
the length of the output it prints to the standard output
the length of the compiler warnings it generates with the (unmodded) compiler of your choice
The winner is the shortest... | stackexchange_codegolf |
A Woodall Prime is a prime which can be calculated, given a positive integer n, with n * 2^n - 1.
Your task is to, given a integer k, generate a Woodall Prime with k digits. If no such Woodall Prime exists, you must generate a Woodall Prime with the closest amount of digits. If two primes exist with the same digit coun... | stackexchange_codegolf |
The bots are looking for love. Can you help them?
The rules
The goal of this game is find the bot you have the highest compatibility with. However, robots, who are inexperienced at dating are unable to tell how well a date went.
In the game, bots take turns "speed dating" some other bot. After each date, each bot choos... | stackexchange_codegolf |
Note that this is similar to my other challenge, but it is widened to be similar to most challenges (input -> truthy/falsey), instead of asking you all to brute force something. If this makes it a dupe, let me know, but I posted it on Sandbox and asked on chat, and didn't get any negative responses.
Input
Input will be... | stackexchange_codegolf |
Given a base \$k\$ as well as two indices (also passed in base \$k\$, call them \$s\$ and \$e\$) return a list containing a frequency count of all base-\$k\$ digits occurring between \$s\$ and \$e\$ inclusive. For example, upon input \$k = 10, s = 1, e = 10\$, we would return the list \$[0: 1, 1: 2, 2: 1, 3: 1, 4:1, 5:... | stackexchange_codegolf |
In this challenge you will receive a list of positive integers \$W\$ called a word, and a square symmetric matrix \$M\$. Your task is to determine if the word can be turned into the empty list by applying a series of valid moves.
The valid moves are:
If two consecutive values in the list are equal you may remove them ... | stackexchange_codegolf |
Write a full program with a source code of 256 bytes or less that looks at an image of a flag and determines what country that flag is from. A zip file containing the 196 different flags in the challenge can be downloaded from here. Source: [Flagpedia]. These 196 flag images are the only inputs your program has to hand... | stackexchange_codegolf |
This challenge is simple, given a decimal number, convert to binary, and calculate the sum of the sub-strings of the binary number, whose length is shorter than the original number. Here is an example:
Input:
11
Binary:
11 -> 1011
Substrings:
101 = 5
011 = 3
10 = 2
01 = 1
11 = 3
1 = 1
0 = 0
1... | stackexchange_codegolf |
Nice verb there, in the title.
Write a program that given an input string, will "elasticize" this string and output the result. Elasticizing a string is done as follows:
The first character is shown once.
The second character is shown twice.
The third character is shown thrice,
and so on.
As you can see, the amount of... | stackexchange_codegolf |
Introduction
The Baker's map is an important dynamical system that exhibits chaotic behavior.
It is a function from the unit square to itself defined intuitively as follows.
Cut the square vertically in half, resulting in two rectangles of size 0.5×1.
Stack the right half on top of the left, resulting in one rectangle... | stackexchange_codegolf |
Given a nonzero polynomial with integer coefficients and roots that are on the imaginary and on the real line such that if a is a root then so is -a, return another polynomial with the roots rotated by 90 degrees.
Details
The polynomial can be given in any reasonable format, e.g. as a list of coefficients. The symmetry... | stackexchange_codegolf |
In this challenge, you will write a bot that play's the prisoner's dilemma. Here's the catch: you will not have access to the history of previous games. Instead, you will have access to the opponent itself. In this version, both players get +2 points if they both cooperate, +1 points if they both defect, and if one coo... | stackexchange_codegolf |
Assume that there is a number a. In every conversion of that number, the number can either convert itself to its value plus the value of one of its digits, or convert itself to its value minus the value of one of its digits.
In this situation, find the minimum number of conversions one has to make in order to get to th... | stackexchange_codegolf |
Mash Up Time!
This is instalment #5 of both my Random Golf of the Day and Optimizer's ASCII Art of the Day series. Your submission(s) in this challenge will count towards both leaderboards (which you can find the linked posts). Of course, you may treat this like any other code golf challenge, and answer it without worr... | stackexchange_codegolf |
Given a ragged list, we can define an element's depth as the number of arrays above it, or the amount that it is nested.
For example, with the list [[1, 2], [3, [4, 5]]] the depth of the 2 is 2, as it is nested within two lists: The base list, and the list [1, 2]. The depth of the 4 is 3 as it is nested within three li... | stackexchange_codegolf |
Introduction
Compute is a esoteric joke language.
From the esolangs entry:
Compute has no required syntax and has the power to solve any and all
problems. It is smart enough to interpret any human language (English,
Spanish, Latin, etc), any programming language (C++, Java, brainfuck,
etc), or any kind of data you can... | stackexchange_codegolf |
In the board game Pandemic, an outbreak occurs when a city contains more than 3 disease cubes. When the outbreak occurs, any disease cubes in the city in excess of 3 are removed, and each city connected to it gains one disease cube. This means that chain reactions can, and will occur.
Important note: Each city may onl... | stackexchange_codegolf |
When you convert a fraction to a decimal number and you want to store that number, you often have to round it, because you only want to use a certain amount of memory. Let's say you can only store 5 decimal digits, then 5/3 becomes 1.6667. If you can store only 2 decimal digits it will be 1.7 (now assuming that it is ... | stackexchange_codegolf |
This is the inverse of "Encode the date in Christmas Eve format."
Write a program that takes as input the string Christmas, possibly followed by Eve between 1 and 365 times, and outputs the date encoded in YYYY-MM-DD format, or any format from which the year, month, and date can be easily obtained. Assume that the "Ch... | stackexchange_codegolf |
Story:
The π was recently computed with accuracy to 100 trillions digits, but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits of them!
Challenge:
Your task will be to write program or function which takes string of digits including dec... | stackexchange_codegolf |
Unless you have a userscript that modifies the site's design (or even if so), you should have noticed that we have our site design!
(It's November now)
So, to celebrate, let's make a program that retroactively applies this design (oversimplified, of course)!
So, the most important changes are:
our new name is now Code... | stackexchange_codegolf |
The point of the puzzle is to learn about livelocks:
Create a multi-threaded (or a multi-process) program, whose threads (processes) indefinitely try to wait for each other and never finish. Unlike a deadlock situation, the state of threads (processes) in a livelock constantly change as they try to resolve the situatio... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
You successfully route the laser into the sensor, but nothing happens.
"What?" Frustrated, you flip the note from Santa. There's some more text:
Calculate the number of ways to complete the laser puzzle, and enter it into the number p... | stackexchange_codegolf |
The Collatz Conjecture
The famous Collatz Conjecture (which we will assume to be true for the challenge) defines a sequence for each natural number, and hypothesizes that every such sequence will ultimately reach 1. For a given starting number N, the following rules are repeatedly applied until the result is 1:
While N... | stackexchange_codegolf |
The Game
You will be playing an (almost) standard game of Connect-4. Unfortunately, it is a correspondence game and someone has placed black tape on every second row starting from the bottom, so that you cannot see any of your opponent's moves within these rows.
Any moves within already-full columns will count as passi... | stackexchange_codegolf |
I have made a short script that will pull dns txt records down from a server and combine them into a single string.
DNS txt records are:
1.website.com
2.website.com
3.website.com
Each of these are iterated through using the single digit number.
The double quotes at the beginning and the end of the strings are trimmed
T... | stackexchange_codegolf |
I don't like curry. Help me reverse the effects of this evil question - Make me some curry - by uncurrying functions.
Task
Given a blackbox curried function, output its uncurried equivalent.
The curried function will take a single argument and output either another curried function or a value of another type.
The uncu... | stackexchange_codegolf |
The wizard has a cunning cousin who is a witch. She looks down on the wizard, regarding him and his puzzles as mathematically naive. On reading his latest puzzle, she scorned him for always asking discrete problems with what she (unfairly) characterises as simple solutions, where the real, proper question should be co... | stackexchange_codegolf |
Sorry folks, but what I've got for you today is a golf but just limited by JS (or, to be strict, for a day of posting - an ES6 - the most modern set of it - if its ES7 - feel free to EDIT! use MOST MODERN features).
So if you afford that restriction - let's proceed!
Assume we have JSON root data structure r and some gl... | stackexchange_codegolf |
Your code just has to print "Happy 2013".
However, if it detects that it's 2014, it has to modify itself (as a running process!!) and print "Happy 2014" instead.
By self-modifying I mean the running process must really modify itself: it should alter its own instructions while it is executing.
Shortest code wins.
-10% s... | stackexchange_codegolf |
<< Prev Next >>
Santa was able to remanufacture all of the presents that the elves stole overnight! Now he has to send them to the assembly line for packaging. He usually has a camera to supervise the assembly line both to make sure the elves are doing a good job and because assembly line pictures look nice on advertis... | stackexchange_codegolf |
Input
An integer k composed of 1 and 2, with at least 3 digits and at most 200 digits.
Output
Another integer k' obtained by removing at most one (could be none) digit from k, such that k' is composite, and then another integer p for a non-trivial (that is, not 1 or k') factor of k'.
Test Cases
121212 -> 121212 10101
1... | stackexchange_codegolf |
Inspired by this building (United States Air Force Academy Cadet Chapel, Colorado)
Your task is simple, given a positive integer n, output the spiked building to size n
Testcases
1
->
^
/|\
/.|.\
/..|..\
_______
2
->
^ ^
/|\/|\
/.|..|.\
/..|..|..\
__________
7
->
^ ^ ^ ^ ^ ^ ^
/|\/|\/|\/|\/... | stackexchange_codegolf |
Given an integer N perform the following steps: (using 9 as an example).
Receive input N. (9)
Convert N from base10 to base2. (1001)
Increase every bit by 1. (2112)
Treat the result as base3 and convert it back to base10. (68)
Return/Output the result.
Input
May be received in any reasonable number format.
You only ... | stackexchange_codegolf |
Inspired by Make a Rectangle from a Triangle.
Task
There is a famous formula on the sum of first \$n\$ squares:
$$
1^2 + 2^2 + \dots + n^2 = \frac{n(n+1)(2n+1)}{6}
$$
It is known that this number is composite for any \$n \ge 3\$.
Now, imagine a collection of row tiles (a tile of shape \$1 \times k\$ with the number \$k... | stackexchange_codegolf |
Let's say you have a 20-sided die. You start rolling that die and have to roll it a few dozen times before you finally roll all 20 values. You wonder, how many rolls do I need before I get a 50% chance of seeing all 20 values? And how many rolls of an n-sided die do I need to roll before I roll all n sides?
After some... | stackexchange_codegolf |
Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1, variables, and definite integrals. For example, -x2 can be expressed as ∫x∫111dtxdu.
E := 1 | var | ∫EEEdvar
Any reasonable input/output method is allowed.
Examples:
Your score will be the your code length... | stackexchange_codegolf |
Goal
Use any graphics library or environment that can use colours and animation to create a rainbow.
Rules
The rings should emerge one by one in some kind of animation or succession
The rainbow must have at least 7 colours.
Winning Criteria
Fewest bytes wins.
| stackexchange_codegolf |
Note this is a question primarily focusing on data-structures
Introduction
Bacefook wants people to be friendlier! As such, they are implementing a new system to suggest friends! Your task is to help Bacefook to implement their new suggesting system.
Specifications:
Your program must be a REPL (read-eval-print loop) su... | stackexchange_codegolf |
Does anybody have tips for golfing in Erlang? I'm looking for specific things that can be applied to Erlang, not any language. I know we already have tips for Elixir, but that is different.
As usual, please post separate tips in separate answers.
| stackexchange_codegolf |
In this challenge you will receive a list of pairs of non-negative integers representing a mushroom forest. Each pair represents a mushroom whose center is at that horizontal coordinate. The only part of the mushroom we care about is the cap (the flat bit at the top).
The first integer in each pair represents which ro... | stackexchange_codegolf |
Given a number n, find x such that x! = n, where both x and n are positive integers. Assume the input n will always be the factorial of a positive integer, so something like n=23 will not be given as input.
Examples: n=1 -> x=1 (0 is not a positive integer), n=24 -> x=4
Shortest code wins.
| stackexchange_codegolf |
UBASIC is a freeware basic interpreter written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing. It is considered to be a "ready-to-run" language that and is capable of running on DOS and Windows.
What general tips do you have for golfing in uBasic? Any ideas that can be applied to cod... | stackexchange_codegolf |
Your task to to solve the SLCSC problem, which consists in finding the shortest possible code to solve the Longest Common Subsequence problem.
A valid solution to the LCS problem for two or more strings S1, … Sn is any string T of maximal length such that the characters of T appear in all Si, in the same order as in T.... | stackexchange_codegolf |
This challenge is about finding the smallest disk that contains some given points. This is made somewhat trickier, however, by the fact that in this challenge, the disk's coordinates and radius must both be integers.
Your input will be a list of points with integer coordinates x and y. You can take this as a list of tu... | stackexchange_codegolf |
Oops, Auto-correct.
You have a word. But it's wrong. You wonder what word it would be. Thankfully, being a code golfer, You can make a code to take a rough guess.
I/O
You will be given a (wrong, all lowercase) word, and a '(All lowercase)Dictionary list'. You have to output the word with the least Levenshtein distanc... | stackexchange_codegolf |
Santa's Shortest Path Problem
Trying to be as time-efficient as possible Santa needs to plan his trips carefully. Given a 5X5 grid representing a map of villages it is your task to be Santa's flight controller. Show santa the shortest and therefor fastest route to fly his sleigh and give him a list of coördinates (or d... | stackexchange_codegolf |
The Challenge
A simple "spy versus spy" challenge.
Write a program with the following specifications:
The program may be written in any language but must not exceed 512 characters (as represented in a code block on this site).
The program must accept 5 signed 32-bit integers as inputs. It can take the form of a functi... | stackexchange_codegolf |
Loading Circle Animation
Challenge
Write a full program that takes no input (or has an unused input) that displays exactly the following ASCII animation for as long as possible or only 8 frames.
Frame 1:
#
#
# #
##
Frame 2:
##
#
#
##
Frame 3:
##
# #
#
#
Frame 4:
##
# #
# #
(Note that the line at the end... | stackexchange_codegolf |
Write 3 programs that do the following task:
Let A, B, C source codes of those three programs;
if A runs BC is produced as output,
if B runs CA is produced,
if C runs AB is produced;
so each program writes a string (cycled for each program) and hides itself from it.
Additional, but essential constraints:
standard lo... | stackexchange_codegolf |
Introduction
You're a criminal tasked with stealing some secret plans from the new tech startup Dejavu. You sneak in over the back wall, but find a door that requires a pin to open it. You recognize the make of the lock and know that it takes a 5 digit pin using all numbers from 0 to 4. After each digit entered, the lo... | stackexchange_codegolf |
Goal
Your task is to create a program taking no input that returns the link to your answer. You can find a link to your answer by clicking at the share button on your answer.
Rules
Standard loopholes apply except for searching for the answer online. In fact, you are expected to find the answer online.
You are allowed ... | stackexchange_codegolf |
What is the shortest regular expression (REGEX) you can create for file extensions for all of the following image file formats (photographs, paintings, sketches, and drawings)?
.ACAD
.AFD
.AFP
.AOM
.AOMA
.APNG
.ASCII
.AVIF
.AVIFAV
.BMP
.BPG
.CABAC
.CDEC
.CDR
.CDRAW
.CGM
.CHEVC
.CIEC
.CIPA
.CMYK
.COLLADA
.CRT
.CWC
.DEEP... | stackexchange_codegolf |
Objective
Given a 2D array of any size, write a program or function to shift alternatively the columns and rows
Example
a b c d e
f g h i j
k l m n o
All elements in the first column shift down one row, the second column shift up one row, the third shift down one row and so on, wrapping when they reach the edge.
k g m... | stackexchange_codegolf |
Infix notation is a method of printing mathematical expressions where each operator sits between its two arguments, such as \$ \left(5 \cdot 4\right) + 3 \$.
Prefix notation is a method of printing expressions where operators sit before their arguments. The equivalent of the above is +*543. It's a bit harder to underst... | 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 |
A positive integer can be diluted by inserting a 0 between two bits in its binary expansion. This means that an n-bit number has n-1 dilutions, which are not necessarily all distinct.
For example, for 12 (or 1100 in binary), the dilutions are
11000 = 24
^
11000 = 24
^
10100 = 20
^
In this challenge, we're goin... | stackexchange_codegolf |
This challenge is inspired by @LuisMendo's MATL answer to my "binary multiples" challenge.
Task
Pick a code-golf challenge that is open and that has been posted before this one; let me call it the "linked challenge". The linked challenge must be a challenge whose task involves producing output.
Write the shortest code ... | stackexchange_codegolf |
A program is bit primed if bits in prime positions must alternate between zero and one, starting with one.
For example, this is a template for a bit primed program with [0..47] bits.
..10.1.0 ...1.0.. .1.0...1 .....0.1 .....0.. .1.0...1
01234567 89012345 67890123 45678901 23456789 01234567
Create a bit primed program... | stackexchange_codegolf |
Consider the problem of N queen on an (NxN) chessboard. Two queens are said to attack each other if they are on the same row, column,
or diagonal. Implements backtracking algorithm to solve the problem i.e. place N non-attacking queens on the board.
| stackexchange_codegolf |
Related: Multiply Quaternions
Challenge
Given a string made of ijk, interpret it as the product of imaginary units of quaternion and simplify it into one of the eight possible values 1, -1, i, -i, j, -j, k, -k.
The evaluation rules are as follows:
$$
ii = jj = kk = -1 \\
ij = k, \quad jk = i, \quad ki = j \\
ji = -k, \... | stackexchange_codegolf |
Background
When I was in elementary school, we used to play a game in math class that goes as follows.
All kids sit in a big circle and take turns counting, starting from 1.
However, the following numbers must be skipped while counting:
Numbers that are multiples of 3.
Numbers that have a 3 in its decimal representat... | 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 |
Believe it or not, the Sex Bob-ombs have become a world famous band and are currently on world tour! As their bookkeeper you must oversee their day to day finances and provide regular reports.
Every few weeks you compile a list of their expenses (in whole USD) in the order they were incurred.
For example, the list
378
... | 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: copy.
Introduction
MATL's function clipboard stores ("copies") the inputs to the four most recent calls to normal, input-taking functions. Normal functions a... | stackexchange_codegolf |
Backstory
If you visit the Steward Badge Page, you will see no one has received one of these badges from PPCG yet. However, there are two users:
DJMcMayhem & Martin Ender, that are only a few reviews away from this badge!
Challenge
Your challenge is to write a program or function that when run outputs DJMcMayhem's revi... | stackexchange_codegolf |
Your challenge today is to output a given term of a sequence enumerating all of the integers. The sequence is as follows: If we have a 0-indexed function generating the sequence f(n) and ceil(x) is the ceiling function, then f(0) = 0; abs(f(n)) = ceil(n/2); sign(f(n)) is positive when n and ceil(n/2) are either both ev... | stackexchange_codegolf |
Introduction
One of the first things I learned in chemistry, was giving the formula for the combustion of alkanes. The most basic example was: 2CH4 + 4O2 -> 4H2O + 2CO2. Note that the equation could have been simplified by dividing every coefficient by 2, we would get CH4 + 2O2 -> 2H2O + CO2. To make things easier, we ... | stackexchange_codegolf |
When I was in grade 3, we were taught how to solve a very simple math problem. It was equaling the denominators of two or more fractions.
Let's take two proper fractions:-
$$
\frac{1}{2},\frac{2}{3}
$$
First we will take the Least Common Multiple of the denominators of the two fractions, the LCM of \$2,3\$ are \$6\$. T... | stackexchange_codegolf |
Context
After "Computing a specific coefficient in a product of polynomials", asking you to compute a specific coefficient of polynomial multiplication, I wish to create a "mirror" challenge, asking you to compute a specific coefficient from polynomial division.
Polynomial division
Let us establish an analogy with inte... | stackexchange_codegolf |
A store is having a big sale.
If your price reaches $199 or more, you can reduce it by $100.
You can buy each product only once.
Here's an example list of products: (in order to simplify, the names of the products are represented by letters)
+------+-------+
| name | price |
+------+-------+
| A | 26.9 |
| B | 2... | stackexchange_codegolf |
Remove every pair of newline characters, that means every two newline characters appearing together are elided, whereas unaccompanied newline characters remain present.
Example:
echo -ne 'a\n\nb\nc\n\n\n\nd\n\n\n' | your-command
should output the same as
echo -ne 'ab\ncd\n'
Watch out, some POSIX tools have implementa... | stackexchange_codegolf |
I have just tried a game called Couch 2048.
(Note: You should have a look to better understand this question.)
Since it wasn't very exciting for me, I've been asking myself 'How much more till 2048!?'
That inspired me to post a challenge, because calculating this in not as easy as I thought.
Your goal:
Given a list of ... | stackexchange_codegolf |
Your task is to determine how much of a perfect palindrome a string is. Your typical palindrome (eg 12321) is a perfect palindrome; its perfectness is 1.
To determine the perfectness of a string, you see how many sections you can split it into where each section is a palindrome. If there are ambiguities, such as with a... | stackexchange_codegolf |
Output/print this block of text:
1234567890
2468013579
3691470258
4815926037
5049382716
6172839405
7306295184
8520741963
9753108642
0987654321
Acceptable formats include:
Trailing newlines/whitespace
List of strings
List of lists of characters
List of lists of integers
However, list of integers is not acceptable bec... | stackexchange_codegolf |
In this challenge you will receive a list of non-negative integers. Each one represents a mushroom with a cap of that radius centered at that location. So a 0 means that it occupies no space at all, a 1 means that its cap only occupies space above it, a 2 means it occupies space above it and one unit to the left and ... | stackexchange_codegolf |
A neat trick is if you ever need a nine-sided die, it is possible to make one using two six-sided dice using the numbers below. This is assuming you either have a way to rewrite the faces on the dice, or use some algorithm to map the numbers on a normal die onto these new numbers.
0 0 3 3 6 6
-----------
1|1 1 4 4 ... | stackexchange_codegolf |
What general tips do you have for golfing in Emotinomicon? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Emotinomicon (e.g. "remove comments" is not an answer).
Please post one tip per answer.
| stackexchange_codegolf |
Inspired by Hyperprogramming: N+N, N×N, N^N all in one.
Thanks to @MartinEnder and @trichoplax for their help in the sandbox.
Definitions
Hyperquines
Define a hyperquine of order n as a quine-like full program or function P that satisfies all rules that apply to proper quines and, in addition, has the following struct... | stackexchange_codegolf |
Write a program that outputs Lewis Carroll's poem The Mouse's Tale from Alice in Wonderland, drawn in its distinctive tail-like shape.
Plain text of the poem:
Fury said to a mouse, That he met in the house, 'Let us both go to law: I will prosecute you.— Come, I'll take no denial; We must have a trial: For really this... | stackexchange_codegolf |
Generate a cipher given a number and string
Your task is simple. Given a string s and a number 0 <= n <= 9 as inputs, insert a pseudo-random printable ASCII character between each character of the string n times. Such that for each character of s there are n random characters between them. Spaces should be trimmed.
Inp... | stackexchange_codegolf |
Unlike many C&R challenges, this does not require a separate robbers post; the goal of the robbers is to crack the previous answer and then post a new one as a cop.
As answerers, you will write a series of polyglots that look like this (each column is a language, and each entry is the output of the answer in that langu... | stackexchange_codegolf |
I posted this challenge a while ago, which concerns how many elves Santa needs to deliver presents.
Due to population increase, Santa is a little more pressed for time this year. Although in the past we operated very asynchronously, we are beginning to experiment with being more and more synchronized. So, Santa needs t... | stackexchange_codegolf |
Code-Bowling Challenge
Write a program or function that produces the same output, no matter how you re-arrange the source code. (Output can't be an error)
Pangram Scoring
Your score is the amount of unique characters in your source code.
A program with source code AJB would have a score of 3
A program with source ... | stackexchange_codegolf |
Your task is to build a bridge to connect two cliffs given an input d, the distance apart. d will always be even
However, the bridge needs columns to hold it up. Each column can hold a max of 6 spaces on each side.
For this example:
________ ________
| |
A | ... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.