instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Robbers post
A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string:
Split the string into equal sections.
Reverse the strings, and starting from the start of each string.
Pu... | stackexchange_codegolf |
The Cabbage, Wolf, Goat riddle with a twist!
Backstory:
There’s an intergalactic river than needs to be crossed! Being a space-ferryman you’ve offered some aliens on your small space ferry that can only carry two entities: you and a passenger. However, you know that because politics, some of these aliens will instantly... | stackexchange_codegolf |
A Latin square of order n is text which is arranged as a square of n lines by n columns, contains n different characters, and each character appears once in each line and column. For example, here is a Latin square of order 9:
Code gOlf
ode gOlfC
de gOlfCo
e gOlfCod
gOlfCode
gOlfCode
OlfCode g
lfCode gO
fCode gOl
M... | stackexchange_codegolf |
Input
A single-character string containing an uppercase or a lowercase letter from the English alphabet.
Alternatively, you may handle only uppercase or only lowercase letters as input.
Output
This 3x3 typeface of the input letter (source), with two distinct, printable ASCII characters of your choice (excluding tabs a... | stackexchange_codegolf |
Challenge
Given an integer, \$s\$, as input where \$s\geq 1\$ output the value of \$\zeta(s)\$ (Where \$\zeta(x)\$ represents the Riemann Zeta Function).
Further information
\$\zeta(s)\$ is defined as:
$$\zeta(s) = \sum\limits^\infty_{n=1}\frac{1}{n^s}$$
You should output your answer to 5 decimal places (no more, no le... | stackexchange_codegolf |
Intro
Something I've played around with in recreational mathematics has been construction of a divisor table to visually compare/contrast the prime divisors of a set of numbers. The set of input numbers are across the top as column labels, the prime divisors are on the left as row labels, and a mark indicates where the... | stackexchange_codegolf |
Lets create a system of numbers where the biggest digit in the nth place value (counting from right to left) of a number length m is always equal to m - n + 1. To give an example the largest 5 digit number expressible in this system is written 12345. Apart from the number of digits available to be used in a particular ... | 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 |
Sometimes, while golfing, one needs to represent large number(s) in their code. Writing them as is can significantly increase the byte-count.
What general1 tips do you have for representing long numbers concisely in code?
Please post one tip per answer.
1With general, I mean tips that can be applied to more than a sin... | stackexchange_codegolf |
Related, related
Introduction
The ruler sequence is the sequence of the largest possible numbers \$a_n\$ such that \$2^{a_n}\mid n\$. It is so-called because its pin plot looks similar to a ruler's markings:
However, with a slight modification, we can also get a similar sequence. This sequence is \$\{a_1,a_2,a_3,…\}\$... | stackexchange_codegolf |
The quaint hamlet of Кодгольф in the Russian far east has a problem: their population is low (below 66), and no new people have arrived for years. Moreover, after centuries of near-isolation, just about everybody is related to each other.
Mayor Стекобмен has a solution that should keep the morale high: organise a weddi... | stackexchange_codegolf |
Given a non-empty matrix of non-negative integers, answer which unique rows contribute most to the sum total of elements in the matrix.
Answer by any reasonable indication, for example a mask of the unique rows order of appearance (or sort order), or indices (zero- or one- based) of those, or a submatrix consisting of ... | stackexchange_codegolf |
There's been challenges for the shortest cat program, but as far as I know, there hasn't been any for the longest one.
A cat program is a program that copies its input to its output. Here's an example:
Input: Hello
Output: Hello
Input: cat
Output: cat
So, the rules are simple:
The program has to copy its input to it... | stackexchange_codegolf |
The obstacle course
You are currently stuck in some kind of course and you have to escape. However, if you do not choose the fastest way then the exit will close in front of you. Your challenge is to find the fastest route in an obstacle course.
Input
Your input consists of a list with lists in it, a 2D grid containing... | stackexchange_codegolf |
We are doing a PCG challenge at work, and I'm submitting answers in C#. This is a modification of the "M'Kay" challenge. My solution has been deemed correct by the requirements, I'm just trying to shrink it further if possible.
A filler word is an apparently meaningless word, phrase, or sound that marks a pause or h... | stackexchange_codegolf |
I've recently realized how vim works great for golfing, especially for kolmogorov-complexity. Also, according to meta vim is a perfectly acceptable 'programming language' at least, for the scope of this site, that is.
What general tips do you have for golfing in Vim? I'm looking for ideas which can be applied to code-g... | stackexchange_codegolf |
Coming from this sandbox post
This is inspired from an 8th graders math test
Intro
We have a cube with following corners
A(0, 0, 0)
B(1, 0, 0)
C(1, 1, 0)
D(0, 1, 0)
E(0, 0, 1)
F(1, 0, 1)
G(1, 1, 1)
H(0, 1, 1)
This cube clearly has 8 corners, 12 edges and 6 faces. If we now cut off corner G, such that our cut plane goe... | stackexchange_codegolf |
For this challenge you are going to make a function (your function may be a complete program) that takes a list as input and returns a permutation of that list. Your function must obey the following requirements.
It must be deterministic.
Composing your function with itself a variable number of times should be capabl... | stackexchange_codegolf |
Given the input of n and value. The code is supposed to nest the single element list with value repeated n times. The final output should be a multilevel nested list with single repeated values in all sublists.
This is code-golf, so the shortest code in bytes wins!
Test cases:
n = 1, value = 'a': ['a']
n = 2, value = '... | stackexchange_codegolf |
Based on this challenge, you must determine if a string is covfefey, that is, could it have been produced as output from a covfefifier?
The string will be composed of only alphabet chars (^[a-z]\*$, ^[A-Z]\*$ are possible schemes for input. change the regexs appropriately if using caps)
To do this, there are a few chec... | stackexchange_codegolf |
For today's challenge, you must write a program or function that alternates the case of a string. However, you must ignore non-alphabetic characters. This means that every alphabetic character must have a different case than the preceding and following alphabetic character. This is slightly more complex than uppercasin... | stackexchange_codegolf |
Challenge
Input two integers.
Integer I/O must be decimal.
If the integers are equal, output a truthy value.
Otherwise, output a falsy value.
Clarifications
You will never receive non-integer inputs.
You will never receive an input that is outside the bounds [-2³¹, 2³¹).
Rules
Standard loopholes are disallowed.... | stackexchange_codegolf |
Consider the infinite string of all nonnegative decimal integers concatenated together in order (akin to Champernowne's constant):
0123456789101112131415161718192021222324252627282930...979899100101102103...
Write a program or function that takes in a nonnegative integer that indexes (0-based) into this infinite strin... | stackexchange_codegolf |
Given an alphabet represented as a nonempty set of positive integers, and a word made up of symbols from that alphabet, find that word's position in the lexicographically ordered set of all words, assuming words can't contain duplicate symbols.
Example
Consider the alphabet {1, 2, 3} and the word [2, 3, 1]. The set of ... | stackexchange_codegolf |
In this challenge, you implement an interpreter for a simple stack-based programming language. Your language must provide the following instructions:
push a positive number
pop two numbers and push their sum
pop two numbers and push their difference (second number - first number)
pop a number and push it twice (dup)
p... | stackexchange_codegolf |
You are to write a program which generates random integers between \$0\$ and \$99\$ inclusive, outputting each integer in turn, until \$0\$ is generated. You may choose which single-order random distribution (uniform, binomial, Poisson etc.) you use so long as each integer has a non-zero chance of being generated and i... | stackexchange_codegolf |
Input:
A positive integer N.
Challenge:
Suppose you have a list of integers n = 1, 2 ... N. Output a list of integers, where each number is the maximum power of 2, m, such that 2^m divides each number of n.
Test cases:
1
0
15
0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
100
0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, ... | stackexchange_codegolf |
Laguerre polynomials are nontrivial solutions to Laguerre's equation, a second-order linear differential equation: \$xy''+(1-x)y'+ny=0\$. For a given value of \$n\$, the solution, \$y\$, is named \$L_n(x)\$. To avoid trivial solutions, the polynomials are non-constant except for \$n=0\$.
The polynomials can be found wi... | stackexchange_codegolf |
So, there's a famous children's rhyme...
This is the house that Jack built.
This is the malt
That lay in the house that Jack built.
This is the rat
That ate the malt
That lay in the house that Jack built.
This is the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the do... | stackexchange_codegolf |
Create a program or function which takes a list of strings as input, and outputs the longest string that is a substring of all input strings. If there are several substrings of equal length, and no longer substring, output any one of them.
This may mean outputting the empty string.
If there are several valid outputs, ... | stackexchange_codegolf |
We all know that if you google the word "google" it will break the internet.
Your task is to create a function that accepts one string and returns its length, in the fewest possible Unicode characters.
However, if the given string is google (lowercase), it will cause an error.
For example, g('bing') will return 4 but g... | stackexchange_codegolf |
Definitions
An algebraic number is a number that is a zero of a non-zero polynomial with integer coefficients. For example, the square root of 2 is algebraic, because it is a zero of x^2 - 2.
A transcendental number is a real number which is not algebraic.
Task
You are to choose a transcendental number.
Then, write a... | stackexchange_codegolf |
Today (or tomorrow, depending on your timezone, by the time of posting) is the birthday of the great mathematician and physicist Leonhard Euler. To celebrate his birthday, this challenge is about one of his theorems in geometry.
For a triangle, we define its incircle to be the largest circle inside the triangle and its... | stackexchange_codegolf |
Write a program or function that fulfills the following
Scores less than 101 bytes under normal code-golf rules
Takes no input1 and always outputs a single integer.
Every integer is a possible output.
Your score will be the probability of the most frequent integer occurring, with a lower scoring being the goal. That... | stackexchange_codegolf |
Two numbers are considered amicable if the proper divisor sum of the first is the same as the second number, the second number's proper divisor sum is equal to the first number, and the first and second numbers aren't equal.
\$s(x)\$ represents the aliquot sum or proper divisor sum of \$x\$. 220 and 284 are amicable be... | stackexchange_codegolf |
Challenge
Given an array of positive integers and a threshold, the algorithm should output a set of consecutive-element-groupings (subarrays) such that each group/subarray has a sum greater than the threshold.
Rules
The solution should honor two additional criteria:
be of highest cardinality of the groups (i.e. highes... | stackexchange_codegolf |
Your task is to program a robot so that it reaches the hole in the ground on each of the maps within reasonable time. If the robot reaches the hole, it falls down into it and thus victory is assured, even if the program never stops running.
Since the robot has to be programmed by manually punching in ones and zeroes, y... | stackexchange_codegolf |
Everyone is likely familiar with the following song, which is a musical round:
Background
Fewer people might recall trying to sing the 4-person version of this with a few friends and failing. Offsetting the lyrics of a song with different harmonious pitches is known as singing a "round" and that's what we're here to s... | stackexchange_codegolf |
Solve an Inglenook Sidings Puzzle
Background
The Inglenook Sidings Puzzle is a shunting/switching yard puzzle by Alan Wright for model railroading. The rules for the puzzle are as follows: (Source)
Form a departing train consisting of 5 out of the 8 wagons sitting in the sidings.
The 5 wagons are selected at random.
T... | stackexchange_codegolf |
In as few bytes as possible, sort the input, a delimited string OR list/vector/array of words, words contain printable ASCII except space (ASCII values 33-126) into a numbered list, table, or something resembling a table, by length.
Table rules are as follows:
Order is mandatory, direction is optional, either labelled... | stackexchange_codegolf |
See the cop thread for more information. Each answer to this question should crack an answer there. That is to say, it should be code to find the third-largest integer in the input when run in the interpreter given in that answer.
If you post a crack that turns out to be invalid, you should delete it and are ineligible... | stackexchange_codegolf |
I have a set of colored plastic cups. They come in four colors: green, yellow, pink, and blue. When I put them on my shelf, I like to stack them in a certain pattern. Your job is, given a list of any number of four distinct values (to represent the four cup colors), output a visual representation of how I would stack t... | stackexchange_codegolf |
Here is the code which I want to shorten.
n=input()
while n:
s=raw_input()
x,r,g,b=(int(x) for x in s.split())
a=x/r%2
c=x/g%2
d=x/b%2
r=((a*10+c)*10)+d
if r==0:e="black"
elif r==100:e="red"
elif r==1:e="blue"
elif r==10:e="green"
elif r==101:e="magenta"
elif r==11:e="cyan"
elif r==110:e="yellow"
else:e="... | stackexchange_codegolf |
Given a positive input \$n > 0\$, output the amout of two types based on their rarity. The two types are called \$A\$ and \$B\$, we know the followings:
\$n\$ is a limited input and the maximum is \$nmax\$
At the start \$B\$ is twice as rare as \$A\$
As the presence of \$A\$ increade the rarity of \$B\$ decreases
When... | stackexchange_codegolf |
Recently there have been a couple of ASCII pet snake challenges (e.g. here)
0 0
0 0 0 000
00 0 00 000 0 0
000 0 0 0 00
0 000
This challenge is to take a randomly generated horizontal pet snake (height of five line... | stackexchange_codegolf |
This is not the same as m-ss-ng-lette-s
Challenge:
Given a string with masked characters, generate all possible words, inclusive of non-meaningfull words.
Rules:
The sequence of the characters in the string does not change.
The masked character (*) will be one of an English alphabets [a-z].
There are no line breaks, s... | stackexchange_codegolf |
I've been working on this iOS app recently and I encountered a (rather easily solved) problem: How do I determine if my string is comprised only of emojis?
Well, that's your job today!
Input
A string. If the presence of unicode characters is problematic for you then you may use a different reasonable format. Please st... | stackexchange_codegolf |
Challenge
Convert and print out a time in a 12-hour format. HH:MM AM/PM
Examples
Input:
'Fri Jun 30 2017 21:14:20 GMT-0700 (PDT)'
'Fri Jun 30 2017 00:10:23 GMT-0700 (PDT)'
'Fri Jun 30 2017 12:10:23 GMT-0700 (PDT)'
'Sat Jun 31 2018 8:06:20 GMT-0700 (PDT)'
'Fri Jul 01 2017 01:14:20 GMT-0700 (PDT)'
'Sat Apr 10 2020 09:06... | stackexchange_codegolf |
Alphabet Rain
The Task:
The basic premise is to print out the input string and then repeat each character vertically, based on it's (0-indexed) position in the (case-insensitive) alphabet A-Z. A is at location 0 so is not repeated, e is at position 4 so is repeated 4 times, P is at position 15 so is repeated 15 times, ... | stackexchange_codegolf |
Challenge:
Given an array of non-negative whole numbers numbers in the range of 0 to Infinity, Check whether all of them are primes or not. (You can take input as a string too if you want)
Input:
Input: An array of numbers
Output: The array with every element replaced by one of these:
-1 -----> If 0, 1
... | stackexchange_codegolf |
We've all heard of the Knight's Tour puzzle: find a route for a knight that passes through all the squares on a chess board. But let's be honest, it's a little bit boring. So, let's give the knight a bit of a challenge.
Task
Write a program that takes the knight through all the squares on an arbitrary-sized, arbitrary-... | stackexchange_codegolf |
Definition
Given some string return an integer whose digits are the number ocurrences of a-z (case insensitive, in alphabetical order) in that string. Any character with 0 instances is skipped. Characters with 10 or more instances will define 2 or more digits of the returned integer. For example, aaaaaaaaaaaaaaaaaaaaaa... | stackexchange_codegolf |
Review
First, let's review the Simple Substitution Cipher.
To encode a string in the Simple Substitution Cipher, replace each letter in your string with another letter.
A letter may not be used to replace more than one existing letter.
For example, if I was encoding the text Hello world, my name is Oliver! I like code... | stackexchange_codegolf |
Given a string ending in either "er", "ir", or "re" (the "infinitive"), output the full conjugation of the string as a French verb in the seven simple tenses. For each tense (in the order given below), output each subject pronoun in the following order: je, tu, il, elle, nous, vous, ils, elles; followed by a space, the... | stackexchange_codegolf |
It's been a while since I posted here, so here we go another day another challenge.
Challenge :
Given a number(n) split it into it's prime factors.
Input :
A positive non-zero integer greater than 2.
Output :
Decompose the number into it's prime factors and return the number of occurances of each prime in it.
Ouput... | stackexchange_codegolf |
Definition
The Alternating Power Fibonacci Sequence is formed as follows.
Start with the empty sequence and set n to 1.
Compute fn, the nth non-negative Fibonacci number, with repetitions.
0 is the first, 1 is the second and the third, 2 is the fourth. All others are obtained by summing the two previous numbers in the... | stackexchange_codegolf |
Python's pickle module is used for serialisation, allowing one to dump an object in a way such that it can be later reconstructed. For this, pickle uses a simple stack-based language.
To keep things simple, we will be dealing with a small subset of this language:
( Push a mark to the stack
S'abc'\n P... | stackexchange_codegolf |
These are ASCII dandelions:
\|/ \ / |
/|\ | \|/ |
| | | _\|/_
| | | /|\
ASCII dandelions have three parameters: Length of the stem (positive number between 1 and 256, number of seeds (positive number between 0 and 7), and orientation (^ or ... | stackexchange_codegolf |
Summer Klerance, a senior in college, is what her teachers refer to as GBL*. Students in her probability class have been assigned individual problems to work on and turn in as part of their final grade. Summer, as usual, procrastinated much too long, and, having finally looked at her problem, realizes it is considerabl... | stackexchange_codegolf |
In case you missed Encode Factor Trees, here is the definition of a Factor Tree:
The empty string is 1.
Concatenation represents multiplication.
A number n enclosed in parentheses (or any paired characters) represents the nth prime number, with 2 being the first prime number.
Note that this is done recursively:... | stackexchange_codegolf |
A Directed Acyclic Graph (DAG) is a type of graph that has no cycles in it. In other words, if there is a link from node A to node B, there exists no path from B to A (via any nodes).
Challenge
Determine whether the directed graph given as input is acyclic.
Input
A list of lists of integers representing the links betwe... | stackexchange_codegolf |
I remember people saying that code size should be measured in bytes, and not in characters, because it's possible to store information with weird Unicode characters, which have no visual meaning.
How bad can it be?
In this challenge, you should output the following Lorem Ipsum text, taken from Wikipedia:
Lorem ipsum do... | stackexchange_codegolf |
What is the shortest selector (by character count) to select ALL html elements on a web page, without using asterisk (*)? Some examples are the following:
a,:not(a) /*9 chars*/
:nth-child(n) /*12 chars*/
:link,:not(:link) /*17 chars*/
| stackexchange_codegolf |
The Ship of Theseus is an old question that goes something like:
If a ship has had all of its original parts replaced, is it still the same ship?
For this golf, we're going to slowly replace "parts" on a "ship", and see how long it takes to get a whole new ship.
Task
A ship is comprised of at least two parts. The par... | stackexchange_codegolf |
We all know what a quine is. A quine is a program which prints its own source code. And we also know about the printable ASCII characters. Well... this challenge mixes both.
Your mission, should you accept it, is to create an index quine. An index quine is a non-empty program, composed only of the printable ASCII chara... | stackexchange_codegolf |
In elementary school, children learn about proper fractions, where the numerator is less than the denominator, and thus the value of the fraction is less than one. Later, they are taught about fractions where the value of the fraction is greater than one, and two different ways to express these fractions: mixed fractio... | stackexchange_codegolf |
A biquadratic number is a number that is the fourth power of another integer, for example: 3^4 = 3*3*3*3 = 81
Given an integer as input, output the closest biquadratic number.
Here are the first 15 double-squares:
1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000, 14641, 20736, 28561, 38416, 50625
This is code-golf s... | stackexchange_codegolf |
This is inspired by an 05AB1E answer by Magic Octupus Urn.
Given two arguments, a positive integer and a string/list of characters:
Translate the number to base-n, where n is the length of the string.
For each character, replace every appearance of the index of that character in the base-n number with that character.
... | 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 |
Your task is to convert non-empty strings - between strings using the 26 letters, and programs, which are strings of bytes, where each byte has 256 possible values. You should use the same codepage your answer is written in for the possible values of bytes.
You need to do the following to do the conversion:
Convert th... | stackexchange_codegolf |
The task at hand is, given a number n, find the smallest prime that starts with AT LEAST n of the number 2 at the beginning of the number. This is a sequence I found on OEIS (A068103).
The first 17 numbers in the sequence are given below, if you want more I'll have to actually go implement the sequence, which I don'... | stackexchange_codegolf |
A simple regex is either:
_ (which matches the empty string)
Any lowercase letter a to z (which matches that letter)
r*, where r is a regex (which matches r any number of times)
(r|s), where r and s are regexes (which matches either r or s)
(r+s), where r and s are regexes (which matches r followed by s)
Note that du... | stackexchange_codegolf |
Years ago I read the "Best of Ruby Quiz" book by James Edward Gray II (also available online by now). For problem 2 in the book (which is problem 14 on his original RubyQuiz site), he mentions a golfed solution in under 300 bytes, even though he is not a big fan of golfing.
So I did wonder if I could beat that and mayb... | stackexchange_codegolf |
Goal
Given an string with a train of hashes, calculate its total length and divide by the distance from start to finish.
Simulation
What are we simulating? According to this paper, the ratio of the length of a river to the distance between start and end is approximately Pi! (This may have been disproved empirically, bu... | stackexchange_codegolf |
Everyone knows, that you can leave out the multiplication symbol (\$\times\$, or *) in
a*b
23*a
(2+3)*a
a^(b*c)
(a+b)*(c+d)
but not in
2*3 => you don't want it to be 23
a*23 => most mathematicians just don't do it
a^2*b => now it's (a^2)*b, if you remove the *, it's a^(2b)
a/2*b => now it's (a/2)*b, if you remove th... | stackexchange_codegolf |
Introduction
My gnome friends are writing a programming language and have asked for my help. Due to their size, the gnomes can only handle small superscript numbers instead of big numbers. However, the language they're writing the interpreter in only accepts big numbers!
Your Challenge
Given an input of a superscript n... | stackexchange_codegolf |
Problem Description
We all love a Twix (because it is the best candy), but this is the kids' first Halloween --- we gotta grab at least one of each type of candy for them. Each Halloween all the residents of Numberline avenue send out an email saying what types of candy they'll be giving away this year.
Oh! And we live... | stackexchange_codegolf |
Given a string x, output the characters in x sorted according to the order of appearance in your source code.
Examples
Source: ThisIs A Test
Input: Is it a Test?
Output: TissI etta?
Source: Harry - yer a wizard.
Input: I'm a what?
Output: aa wh'?Imt
Source: Mr. H. Potter, The Floor, Hut-on-the-Rock, The Sea
In... | stackexchange_codegolf |
I am trying to push my limits of making a python code as short as possible.
I left the readability part way behind.
I was attempting the K-Goodness String problem from Round A of Google Kick Start 2021.
The following was my initial solution:
def func(N, K, S):
if not S: return 0
y = 0
for i in range(N//2)... | stackexchange_codegolf |
I want to compactly code positive integers x into bits, in a manner allowing decoding back into the original integers for a stateless decoder knowing the maximum value m of each x; it shall be possible to uniquely decode the concatenation of encodings, as is the case in Huffman coding.
[The above introduction motivates... | stackexchange_codegolf |
Your program is supposed to create a full red screen in MSDOS. The source of the binary (.com file) must be 5 bytes or less. No wild assumptions, the binary must work in MsDos, DosBox, and FreeDos alike. For winning, you have to post x86 assembler code which can be assembled with NASM (FASM) or directly the hex code of... | stackexchange_codegolf |
Given a list of two or more spelled-out serial numbers of equal length greater than two, e.g.
[[ "three" , "one" , "four" ],
[ "one" , "five" , "nine" ],
[ "two" , "six" , "five" ],
[ "three" , "five" , "eight" ]]
sort the list by the numbers that the words represent:
[[ "one" , "five" , "nine" ],
[ "t... | stackexchange_codegolf |
I was playing around with some numbers and found a sequence that, of course, is on OEIS. It is A005823: Numbers whose ternary expansion contains no 1's. It goes:
a(2n) = 3*a(n)+2
a(2n+1) = 3*a(n+1)
a(1) = 0
a = 0,2,6,8,18,20,24,26,54....
I wrote a CJam program that generates the first n of these numbers by convertin... | stackexchange_codegolf |
In this challenge, submissions will be programs or function which, when given an emoticon such as :-), :(, or :D, will rate their happiness from 0 to 3.
An emoticon will be one of the following:
:(: 0
:|: 1
:): 2
:D: 3
Emoticons may also have noses (a - after the :).
Test cases:
:( -> 0
:-| -> 1
:D -> 3
:-) -> 2
:|... | stackexchange_codegolf |
Introduction
Book cipher
A Book cipher is a very unique method of a encipher. Here's how's it done:
You have a book / a document or a article (something full of text, the more pages of text the better).
You have a message to convey (a secret, of some sort)
You simply-put read trough the text and the secret message (ma... | stackexchange_codegolf |
In this task, you will write a program/function that takes a Normalized Malbolge program and outputs the resulting Malbolge program. (This is a secret tool that all Malbolge programmers are using!)
Input
A data structure that (somehow) represents a Normalized Malbolge program.
Output
A data structure that represents th... | stackexchange_codegolf |
Your task today will be to take an existing file and append zeros to it until it reaches a certain size.
You must write a program or function which takes the name of a file in the current directory f and a number of bytes b. While maintaining the original content of f, you must write zeroes (null bytes, not ascii 0s) ... | stackexchange_codegolf |
In this meta-challenge, you will score your own atomic-code-golf submissions. More precisely, you will need to write a program P in language L such that the atomic-score of P is produced by P.
Score
The idea behind atomic-code-golf is to count language tokens instead of bytes. However, in practice, it is hard to defin... | stackexchange_codegolf |
A square-free word is a word consisting of arbitrary symbols where the pattern \$XX\$ (for an arbitrary non-empty word \$X\$) does not appear. This pattern is termed a "square". For example, squarefree is not square-free (using the lowercase letters as the alphabet), as the square ee appears; but word is square-free. A... | stackexchange_codegolf |
The Challenge
Your task is to create a program or function that outputs the following with no input:
a
bb
ccc
dddd
eeeee
ffffff
ggggggg
hhhhhhhh
iiiiiiiii
jjjjjjjjjj
kkkkkkkkkkk
llllllllllll
mmmmmmmmmmmmm
nnnnnnnnnnnnnn
ooooooooooooooo
pppppppppppppppp
qqqqqqqqqqqqqqqqq
rrrrrrrrrrrrrrrrrr
sssssssssssssssssss
tttttttttt... | stackexchange_codegolf |
Write a program that takes in (via STDIN/command line) a non-negative integer N.
When N is 0, your program should print O (that's capital Oh, not zero).
When N is 1, your program should print
\|/
-O-
/|\
When N is 2 your program should print
\ | /
\|/
--O--
/|\
/ | \
When N is 3 your program should print
\ | /
\... | stackexchange_codegolf |
This is thematically similar to Generate keyboard shortcuts for a menu, but its actually a pretty different challenge.
Let's take PHPStorm's menu as an example:
New Project
New
Open Directory
Open
Open URL
New Project from Existing Files
Save As
Open Recent
Close Project
Rename Project
We need to assign a single-lette... | stackexchange_codegolf |
It's time for CGCC to demonstrate our musical talent! In this challenge, you're going to compose songs while keeping your byte count as small as possible.
On Day 0, multiple answerers will post a function or program that outputs nothing/an empty string. They will also give a single line that next day's answers must out... | stackexchange_codegolf |
Given a date between 2010-01-01 and 2099-12-31 as three integers (please state your order if not [year,month,day]), answer with Tesco's corresponding five-digit Burger Relish Best Before End date number.
The format is simply the last two digits of the year, followed immediately by three digits representing the day of ... | 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 have recently thought of a wonderful relatively old mobile game, called Tower Bloxx. Alhough I'm not really old myself, but it reminded me of childhood and school :)
So this my challenge is a kind of a reference to that good game!
I have (hopefully) looked into any tower question on PPCG and this won't be a dupe.
... | stackexchange_codegolf |
You are given four integers: \$e,s,b\in\{0,1\}\$ and \$S\in \{0,1,2,4\}\$, where \$e,s,b,S\$ stand for egg, sausage, bacon and spam respectively.
Your task is to figure out whether the corresponding ingredients match a valid entry in the following menu:
[e]gg | [s]ausage | [b]acon | [S]pam
-------+-----------+--------... | stackexchange_codegolf |
Imagine a countable infinite amount of empty rooms. When an infinite amount of guests come, they occupy the 1st, 3rd, 5th...(all odd) empty rooms. Therefore there's always an infinite amount of empty rooms, and occupied guests needn't move when new guests come.
- - - - - - - - - - - - - - - - -
1 - 1 - 1 - 1 - 1 - 1 - ... | stackexchange_codegolf |
You are to golf a program that will take a filename as input and you must output what color the file is.
The file will have any one of these extensions but your program only needs to support one. Please say which one in your answer.
.jpg
.png
.svg
.gif
.bmp
And now to the classic layout.
Input
A filename with one of ... | stackexchange_codegolf |
I know, a bit late.
Challenge
Your challenge is, given a date, output if it's not an Advent Sunday, or the Advent Sunday of the year.
Rules
The \$4^\text{th}\$ Advent is determined by the Sunday before Christmas day (the \$25^\text{th}\$ of December). The \$3^\text{rd}\$ Advent is the Sunday before the \$4^\text{th}\$... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.