instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
There is a 1x1x1 cube placed on a infinite grid of 1x1 squares. The cube is painted on every side, so it leaves a mark on the grid when it moves.
The sides of the cube are colored 6 distinct colors, re-presentable with any 6 distinct values. A 7th value represents a blank space.
The cube can roll around the grid. Ever... | stackexchange_codegolf |
Introduction
In a list of strings, there is a certain length you can shorten strings to before they become indistinguishable. This is a pretty bad explanation, so here is an example.
['hello', 'help', 'helmet']
['hell', 'help', 'helme']
['hell', 'help', 'helm']
['hel', 'hel', 'hel'] <- At this point the strings are i... | stackexchange_codegolf |
(Randomly inspired by https://codegolf.meta.stackexchange.com/a/17272/42963)
Given a rectangular matrix of digits (i.e., 0 - 9), output the "pieces" of the matrix as if the digits are connected together forming a single piece, in ascending order by the digits. The pieces are guaranteed to connect only orthongonally -- ... | stackexchange_codegolf |
Task
A pure mirror checkmate is a checkmate position, where the mated king is surrounded by 8 empty squares which are attacked or guarded by the winning side exactly once. You will be given a valid chess position where Black is in mate. Your task is to find if that mate is a pure mirror checkmate.
Examples (click for l... | stackexchange_codegolf |
User inputs an integer. Print out proper fractions using all positive integers up to the user's input, in ascending order.
Rule 1: Eliminate equal fractions.
Rule 2: Fractions should be in their simplest form.
Rule 3: Use "/" as a fraction symbol and next line (\n or \r as convenient) as a separator between fractions.
... | stackexchange_codegolf |
Given a large number (in base 10), such as 1234567891011121314151617, find prime "subnumbers" in it.
A prime "subnumber" is a consecutive sequence of digits (taken from the input), which represents a prime number (in base 10).
Input:
A number (either a string, a file, or whatever you like).
Output:
All prime subnumb... | stackexchange_codegolf |
Letters of the words want fairness.
They decided to appear same number of times in a sentence equally.
Example:
Priorities
Will become:
Ppprrioooritttieeesss
Each letter appears 3 times, as the most common letter was i, appearing 3 times.
It does not matter where you put the repeated letters, as long as they are next... | stackexchange_codegolf |
Intro
In most fonts all of the uppercase alphabet characters besides BDO have single lines approximately touching some of the four corners of the character's bounding rectangle: ACEFGHIJKLMNPQRSTUVWXYZ.
For example, the two legs of an A "touch" the bottom left and bottom right corners of the character. Likewise, C touc... | stackexchange_codegolf |
This is kept fairly original:
Write a program that creates a standard blackjack game:
input "h" means hit or draw another card
input "s" means stand, or take what you have already
Rules:
cards values are as follows:
2-9 = face value of card
10, J, Q, K = 10
aces = 11 unless player busts, then it's only a 1
if 2 or m... | stackexchange_codegolf |
A number theory expression contains:
There exists at least one non-negative integer (written as E, existential quantifier)
All non-negative integers (written as A, universal quantifier)
+ (addition)
* (multiplication)
= (equality)
>, < (comparison operators)
&(and), |(or), !(not)
(, ) (for grouping)
variable names(all ... | stackexchange_codegolf |
Standardized testing usually comes with a scan-tron or some type of answer document that records your answer. A computer or human(s) would then check your answers and determine your grade. So here, given a scan-tron and the answer key, determine the score and questions missed if any. A scan-tron is just a document with... | stackexchange_codegolf |
You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
Each line will look something like this:
[app_name] Something horrible happened!
App ... | stackexchange_codegolf |
Background:
Standard operation math like basic addition and multiplication in the real world work like these:
12 + 123 = 135
and
12 * 123 = 1476
That's not interesting and boring! Many schools are already interpreting this as practice, practice, practice of formal algorithms. That implies a pretty rigid and boring ma... | stackexchange_codegolf |
Here's an interesting challenge...
I want you to golf code that when executed will allow your input to be converted to mimic output as though you were typing on a DVORAK keyboard layout.
The aim is to mimic the US Simplified Dvorak Keyboard (US:SDK)
In comparison, here is the standard US QWERTY layout:
The keyboard e... | stackexchange_codegolf |
This is the robbers' challenge. To post a cop, go here.
In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into the interpreter, trans... | stackexchange_codegolf |
Input variables:
(Names are just examples, they don't need to be named like this)
GrandTotal - integer to divide
SplitCount - number of output integers required
UpperLimit - highest valid value for any one output integer
LowerLimit - lowest valid value for any one output integer
Valid Output:
Outout must be a random ... | stackexchange_codegolf |
After inputting a string [length 1-20], only containing the chars y for yes and n for no,
your program should output the result (y or n). Example input: yynynynny would output y.
The result is determined by combining the y's and n's in the following way:
yes and no equals no
yes and yes equals yes
no and no equals yes... | stackexchange_codegolf |
Some of you may be familiar with the BigNum Bakeoff, which ended up quite interestingly. The goal can more or less be summarized as writing a C program who's output would be the largest, under some constraints and theoretical conditions e.g. a computer that could run the program.
In the same spirit, I'm posing a simila... | stackexchange_codegolf |
kolmogorov-complexity is one of the tags on this site, representing challenges that test how much code is needed to output a given fixed result (usually a piece of text). The info page for this tag lists the string 4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd as an example of a string with a high Kolmogorov complexity, sta... | stackexchange_codegolf |
In 2015 the Portland International Airport began the replacement of their iconic carpet. I want you to write a program to draw their old carpet in as few bytes as possible.
The carpet:
Specifications
Here is a link to a scalable pdf image of one tile. Your output should match the relative dimensions and placement o... | stackexchange_codegolf |
Is there any javascript-like language? Something that can be interpreted by browsers?
| stackexchange_codegolf |
Being a Haskell hacker, I prefer pointfree notation over pointful. Unfortunately some people find pointfree notation hard to read, and I find it hard to get the correct number of parentheses when I write in pointful.
Help me convert code written in pointfree to pointful notation!
About
In pointfree notation we use poin... | stackexchange_codegolf |
Story
Martians have been observing Aussie rules football matches from space with great curiosity. Having totally fallen in love with the game, they have been inspired to start their very own football league. However, being dim-witted creatures, they are unable to comprehend the scoring system.*
We know that in Aussie r... | stackexchange_codegolf |
Contest permanently opened - Updated August 10th 2017
Even though on June 5th 2017 I declared a winner (who will be kept as the best answer) I'll be rnning new bots and updating the results.
June 5th Results
Congratulations user1502040
Since there are no ties, I only show the % of matches won.
Statistician2 - 95.7%
Fit... | stackexchange_codegolf |
In chess, a knight can only move to the positions marked with X relative to its current position, marked with ♞:
A Knight's Graph is a graph that represents all legal moves of the knight chess piece on a chessboard. Each vertex of this graph represents a square of the chessboard, and each edge connects two squares th... | stackexchange_codegolf |
Given the name of a cation and anion, output "S" (soluble) or "I" (insoluble). The table we will be using is from wikipedia: https://en.wikipedia.org/wiki/Solubility_chart. It is copied at the end of the question for future reference.
Input: The cation, followed by the anion, separated by a space. The cation will be on... | stackexchange_codegolf |
Your task is to generate a null-pointer exception. That is, your program must accept a value which it expects to be non-null, and throw an exception/error or crash because the value is null.
Furthermore, it can't be obvious from reading the code that the value is null. Your goal is to make it seem clear to the reader t... | stackexchange_codegolf |
The input message consists of ASCII characters
The encoded output message consists of blocks of 0
A block is separated from another block by a space
Two consecutive blocks are used to produce a series of same value bits (only 1s or 0s):
After the ACSII character(s) have been converted to binary, go through the string:
... | stackexchange_codegolf |
I was doing some investigation into trig functions using compound angles recently, and noticed that the results are really long and tedious to write:
$$
\cos(A+B) = \cos A \cos B - \sin A \sin B \\
\cos(A-B) = \cos A \cos B + \sin A \sin B \\
\sin(A+B) = \sin A \cos B + \sin B \cos A \\
\sin(A-B) = \sin A \cos B - \sin... | stackexchange_codegolf |
Your task is to convert Chinese numerals into Arabic numerals.
A problem similar to Convert Chinese numbers, however, more complex. Also, answers given there mostly don't satisfy all the conditions.
Chinese digits/numbers are as follows:
0 零 1 一 2 二 2 两 3 三 4 四 5 五 6 六 7 七 8 八 9 九 10 十 100 百 1000 千 10000 万 10^8 亿
Multi... | stackexchange_codegolf |
Background
Match Land is a mobile game that falls into the Match-3 genre (think Bejeweled or Candy Crush Saga series): swap two orthogonally adjacent pieces to make a 3-in-a-row or longer. However, Match Land has an additional rule that makes the game much more interesting.
Once you make a valid match-3 move, the match... | stackexchange_codegolf |
Given a positive number n, output all distinct multiplicative partitions of n in any convenient format.
A multiplicative partition of n is a set of integers, all greater than one, such that their product is n. For example, 20 has the following distinct multiplicative partitions:
2 * 2 * 5
2 * 10
4 * 5
20
Order does no... | stackexchange_codegolf |
Do you know Icy Tower ? Here is a gameplay example of what i'm talking about
The game concept is simple : you play as Harold the Homeboy, and your goal is to jump from floors to floors to go as high as possible without falling and getting off-screen ( the camera goes higher following you or at a speed that gets faster ... | stackexchange_codegolf |
Background
An L-system (or Lindenmayer system) is a parallel rewriting system that, among other things, can be easily used to model fractals. This question concerns deterministic, context-free L-systems. These consists of an alphabet of symbols, an initial axiom string and a set of rewrite rules mapping each alphabet s... | stackexchange_codegolf |
Context
Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. This is the basic skeleton almost everyone follows.
Task
Your task, should you choose to accept it, is to write a program/f... | stackexchange_codegolf |
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 |
We've had a lot of quine challenges, but a lot of the quine formats are similar, lets create some variance in our quines.
Your task is to create a selection of programs in the same language (at least 2), all of which output their own source code, however, none of these programs can share any characters.
For example, if... | stackexchange_codegolf |
The majority function is a boolean function which takes three boolean inputs and returns the most common. For instance if maj(x,y,z) is the majority function and T denotes true and F denotes false then:
maj(T,T,T) = T
maj(T,T,F) = T
maj(T,F,F) = F
maj(F,F,F) = F
This question concerns writing boolean functions as comp... | stackexchange_codegolf |
(This is OEIS A057531.)
Your task
Given a positive integer, \$n\$, find the \$n\$th number where the digit sum equals the number of factors
Explanation
For example, let's take 22:
Its factors are \$[1, 2, 11, 22]\$ (length: 4).
Its digit sum is 4.
This means that it is a number where the digit sum equals the number of ... | stackexchange_codegolf |
Background
Set is a card game. The deck consists of 81 unique cards that vary in four features: number of shapes (one, two, or three), shape (diamond, squiggle, oval), shading (solid, striped, or open), and color (red, green, or purple).
For convenience, let's write a card as a 4-tuple of numbers from 1 to 3, e.g.
111... | stackexchange_codegolf |
Thanks to this question for some inspiration
In this challenge we will represent a line of dominoes as a string of |, / and \. You will be given a string of dominoes as input and you must determine what they look like when they have settled. Here are the rules for how dominoes fall over
A standing domino, |, left ... | stackexchange_codegolf |
Subleq is a Turing-complete esolang with only one instruction, SUBLEQ. This instruction takes in three parameters, A, B, and C, all of which are memory addresses. The instruction subtracts the value in memory address A from that in memory address B, storing it in address B. If the value at B is now less than or equal t... | stackexchange_codegolf |
Your task is to make a program that takes in an integer n > 1, and outputs the roll of a single n-sided die. However, this dice follows the rules for exploding dice.
When you roll the die, check what value you rolled. If you got the maximum for that kind of die (on a standard d4 that would be 4, or 6 on a d6, etc.), ro... | stackexchange_codegolf |
Non-associative operators (for example the subtraction-operator) often are either left- or right associative, such that one has to write less parentheses. Consider for example the following:
$$
a-b-c
$$
Probably everybody read that as \$(a-b)-c\$, by default (usually) subtraction is left-associative.
Now let us conside... | stackexchange_codegolf |
Thanks to rak1507 for the suggestion
"Random" in this challenge always refers to "uniformly random" - of all possible choices, each has an equal chance of being chosen. Uniform shuffling means that every possible permutation of the array has an equal chance of being chosen.
Given an array consisting of positive digit... | stackexchange_codegolf |
Inspired by Bake a slice of Pi
Challenge
Given input 3 <= n <= 100 and 3 <= y <= n, construct an n x n matrix of the decimal portion of pi (14159...), starting in the top left. Then, take the upper-right triangle of size y x y and concatenate it together. Output the resulting number.
For example, for input n = 5, y = 3... | stackexchange_codegolf |
Write a program or function that takes input and outputs/returns a full program (in the same language) that outputs said input.
Note that the input may contain any printable ASCII character or newline (AKA 0x20-0x7f and 0x0a). However, the input will not have trailing whitespace nor preceding whitespace, nor will it be... | stackexchange_codegolf |
The goal is to get all combinations of hold'em starting hands (every two card combination) in the shortest amount of code.
A hold'em hand is two distinct cards dealt from a standard deck of 52 cards, with deal-order being irrelevant, as such there are 52*51/2 = 1326, hands.
There is also a commonly used notation for th... | stackexchange_codegolf |
Introduction
I began studying the Collatz Conjecture
And noticed these patterns;
0,1,2,2,3,3...A055086, and 0,1,2,0,3,1...A082375,
in the numbers that go to 1 in one odd step,
5,10,20,21,40,42...A062052
Related like so;
A062052()(n) = ( 16*2^A055086(n) - 2^A082375(n) ) /3
The formula for A055086 is $$\lfloor\sqrt{4... | stackexchange_codegolf |
Input
An array that can contain arrays or positive, consecutive, ascending integers. The arrays can have any number of arrays inside of them, and so on and so forth. No arrays will be empty.
Output
This array simplificated
How to simplificate an array
We will use the array, [1, [2, 3], [[4]], [[[5, 6], 7, [[[8]]]], 9]]... | stackexchange_codegolf |
Winner found
It seems as if we have a winner! Unless anyone plans on contesting the world's current fastest Sudoku solver, user 53x15 wins with the staggeringly fast solver Tdoku. For anyone still working on their solvers, I'll still benchmark new submissions when I have time.
The challenge
The goal of a game of Sudoku... | stackexchange_codegolf |
The Question
A Sophie Germain prime is a prime \$p\$ such that \$2p+1\$ is prime as well. For example, 11 is a Sophie Germain prime because 23 is prime as well. Write the shortest program to calculate Sophie Germain primes in ascending order
Rules
The Sophie Germain primes must be generated by your program, not from a... | stackexchange_codegolf |
As a celebration of good old Notepad, we are going to treat carriage returns and line feeds as what they originally meant, rather than what they are (ab-)used for today.
Given a string consisting of printable ASCII plus line feeds (␊; LF; esc \n; hex 0A; dec 10) and carriage returns (␍; CR; esc \r; hex 0D; dec 13), cau... | stackexchange_codegolf |
A pangram is a sentence or excerpt which contains all twenty-six letters of the alphabet, as is demonstrated in this code golf challenge. However, a pangrammatic window is a pangram in the form of some segment of text, which may end or begin halfway through a word, found somewhere within a larger work. These naturally ... | stackexchange_codegolf |
In @Adám's Dyalog APL Extended, the ⍢ (under) operator means conjugation: apply one function, then a second function, then the inverse of the first. It's fun to think of real-life actions in terms of conjugation:
A problem is transformed by g into another domain where it more
readily solved by f , and then transfor... | stackexchange_codegolf |
Alternatively: Now you're checking with portals!
Inspired this challenge
I am somewhat of a self-declared Chess Anarchist. That means that when I play chess, en passant is forced (else the brick gets used), double check is mate (and pasta), and all sorts of new pieces and squares are added to the game.
One such piece i... | stackexchange_codegolf |
Introduction
By steganography we mean hiding a message along an existing text or image so the result would be unsuspicious of the existence of the original message. This challenge is about hiding data in Unicode variants of a grapheme called homoglyphs. For instance:
cyrillic Е (ye) appears the same as latin E which ap... | stackexchange_codegolf |
Challenge
Given a string such as Hello World!, break it down into its character values: 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33.
Then calculate the difference between each consecutive pair of characters: 29, 7, 0, 3, -79, 55, 24, 3, -6, -8, -67.
Finally, sum them and print the final result: -39.
Rules
... | stackexchange_codegolf |
As you may or may not know, Valentine's day is getting close. So today, my task for you is:
Write a heart-shaped quine
Rules:
Code should look like an identifyable heart shape, i.e. Has two round parts on top and a pointy bottom. It does NOT have to be filled in, but this is not disallowed.
Standard Quine rules apply ... | stackexchange_codegolf |
Introduction
The Boids Algorithm is a relatively simple demonstration of emergent behavior in a group. It has three main rules, as described by its creator, Craig Reynolds:
The basic flocking model consists of three simple steering behaviors which describe how an individual boid maneuvers based on the positions and ve... | stackexchange_codegolf |
Stevin's Notation is a way to represent decimals in a non-fractional way.
The Flemish mathematician and engineer Simon Stevin is
remembered for his study of decimal fractions. Although he was not the
first to use decimal fractions (they are found in the work of the
tenth-century Islamic mathematician al-Uqlidisi), it ... | stackexchange_codegolf |
This challenge is to write a minimax function in a language of your choice, to output the next best move in an NxN game of tic-tac-toe given the current board state. The board input can be accepted as a Matrix, 2D Collection or anything else that makes sense to you, but adheres to the rules. The output being the next b... | stackexchange_codegolf |
The goal of this challenge is to write a program or function that returns the least amount of strikes needed to complete a given course.
Input
The layout of the course can be passed in any suitable way and format you prefer.
(read from the console, passed as an input parameter, read from a file or any other, multilin... | stackexchange_codegolf |
Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move when folded.
Cubax is composed of N³ smaller cubes (elements) linked together in a kind of doubly linked chain. The chain h... | stackexchange_codegolf |
Your program must take an input (n for the purpose of description) and output all permutations of a number that is n digits long with no repeating digits, where each of the digits preceding and including its index are divisible by the place in the number that it falls.
You can read about magic numbers here.
Rules:
1 <... | stackexchange_codegolf |
You might know Alan Walker from his ever popular song Faded. Now his "followers" are called Walkers and they have a logo, here is a simplified version:
\\
\\ //\\
\\ // \\ //
\\ // \\ //
\\ // \\ //
\\ // \\ //... | stackexchange_codegolf |
Given \$a\$ and \$b\$, both odd \$n+1\$-bit integers, compute \$a/b\$ to a precision of \$n+1\$ bits in the 2-adic integers. That is, compute \$c\$ such that \$a = bc\, (\mathop{\rm mod} 2^{n+1})\$. \$n\$ should be your language's native integer size, or if native integers are bigints, take it as a parameter. If your l... | stackexchange_codegolf |
Write a program that takes in a number N from 1 to 9 inclusive. In its native form your program should output N+N. E.g. output 2 if N is 1, 4 if N is 2, 6 if N is 3, and so on.
When every character in your program is duplicated in place, then it should be a program that takes in N (still from 1 to 9) and outputs N×N. E... | stackexchange_codegolf |
The challenge
Make 2 programs which convert decimal to and from base 94, or a bidirectional program.
Base 94?
Base 94 is like any other base, but instead of 0 to 9 and letters, it uses ASCII characters 33 to 126. Not 127 because chr(127) is DEL. Not 32 because that's a space.
Examples
0 - ! or empty string
1 - "
93 - ~... | stackexchange_codegolf |
For each row and then column of a matrix, we can add an extra entry with the sum of the last two entries in that row or column. For example with the following input matrix:
[ 1 1 1 ]
[ 2 3 4 ]
The resulting matrix would be:
[ 1 1 1 2 ]
[ 2 3 4 7 ]
[ 3 4 5 9 ]
Given an input of an integer N and an [X,Y] matrix of siz... | stackexchange_codegolf |
The Challenge
Write a complete program that writes twice as many bytes to standard output as the length of the program.
Rules
The program must write ASCII characters to the standard output.
The contents of the output doesn't matter.
The output, measured in bytes, must be exactly twice the length of the program, also ... | stackexchange_codegolf |
Who are they?
Primus-Orderus Primes (POP) are primes which contain their order in the sequence of primes.
So the nth prime, in order to be POP, must contain all the digits of n in a certain way which I'll explain.
Examples
Let's get things clearer:
All digits of n must appear among the digits of POP in the same order t... | stackexchange_codegolf |
You are given a polynomial function, in the following format:
\$x = (c_0 * y^0) + (c_1 * y^1) + (c_2 * y^2) + ... + (c_n * y^n)\$
where \$c_n\$ stands for the coefficient of the \$n^{th}\$ power of \$y\$
You have to plot the equation on a \$10 * 10\$ ASCII matrix. The value must be floored to an integer before plotting... | stackexchange_codegolf |
Rocket Bots
The year is 3024. People have become too scarce a resource to risk in war, so combat has shifted to the robots. Your task is to construct a bot like no other, who's rockets will rain destruction down on your foes and shoot down all incoming threats.
Gameplay
Bots
Gameplay takes place on a 10x15 grid. Your b... | stackexchange_codegolf |
Task
Given an integer \$n\in[0,10^{12})\$ in any convenient format, return the number of strokes needed to write that character in simplified Chinese.
Background
Chinese numerals are expressed in base 10 with a system of digits and places, with an important distinction that digits are in groups of four, rather than thr... | stackexchange_codegolf |
There was a previous perceptron question but it was closed. Also it required a lot of extra stuff that's not normally part of the perception algorithm like I know it. This question will be much simpler
The Perceptron is a extremely basic classification algorithm. While it still has some limited use it's been mostly ove... | stackexchange_codegolf |
PROBLEM
For a list of numbers, list: Find the lowest possible integer, x, which is optimally close to the whole number even-harmonics of the values in list.
list has a length of n, and all of the values in list are <= 2000
x has a precision of 1.0 (integers only), and must be a value in the range [20, 100]
An even-har... | stackexchange_codegolf |
Challenge
Given a number x, output the first x powers of two, starting with 2¹ (2).
Example
2 2 4
3 2 4 8
1 2
6 2 4 8 16 32 64
You may output numbers separated by non-numerical characters. You may not just output them mashed together like 248163264128.
Rules
In your code, you may only use the number 2. You m... | stackexchange_codegolf |
Introduction
I defined the class of antsy permutations in an earlier challenge.
As a reminder, a permutation p of the numbers from 0 to r-1 is antsy, if for every entry p[i] except the first, there is some earlier entry p[i-k] such that p[i] == p[i-k] ± 1.
As a fun fact, I also stated that for r ≥ 1, there are exactly ... | stackexchange_codegolf |
The purpose of this challenge is to solve the original first Project Euler problem, but as the title suggests in constant time (with respect to the size of the interval).
Find the sum of all the multiples from a list of numbers in some defined range, in such a way that the running time of your program runs in constant... | stackexchange_codegolf |
The set of all polynomials with integer coefficients is countable.
This means that there is a sequence that contains each polynomial with integer coefficients exactly once.
Your goal is it to write a function or program that outputs such a sequence.
Example (you may use another sequence):
// list of integers [i -> Z(i)... | stackexchange_codegolf |
Skat
I'm a fan of anagrams, so given two strings s1 and s2 write a program or function that outputs a truthy value if s2 is an anagram of s1, and a falsey value otherwise (not accounting for spaces and capital letters).
For example:
Input: s1 = "Anagram"; s2 = "Nag a ram"
true
Input: s1 = "stack overflow"; s2 = "fewe... | stackexchange_codegolf |
Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line.
So the end-result becomes:
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
ooooooo... | stackexchange_codegolf |
I came across this picture, which I initially questioned and thought about posting to Skeptics. Then I thought they'll only tell me if this one case is true, but wouldn't it be great to know how true any "rule" really is? Today you're going program a skeptic-bot
Challenge
Write a program or function which when given a ... | stackexchange_codegolf |
Background
I feel that for a site named code-golf we have a shockingly little amount of golf being played. Let's fix that.
Challenge
Determine whether the hole of a minigolf course can be reached after exactly a certain number of movements and whether it can be reached at all.
How to play
Inputs are an integer "power l... | stackexchange_codegolf |
Challenge
Construct n strings, each with three distinct letters, chosen randomly with equal probability.
Print the proportion k/n where k is the number of strings such that all three characters are in ascending order. Print also those k strings.
Input
The only input is n (and thus it must be a positive integer).
Ou... | stackexchange_codegolf |
I was browsing esolangs, and chanced upon this language: https://github.com/catseye/Quylthulg.
One interesting thing about this language, is that it doesn't use prefix, postfix, or infix, it uses all three of them, calling it "panfix" notation.
Here is an example. To represent normal infix 1+2 in panfix, it becomes: +1... | stackexchange_codegolf |
The golfing language Jelly has a very complex and clever string compression system which I'm not going to go into depth about here. You can find a very good explanation here.
Basically, Jelly's string literals are represented as “...», where ... is a string of characters from Jelly's codepage that is decoded into a bas... | stackexchange_codegolf |
Description
Write a program or function that takes in a positive integer \$n\$ as input and outputs all Sophie Germain primes that are safe primes less than or equal to \$n\$. A prime number \$p\$ is a Sophie Germain prime if \$2p+1\$ is also a prime. A prime number \$p\$ is a safe prime if \$p=2q+1\$, where \$q\$ is a... | stackexchange_codegolf |
Input
A positive integer N representing the size of the problem and four positive integers v, x, y, z.
Output
This is what your code should compute. Consider a set of N distinct integers and consider all ways of choosing 3 subsets (which can overlap) from the set. There are \$2^{3N}\$ different possible ways of choos... | stackexchange_codegolf |
Challenge: I want to know about the real roots of polynomials. As a pure mathematician, I care about the existence of such roots, rather than their numeric values.
The challenge is to write the shortest program that takes a polynomial, of degree at most 4, and simply returns how many distinct real roots said polynomial... | stackexchange_codegolf |
I'd love to take a number and know how many syllables are in it, when spoken in English.
Let's limit this to positive integers which are less than one thousand.
I'm British, so we're going to follow the hundreds column with an 'and' when there are any non-zero digits after it.
The Challenge
Write some code which will ... | stackexchange_codegolf |
Given an array of letters in the range 'a' to 'o', compute how to construct the array by successively inserting the letters in alphabetical order. You will always start the insertion with a base array of all the 'o's that are in the array to be reconstructed.
Examples
Let the input array be:
['o', 'b', 'o', 'b', 'a']
... | stackexchange_codegolf |
I apologize if this isn't fit for this site but it is a puzzle, not all that practical, so I thought it would fit.
Take this code:
string s = "";
Console.WriteLine(ReferenceEquals(s, string.Empty));
This will print out true because "" is interned by the JITter at some early point and literals are reused from the inter... | stackexchange_codegolf |
This challenge was xnor's idea, taken from Digital Trauma's challenge donation thread.
Your challenge is to write a program that, as xnor put it, "procedurally generate[s] the splotchy black-and-white marbled pattern on the covers of composition notebooks":
Your program can either display it on the screen or save it ... | stackexchange_codegolf |
2fuck is a simple 2D variation on brainfuck. Like traditional brainfuck, there is an 1D memory tape that extends 30000 bytes to the right from its beginning, consisting of values between 0 and 255.
Arithmetic should wrap around, adding 1 to 255 sets the cell to 0, and moving right from memory cell 29999 should move the... | stackexchange_codegolf |
This is a more difficult version of It's a find-a-movie challenge .
Input
Your code should take a BBFC rating and a number from 1 to 5 as input. It can do this in any way you find convenient.
Output
Your code should return the name of any movie which has a) that film rating and b) that number of stars in a Guardian fi... | stackexchange_codegolf |
This is code golf. Fewest bytes wins, only standard libraries, etc.
Write code, in any language, to output all possible same-length permutations of all items of an array / list / object in the input format and any order, grouped in whatever way you like. The items can be of ANY type, as allowed by the programming langu... | stackexchange_codegolf |
Not to be confused with Is my OS 32-bit or 64-bit.
This one is very simple, tell me whether or not my CPU supports 64-bit instructions. If my CPU supports 32-bit instructions, print '32', if my CPU supports 64 bit instructions, print '64', if my processor naitively supports other lengths of instructions, print 'other'.... | stackexchange_codegolf |
Create a program that solves a mathematical expression using the elements from alternating sides of the expression. The way it’s done is, instead of reading from left to right, you read the first character, then the last, then the second, then the second to last etc. This will give you a new expression that you must ev... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.