instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Write a program or function that draws an ASCII star, given the size of the arms as input.
Here's a star of size 1
_/\_
\ /
|/\|
Here's a star of size 2
/\
__/ \__
\ /
\ /
| /\ |
|/ \|
Here's a star of size 3
/\
/ \
___/ \___
\ /
\ /
\ /
| /\ |
| / \ |
|/... | stackexchange_codegolf |
Given two real numbers (postive or negative) in the limits of float pointing number data types, i.e., (\$-3.4e38\$ to \$3.4e38\$) not inclusive, you should output the max of the two reversed numbers.
TEST CASES
Example
Input:
135
210
Output:
531
\$531\$ is \$135\$ reversed, which is greater than \$012\$, i.e., \$210... | stackexchange_codegolf |
All variables in this question are integer valued.
Input
4 integers w, x, y, z. They can be positive or negative and will be less than 1048576 in absolute value.
Output
The general solution to the equation.
\$ aw+bx+cy+dz = 0 \$.
The variables \$a, b, c, d\$ must all be integer values.
Output format
Your output should ... | stackexchange_codegolf |
Challenge
Write a program or a function that returns or prints a square-random-symmetrical matrix.
Input
N: The size of the matrix i.e 6 x 6
Output
The matrix. You can either print it, return it as string (with the newlines) or as a list/array of lists/arrays.
Rules
You need to use at least N different characters, ... | stackexchange_codegolf |
Your challenge is to write a program, function, etc. that calculates if the passed string is "in order". That means that the characters of the string have character codes that are in order from smallest to largest. The smallest char code must be the first. By that I mean lowest unicode codepoints to highest. It doesn'... | stackexchange_codegolf |
Challenge
Given a polynomial \$p\$ with real coefficients of order \$1\$ and degree \$n\$, find another polynomial \$q\$ of degree at most \$n\$ such that \$(p∘q)(X) = p(q(X)) \equiv X \mod X^{n+1}\$, or in other words such that \$p(q(X)) = X + h(X)\$ where \$h\$ is an arbitrary polynomial with \$ord(h) \geqslant n+1\... | stackexchange_codegolf |
We all know and love the corpulent DDL expressions one can write in PostgreSQL with wording like DEFERRABLE INITIALLY DEFERRED, ALTER FOREIGN DATA WRAPPER, or even DROP TEXT SEARCH CONFIGURATION. But how far can one go? Here comes the definitive challenge for the longest DDL expression, with constraints of course. Mwah... | stackexchange_codegolf |
Your task is to regulate traffic on a crossroads. There are 4 roads coming from north, east, south and west.
The input is a string representing the upcoming traffic on each road. For example, NNNWS indicates there is a total of 5 cars: three at the north, one at the west and one at the south. The order of characters ha... | 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 |
(There exists some challenges that require to use the best strategy, but here we don't. Even if you are able to win, you are allowed to make a tie)
Challenge
Write a program which plays the game tic-tac-toe. It must not lose (therefore, it should end the game either with a tie or by winning).
Allowed I/O methods
Input... | stackexchange_codegolf |
Curling is a sport where two teams aim to place stones as close to the centre of a target as possible. The winner of a curling end is the team whose stone is closest to the centre – they score as many points as the number of their stones closer to the centre than any of their opponents.
Task
Given two lists of pairs of... | stackexchange_codegolf |
The Problem
You must write a program that, when the Konami Code is typed in during runtime, prints the string "+30 lives" and sounds a noise of your choice from the computer's speaker.
Definition
The "Konami Code" is defined as UUDDLRLRBA followed by pressing the enter key.
The Rules
You may choose to use the up arrow... | 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 |
Challenge:
Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The first program must output the integer 1, the second one 2 and so on.
You can not reuse any characters between the programs. So, if the first program is: x==x, then you may not u... | stackexchange_codegolf |
The oldest Polish salt mine, located in Bochnia*, was started in year 1248, which we can consider a magical number. We can see that it's equal to 4 digits from the sequence of exponentiations: .
As the date is actually 4 digits from the sequence, we could make it longer. We could repeat the process until we reach infin... | stackexchange_codegolf |
Introduction
A circle-tangent polynomial is a polynomial of degree \$N\ge3\$ or above that is tangent to the unit circle from inside at all of its N-1 intersection points. The two tails that exits the circle are considered tangent at their intersection points from inside as well. You may consider such polynomials are w... | stackexchange_codegolf |
Related: Rather similar (but much easier) challenge horizontally: There I fixed it (with tape)
Challenge:
Given a string only containing upper- and/or lowercase letters (whichever you prefer) and new-lines, put rope vertically to fix it. We do this by checking the difference of two adjacent letters in the alphabet (ign... | stackexchange_codegolf |
First puzzle from me, suggestions for improvement gladly received!
The scenario is;
You work as a manager for a whitewater rafting company. Every morning, you are given a list of bookings, and you have to sort them into raft loads. Write a program or function in your chosen language that does this for you.
Each raft ho... | stackexchange_codegolf |
Box blur is a simple operation for blurring images. To apply box blur, simply replace each pixel with the average of its and the surrounding 8 pixels' values. Consider, for example, the following example, in which each "pixel" has a one-digit value:
\begin{array} {|r|r|}\hline 1 & 1 & 1 \\ \hline 1 & 7 & 1 \\ \hline 1 ... | stackexchange_codegolf |
Let us define a sequence. We will say that \$a(n)\$ is the smallest number, \$x\$, that has the following properties:
\$x\$ and \$n\$ are co-prime (they share no factor)
\$x\$ does not appear earlier in the sequence
\$|n - x| > 1\$
Unlike most sequences the domain and range of our sequence are the integers greater t... | stackexchange_codegolf |
Given a volume level V in the range 1-10. Your program should draw the following ASCII art.
When V=1:
\
|
/
When V=2:
\
\ |
| |
/ |
/
When V=3:
\
\ |
\ | |
| | |
/ | |
/ |
/
And etc. Trailing spaces are allowed.
This is a code-golf challenge so the shortest solution wins.
| stackexchange_codegolf |
Curling is a sport where two teams aim to place stones as close to the centre of a target as possible. The winner of a curling end is the team whose stone is closest to the centre – they score as many points as the number of their stones closer to the centre than any of their opponents.
Task
Given two lists of pairs of... | stackexchange_codegolf |
Background:
I originally posted this question last night, and received backlash on its vagueness. I have since consulted many personnel concerning not only the wording of the problem, but also its complexity (which is not O(1)). This programming problem is an evil spin on an Amazon interview question.
Question:
Given a... | stackexchange_codegolf |
Create a program that determines, given an input of the path, whether Mario can reach the end, denoted by E, from the start, denoted by S.
A path will look something like this:
S = E
=====
In a path, the various symbols and what they represent are:
=: wall/floor/ceiling. Mario cannot walk through wall , and cannot fa... | stackexchange_codegolf |
Problem
Starting with a set of 10 coins at the start where all coins are tails up, and given n number of integers \$x_1, x_2, x_3... x_n\$ representing n rounds of coin flipping.
At each round, we randomly flip \$x_i\$ number of coins at random. i.e Coins that were heads become tails, and vice versa. Within each round,... | stackexchange_codegolf |
Background
Celebrating the release of Dyalog APL 16.0, where the solution to this problem is {⊢⌺(≢⍵)⊢⍵}Explanation
Task
Given a printable ASCII string of odd length n, make an n × n square with the string centered horizontally, duplicated to be centered vertically, and with acrostics of the same string in each row and ... | stackexchange_codegolf |
In Minecraft, the default item textures are all reasonably simple 16×16 pixel images, which makes them seem ideal for golfing.
Below are simplified textures of the five "core" diamond tools in Minecraft: pickaxe, shovel, axe, sword, and hoe.
The images shown are enlarged to show their detail. Click on an image to view ... | stackexchange_codegolf |
Inspired by this and this question
Challenge
Your challenge is to print any 100 consecutive digits of Champernowne's Constant. You must give the index at which that subsequence appears. The 0 at the beginning is not included.
For example, you could print any of the following:
+-----+------------------------------------... | stackexchange_codegolf |
I use "suffix" loosely here to mean "any sub-string that follows the prefix".
"Prefix" here means the START of a word, where a word's start is defined as either after a space or from the first character of the input text (for the first word). A "prefix" in the middle of a word is ignored.
E.g. if your input prefix is "... | stackexchange_codegolf |
Challenge
Given some input string, return a truthy value if it represents a correct roman numeral between 1 (=I) and 3999 (=MMMCMXCIX), and a falsey value otherwise.
Details
The input is a non-empty string that only comprises the characters IVXLCDM.
The roman numerals (that we use here in this challenge) are defined a... | stackexchange_codegolf |
The edit distance between two strings is the minimum number of single character insertions, deletions and substitutions needed to transform one string into the other.
This task is simply to write code that determines if two strings have edit distance exactly 2 from each other. The twist is that your code must run in l... | stackexchange_codegolf |
In golf, a knowledgable caddie helps an already good golfer to be even better. In this challenge, you build a "caddie" to help you code golf. In particular, your caddie will compress golfed code in such a way that another program can uncompress and then run the code. A good caddie will compress golfed code to be much s... | stackexchange_codegolf |
Given a set of two strings guaranteed to be the same length, print their criss cross.
The criss cross of two strings is obtained as follows.
Yield the second character of the second string, then the first character of the first string.
Yield the first character of the second string, then the second character of the fi... | stackexchange_codegolf |
Introduction
I Ching is an ancient divination text and the oldest of the Chinese classics. It uses a type of divination called cleromancy, which produces apparently random numbers.
The basic unit of the Zhou yi is the hexagram (卦 guà), a figure composed of six stacked horizontal lines (爻 yáo). Each line is either broke... | stackexchange_codegolf |
Background
You've been given a task to take notes for a meeting. You start typing on your Google Doc, but you don't have enough time during the meeting to look at your keyboard while you type.
Fortunately for you, you can type without looking at your keyboard. After the meeting, you realize that everything you typed wa... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 3.
On the way to vacation, you're traveling through a forest on an airplane. For some biological and geological reasons, the trees in this forest grow only at the exact integer coordinates on a grid, and the entire for... | stackexchange_codegolf |
Given two strings, find the translation table (substitution cipher) between the two, if the translation is not possible, output false. The answer must be minimized and created from left-to-right. The first character to be translated between words must be the first in the translation table. In addition to this, any lett... | stackexchange_codegolf |
Background
A super-prime is a prime number whose index in the list of all primes is also prime. The sequence looks like this:
3, 5, 11, 17, 31, 41, 59, 67, 83, 109, 127, 157, 179, 191, ...
This is sequence A006450 in the OEIS.
Challenge
Given a positive integer, determine whether it is a super-prime.
Test Cases
2: f... | stackexchange_codegolf |
Given three integers >= 2, create an ASCII cube in an orthogonal (cabinet) projection.
The three integers represent height, width and depth (measured in visible characters) including the corners. The corners should be 'o's or '+', free choice.
w: 10, h: 5, d: 4
Thus gives:
o--------o
/ /|
/ / |
o... | stackexchange_codegolf |
We've got quite a few national flag challenges already:
AU
CH
FI
FR
GB
GB
IS
KR
NP
US...
Here's another, somewhat more advanced one:
Return or print the decorative pattern from Belarus's national flag as a matrix of two distinct values for red and white.
If your language doesn't support matrices, use a list of lists o... | stackexchange_codegolf |
I recently learned from a comment by MathOverflow user pregunton that it is possible to enumerate all rational numbers using iterated maps of the form \$f(x) = x+1\$ or \$\displaystyle g(x) = -\frac 1x\$, starting from \$0\$.
For example, $$0 \overset{f}{\mapsto} 1 \overset{f}{\mapsto} 2 \overset{g}{\mapsto} -\frac12 \... | stackexchange_codegolf |
Display numbers from one to one-hundred (in increasing order), but number 2 shouldn’t appear anywhere in the sequence. So, for example, the numbers two (2) or twenty-three (23) shouldn't be in the sequence.
Here is an example output, with newlines separating the numbers:
1
3
4
5
6
7
8
9
10
11
13
14
15
16
17
18
19
30
31... | stackexchange_codegolf |
Bob the Bowman
o
/( )\ This is Bob.
L L Bob wants to be an archer.
#############
.
/ \ <--- bow So he bought himself a
(c -)-> <--- arrow nic... | stackexchange_codegolf |
Background
Fibonacci trees \$T_n\$ are a sequence of rooted binary trees of height \$n-1\$. They are defined as follows:
\$T_0\$ has no nodes.
\$T_1\$ has a single node (the root).
The root node of \$T_{n+2}\$ has \$T_{n+1}\$ as its left subtree and \$T_n\$ as its right subtree.
T0 T1 T2 T3 T4
O ... | stackexchange_codegolf |
What if we have a corridor comprised of two parallel mirrors?
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Now, we shine a laser down it...
| \ |
| \ |
| \ |
| \ |
| \ |
| \ |
| \ |
| ... | stackexchange_codegolf |
This is an answer-chaining post, so in this challenge every answer (except the first answer) depends on the previous answer.
The goal of this challenge is to output the restricted characters. The restricted characters are the most common n - 1 characters of all answers, if happens to be a tie, then the characters with ... | stackexchange_codegolf |
This is a simple(ish) web scraping challenge.
Input
Your code should take an MPAA film rating and a number from 0 to 100 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) the numerical score on the Tomatometer from rottento... | stackexchange_codegolf |
In the 196-algorithm one starts from an integer and then adds its reverse to it until a palindrome is reached, like this:
start -> 5280
5280 + 0825 = 6105
6105 + 5016 = 11121
11121 + 12111 = 23232
-end-
Write a function that counts how many even numbers are visited before the algorithm ends. Starting and ending number... | stackexchange_codegolf |
Challenge
Write a program that toggles another. Your program should accept exactly two command arguments. Specifically, your two tasks are:
If the names of any running processes are identical to argument one, close them and exit
If the names of zero running processes are named identical to argument one, spawn one with... | stackexchange_codegolf |
A lazy physicist has the job to perform the double slit experiment. However, they are lazy and can't be bothered to set up all the equipment themselves and so are going to simulate the effects. They can't program though so are going to need some help. As they are lazy your program should be as short as possible.
Given... | stackexchange_codegolf |
Step one
In a new google sheet insert an image into cell A1 with
Insert > Image > Image In Cell
Step two
Create a formula to return TRUE (if the cell contains an image) and FALSE (if the image is missing)
Rules
Only vanilla formulas are allowed. The shortest code in bytes wins.
| stackexchange_codegolf |
Remember the good old days when opening a simple document or web page was painfully slow as it hogged all the meager resources your computer had? And today, doing the same is even slower, despite your processor being hundreds of times faster and having access to thousands of times more memory?
To simulate the effect of... | stackexchange_codegolf |
Challenge:
Given a square input matrix \$A\$, pad the matrix with one row and one column on all four sides.
The value of each element in the top and bottom row should be the sum of the elements in each corresponding column.
The value of each element in the left and right column should be the sum of the elements in eac... | stackexchange_codegolf |
Nichomachus's Theorem relates the square of a sum to the sum of cubes:
and has a beautiful geometric visualization:
Challenge: Create the 2d part of this visualization in ascii.
You will need to ensure that all visual demarcations are upheld by your diagram. This is simplest to do with four "colors," though it's pos... | stackexchange_codegolf |
Challenge
The main objective of the challenge is pretty simple, this is an answer chaining contest, where you have to serially print numbers from 1. That means User 1's answer will print 1, then User 2's answer will print 2 and so on. But there are some rules to make the contest tougher.
Rules
You can't use the charac... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 11.
Obligatory why me and not Bubbler link
After having rescued a child process lost on a hexagonal infinite grid, you hear someone else screaming for help. You turn around, and unsurprisingly, there is a... | stackexchange_codegolf |
Input
A non-empty array of positive integers.
Task
Convert each integer to either binary, octal, decimal or hexadecimal in such a way that each digit (0 to F) is used at most once.
Output
The list of bases that were used to solve the puzzle.
Detailed example
The expected output for [ 16, 17 ] is [ octal, decimal ].
Her... | stackexchange_codegolf |
Your Challenge is to take a binary string as input and get all binary numbers between itself and the reverse of its string representation (the reverse may be less than or greater than the original input).
Output must be padded with zeroes to be the same length as the input.
The Order in which the values are displayed d... | stackexchange_codegolf |
In my language Pyramid Scheme, there is a slightly funny construct: the empty triangle:
^
-
When given no arguments, it returns 0. To generate 1 using this construct, we could use this:
^
/!\
^---
-
This simply passes 0 to the negation function. We can continue negating this result:
^
/!\
---^
/!\
^---
-
... | stackexchange_codegolf |
Challenge:
Given a list of integer, sort descending by their single largest digit(s). The order for numbers with the same largest digit are then sorted by second largest digit, etc.
We ignore duplicated digits in numbers. And if all digits in a number are the same, the order of those numbers in the list can be in any w... | stackexchange_codegolf |
In this challenge, you will be "reversing" the alphabet or swapping a-z with z-a. This is commonly known as the Atbash cypher.
Because this transformation makes the output look like some foreign language, your code will need to be as short as possible.
Examples
abcdefghijklmnopqrstuvwxyz
zyxwvutsrqponmlkjihgfedcba
Pr... | stackexchange_codegolf |
Write a program that takes a string as input and modifies it by reversing the string in its place by mirroring the position. The first position goes to last, second to second last and so it goes on. In simple words, the string would be mirrored.
"In Place" means the program should use \$O(1)\$ additional memory regardl... | stackexchange_codegolf |
Given input n, produce a word grid of size n, in as few bytes as possible.
Details
The number provided will always be odd. The centre square of the grid must always be empty (a space character). The letters that fill the grid must be chosen at random from the English Scrabble letter distribution of letters. That is, ea... | stackexchange_codegolf |
I like patterns in time. My favorite is when the time lines up. For example, all of these line up:
3:45
12:34
23:45
3:21
6:54
This is because each digit in the hour/minute is increasing/decreasing by one each time.
Your task is to take the current time and check if it "lines up" in this pattern in a program. (You will... | 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 |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 11.
Obligatory why me and not Bubbler link
After having rescued a child process lost on a hexagonal infinite grid, you hear someone else screaming for help. You turn around, and unsurprisingly, there is a... | stackexchange_codegolf |
In the beginning there was NCSA Mosaic, and Mosaic called itself NCSA_Mosaic/2.0 (Windows 3.1), and Mosaic displayed pictures along with text, and there was much rejoicing.
15 years later...
And then Google built Chrome, and Chrome used Webkit, and it was like Safari, and wanted pages built for Safari, and so preten... | stackexchange_codegolf |
Yahtzee is a game played with five six-sided dice and a score sheet with thirteen different boxes to fill a score in. Each box has its own scoring rules:
1s, 2s, 3s, 4s, 5s, 6s all score points equal to the sum of the respective dice (that is, a roll of [3, 2, 3, 1, 5] scored as 3s would be awarded 6 points: 3 for eac... | stackexchange_codegolf |
What is the shortest way to see if an input is a wordinian using any programming language?
A wordinian is a word that contains words of length 1 to the original word's length. For example,
bin
'I' is a word
'in' is a word
'bin' is a word
Or,
stage
'a' is a word
'ta' is a word (yes it is)
'age' is a word
's... | stackexchange_codegolf |
Curling is a sport where two teams aim to place stones as close to the centre of a target as possible. The winner of a curling end is the team whose stone is closest to the centre – they score as many points as the number of their stones closer to the centre than any of their opponents.
Task
Given two lists of pairs of... | stackexchange_codegolf |
Sequence Definition
Construct a sequence of positive integers a(n) as follows:
a(0) = 4
Each term a(n), other than the first, is the smallest number that satisfies the following:
a) a(n) is a composite number,
b) a(n) > a(n-1), and
c) a(n) + a(k) + 1 is a composite number for each 0 <= k < n.
So we start with a(0) =... | stackexchange_codegolf |
Description
We consider an integer with at least 3 digits triple-balanced if, when split into three parts, the digits in every part sum up to the same number. We split numbers as follows:
abcdefghi - Standard case: the number of digits is divisable through 3:
abc def ghi
abcdefgh - Number % 3 == 2: The outer groups ar... | stackexchange_codegolf |
In the original Shantae game, there are transformation dances that you have to input in time using the D-Pad, A, and B. If you complete a predefined sequence while dancing, you will transform into the corresponding form (or teleport or heal). Your task is to output the corresponding effect when given an input. The catc... | stackexchange_codegolf |
Inspired by this stack of little statues that are currently on my desk at work, given to me by my colleagues from Sri Lanka when they visited The Netherlands:
This is split into two different challenges due to popular demand:
Part 1) Determine the amount of statues (this challenge)
Part 2) Can the statues be stacked?
... | stackexchange_codegolf |
A Quine is a program which outputs its source when run.
In this challenge, You should make a Fibonacci-quine, a variant of the quine.
What is a Fibonacci-quine?
A Fibonacci-quine is a program, which outputs a modification of the source by the following rule:
The initial source should be ...2.... In other words, the so... | stackexchange_codegolf |
This challenge is inspired by one of my other challenges: Pointlessly make your way down the alphabet
That challenge asked you to take a string of text, and for each letter produce a sequence of letters moving down the alphabet to 'a'.
For this challenge I'd like to decode the output of that challenge (minus the line b... | stackexchange_codegolf |
Poker has etiquette in how you arrange your chips, often enforced in tournaments - your chips may not be "hidden" from your opponents by being behind others, mostly to not hide some large denomination chip(s).
The Challenge
We are going to be playing poker in ASCII, so we need to write a function or program that will ... | stackexchange_codegolf |
Title stolen inspired by Greg Hewgill's answer to What's the difference between JavaScript and Java?
Introduction
Java and JavaScript are commonly used languages among programmers, and are currently the most popular tags on Stack Overflow. Yet aside from similar names, the two have almost nothing in common.
In honor of... | stackexchange_codegolf |
UPDATE:
The gist-files are updated (including new submissions) as the Controller.java did not catch Exceptions (only errors). It does now catch errors and exceptions and also prints them.
This challenge consists of two threads, this is the catcher thread, the cat thread can be found here.
The controller can be download... | stackexchange_codegolf |
Inspired by the connection rules from Calvin's Hobbies' question Make me an alphabet tree take a number of lines of letters as input and output the number of distinct connected trees it represents.
Letters connect to diagonally adjacent letters (never horizontally or vertically) and only where such a connection is avai... | stackexchange_codegolf |
You want to see how quickly the ratio of two consecutive Fibonacci numbers converges on φ.
Phi, known by the nickname "the golden ratio" and written as \$φ\$, is an irrational number, almost as popular as π and e. The exact value of \$φ\$ is \$\frac {1 + \sqrt 5} 2 = 1.618...\$
The Fibonacci sequence is a recursive ser... | stackexchange_codegolf |
This is the cops' thread. The robbers' thread goes here.
The last cops-and-robbers thread was already 4 months ago.
The cop's task
The cop's task is to write a program/function that takes a positive (or non-negative) integer and outputs/returns another integer.
The cop must state it if the program is intolerant toward... | stackexchange_codegolf |
In Wordle, you try to guess a secret word, and some letters in your guess are highlighted to give you hints.
If you guess a letter which matches the letter in the same position in the secret word, the letter will be highlighted green. For example, if the secret word is LEMON and you guess BEACH, then the E will be high... | stackexchange_codegolf |
Background
A Ruth-Aaron pair is a pair of consecutive positive integers n and n+1 such that the sum of the prime factors (counting repeated prime factors) of each integer are equal. For example, (714,715) is a Ruth-Aaron pair, since 714=2*3*7*17, 715=5*11*13, and 2+3+7+17=5+11+13=29. The name Ruth-Aaron pair was chosen... | stackexchange_codegolf |
Challenge
Premise
Euler diagrams consist of simple closed shapes in a 2-D plane that each depict a set or category. How or whether these shapes overlap demonstrates the relationships between the sets.
I'm a spoilt brat who thinks Euler diagrams are hard to draw. For any Euler diagram, I want to know the minimum number ... | stackexchange_codegolf |
Introduction
After a day of drinking and watching the world cup, you sit down to play friendly game of boggle. Tempers rise as you are accused of wasting everyone's time with nonsense words that aren't even on the board! You may be seeing double, but surely you're thinking straight enough to write a program that will v... | stackexchange_codegolf |
Introductions
A 2×n Boolean matrix can be represented as a string of the four characters . ':.
The string has an "upper row" and a "lower row", with dots representing 1s and empty spaces representing 0s.
For example, the 2×6 matrix
1 0 1 0 0 1
0 0 0 1 0 1
can be represented as ' '. :.
Your task is to take a matrix in ... | stackexchange_codegolf |
The Rockstar programming language has "poetic number literals", allowing you to assign nonnegative, finite (at least one Rockstar interpreter supports infinity) numbers to variables without typing a single digit: just type words with length equal to each digit, modulo 10. For example,
This is a challenge
sets the vari... | stackexchange_codegolf |
Fed up with the reliability of flash storage, you decided to store all your programs on one of those good old 1,440 KiB floppies. However, after copying not even 3,000 programs, the disk was full. How's that even possible? Skilled in the art of code golf as you are, most of your programs aren't even 100 bytes long, so ... | stackexchange_codegolf |
Write a program to print or return one of these strings verbatim:
abcdefghijkmnopqrstuvwxyz
ABCDEFGHIJKMNOPQRSTUVWXYZ
Notice that there is no L.
| stackexchange_codegolf |
We all know scoring by characters is ripe for abuse. Let's prove this.
The Challenge
Output the following:
"m8V}G=D@7G1lAI,v08`
#(hNb0A8T!g;==SVaG5~
g"jUF!bmRY(3I@na?2S{
fJVzo/GQYU%ybpfUq3aG
Yza[jc,WJ$bP^7r};Da}
V-!Z+Nk:`/poc}d/X:G\
sWX{dbAUv6,i]%RG$hRp
),bd+?/{U1tU[;<;u.Nk
ZFPIOzJ/HimL!nexc,ls
HM%k3D$n2|R,8L?'eI_n
qs.... | stackexchange_codegolf |
Gaussian integer is a complex number in the form \$x+yi\$, where \$x,y\$ are integer and \$i^2=-1\$.
The task is to perform such operation for Gaussian integers \$a,b\$, that
\$a=q \cdot b+r\$ and \$|r|<|b|\$ (\$q,r\$ are Gaussian integers, \$|z|\$ is defined as \$\sqrt{a^2+b^2}\$ for \$a+bi=z\$).
Need to output only ... | stackexchange_codegolf |
The Challenge
Your task is to create a program that can solve an algebraic equation.
Input
Input will consist of a String. The string will be an equality involving the variable x, and follows the following rules:
the equation will always be linear
The valid operations in the equation are + - * /
Parenthesis will not b... | stackexchange_codegolf |
Your task is to given two integer numbers, a and b calculate the modular multiplicative inverse of a modulo b, if it exists.
The modular inverse of a modulo b is a number c such that ac ≡ 1 (mod b). This number is unique modulo b for any pair of a and b. It exists only if the greatest common divisor of a and b is 1.
Th... | stackexchange_codegolf |
This challenged is highly inspired by what @Mego created with his Holy and Holier numbers, lots of thanks to him and his puns.
Holy numbers are numbers composed of only the digits with holes, which are:
04689
Numbers with at least one unholy digit are considered unholy. Unholy digits are evil by definition, but being ... | stackexchange_codegolf |
Introduction
Long ago, when I used to code card games with usual playing cards, I used to specify a number for each card and call a function with some number to get a card. This somewhat inspired me to make this challenge.
So for the people unaware of the playing cards, a deck of cards consist of 52 cards (13 in each ... | stackexchange_codegolf |
I like to pretty print multidimensional arrays, like this:
[ [ [1, 2, 3],
[4, 5, 6] ],
[ [7, 8, 9],
[6, 4, 2] ] ]
But it's a pain to do by hand and it'd be nice to have a program that does this for me. Your challenge is to create a program that does this for me, taking a multidimensional array containing onl... | stackexchange_codegolf |
Story
In an unnamed company, some people use Java and some use C++. This was always a nuisance, and they kept on arguing which single language they should all be using. To settle the dispute, the management decided that they'll buy a translator program that will be able to rewrite their C++ programs to Java and vice ve... | stackexchange_codegolf |
I am learning Ruby and wrote my first nontrivial code to solve this problem.
The challenge is to generate the first n elements of the Stöhr sequence, S, which is defined as follows:
S[0] = 1
S[n] is the smallest number that cannot be expressed as the sum of two distinct previous elements in the sequence.
Thus the seq... | stackexchange_codegolf |
Introduction
In a standard* (e.g. not 2020) tax year, estimated payments are due quarterly according to the schedule outlined in Publication 505.
Payment Period
Due Date
January 1 – March 31
April 15
April 1 – May 31
June 15
June 1 – August 31
September 15
September 1 – December 31
January 15
* Saturd... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.