instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
In this question I defined a "chain" function as a function that:
is a permutation, meaning that every value maps to and is mapped to by exactly one value.
and allows any value can be obtained from any other value by repeated applications of the function or its inverse.
There are a lot of functions that do this and s... | stackexchange_codegolf |
For the purposes of this question, the prime factorial of a number n is the result of multiplying all prime numbers smaller than n, and then multiplying the result by n.
Your Task:
Write a program or function to find the prime factorial of a number, as outlined above.
Input:
An integer n where n is greater than one... | stackexchange_codegolf |
Introduction
Let's observe the following string:
AABBCCDDEFFGG
You can see that every letter has been duplicated, except for the letter E. That means that the letter E has been de-duplicated. So, the only thing we need to do here is to reverse that process, which gives us the following un-de-duplicated string:
AABBCCD... | stackexchange_codegolf |
Every odd degree polynomial has at least one real root. However this root does not have to be a rational number so your task is to output a sequence of rational numbers that approximates it.
Rules
Your input is an odd degree polynomial \$f\$ with integer coefficients in any reasonable format.
You must output a sequen... | stackexchange_codegolf |
A digit addition generator of an integer n is any integer x that satisfy the equation x + s(x) = n, with s(x) being the sum of the digits of x. (We will work under base 10 for convenience.)
For example, a digit addition generator for 29 would be 19, because 19 + (1 + 9) = 29. Some numbers have more than one generator. ... | stackexchange_codegolf |
Background Information: What is a Fenwick Tree?
With a normal array, it costs \$O(1)\$ to access and modify an element, but \$O(n)\$ to sum \$n\$ elements. Working with a prefix sum array (an array where the \$i\$th value represents the sum of the first \$i\$ values in the underlying data), access and summation are \$O... | stackexchange_codegolf |
In this challenge, Turing machines operate on a zero-initialized binary tape that is infinite in both directions.
You are given an integer \$N\$, where \$1 \le N \le 20000\$. Your program has to output a Turing machine that takes exactly \$N\$ steps to halt, including the final step. Alternatively, you can write a prog... | stackexchange_codegolf |
Does anyone have any suggestions as to how I could shorten this program?
_=map(ord,raw_input());_=[10if y==88else 0if y==45else 58-_[x-1]if y==47else y-48for x,y in enumerate(_)];t=0;exec('t+=sum(_[:2+(_[0]+_[1]>=10)]);_=_[2-(_[0]==10):];'*10);print t
Run it online
I'd like to write a bowling calculator. I'm fairly pr... | stackexchange_codegolf |
NOTE: SIMILIAR TO Solitaire Dreams - Creating a winnable solitaire starting hand
Find a minimum of 5 deck orders where if the cards were dealt out would create a game of Klondike Solitaire where there is absolutely no possible winning state. Assume the game is 3 card draw, infinite times through the deck.
As always, th... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2016 Day 2, Part 2.
You finally figure out the bathroom code (on the weird diamond-shaped keypad) and open the bathroom door. And then you see another door behind it, with yet another keypad design:
For those who... | stackexchange_codegolf |
How can we depict a turned shape simply and nicely using ascii characters in 3D space?
I suggest this method :
Instead of a circle we use a square rotated by 45° for the cutting section so that we only need '/' and '\' characters to draw it.
/\
/ \
\ /
\/
And we use '_' character for the profiles: upper, lower ... | stackexchange_codegolf |
Input:
A list of integers
Output:
Put each digit (and the minus sign) in its own lane, in the order -0123456789, ignoring any duplicated digits.
Example:
Input: [1,729,4728510,-3832,748129321,89842,-938744,0,11111]
Output:
-0123456789 <- Added as clarification only, it's not part of the output
1
2 7 ... | stackexchange_codegolf |
Not an interpreter. Arguably a compiler. But I'm talking about a transpiler.
It can be in any language, but it must return js-valid arrow notation code.
The λ-calculus string would be passed as an argument to a function, or the whole program, and in some way the program would return/log/print the string with the js-not... | stackexchange_codegolf |
This is a Google interview question, see here for a youtube link.
The task:
Find 2 integers from an unordered list that sum to a given integer.
Given an unordered list of integers, find 2 integers that sum
to a given value, print these 2 integers, and indicate success (exit 0). They don't need to be any particular num... | stackexchange_codegolf |
Given a string to encode, and a number of columns (the key), encode the string as follows:
I will be using the example Hello, world! and the key 3
First, write out the number of columns:
1 2 3
Next, write the text starting from the upper left, one character per column, and when you run out of columns, go to the next l... | stackexchange_codegolf |
Your input is an array of numbers: a permutation of \$\{1, 2 \dots n\}\$ for some integer \$n \geq 2\$.
How many times must you repeat this list before you can "pick out" the numbers \$[1, 2 \dots n]\$ in order?
That is: find the lowest \$t \geq 1\$ so that \$[1, 2 \dots n]\$ is a subsequence of \$\text{repeat}(\text{i... | stackexchange_codegolf |
Consider the following triangle.
1
23
456
7891
01112
131415
1617181
92021222
324252627
2829303132
33343536373
839404142434
4454647484950
51525354555657
585960616263646
5666768697071727
37475767778798081
As you probably noticed, the first row is of length 1, and each row thereafter is 1 digit longer than to the previo... | stackexchange_codegolf |
Given integers k and n, generate a sequence of n unique k-tuples of pairwise coprime integers. Every such tuple must occur once eventually, that is, for any existing k-tuple of pairwise coprime integers, some n will eventually generate it.
The output may be printed or evaluated in any list/tuple-like form.
Definitions
... | stackexchange_codegolf |
Task
Write a function to generate names of aliens and their worlds, so that the output is of the form:
Greetings Earthfolk, I am ____ of the planet _____.
"Rules"
Best space-sounding-ness to code length wins.
The more diversity the better.
Dictionaries/look-up tables count towards code length.
Random number generators... | stackexchange_codegolf |
Ouput the following banner:
_____ _ _____ _ __
/ ____| | | / ____| | |/ _|
| | ___ __| | ___ | | __ ___ | | |_
| | / _ \ / _` |/ _ \ | | |_ |/ _ \| | _|
| |___| (_) | (_| | __/ | |__| | (_) | | |
\_____\___/ \__,_|\___| \_____|\___/|_|_|
The code ... | stackexchange_codegolf |
Make a quine but with a twist.
Statement
The quine prints its code but puts its first character at the end.
(You can do it in reverse but include that note in your answer)
The output must then be a program which is also an solution.
Example: Assume your code was foobar, running it will return oobarf which will be anoth... | stackexchange_codegolf |
In Map inputted ASCII characters, I asked you to .. map inputted ASCII characters. This time, you will do the opposite, by immediately mapping all ASCII characters, and then mapping spaces over them.
This program will have practical uses, such as seeing what characters you have left in a restricted-source challenge sub... | stackexchange_codegolf |
Background
Three years ago, this guy Tom Murphy got it into his head to extend the idea of a portmanteau to all words in a language and called this a portmantout (portmanteau plus tout [French for all]). Defining English as a list of 108,709 words, he managed to find a sequence of 611,820 letters with the following two... | stackexchange_codegolf |
A Munchausen Number in base \$b\$, also known as a Perfect digit-to-digit invariant or PDDI is a peculiar type of positive integer where the sum of its base-\$b\$ digits raised to themselves is equal to the number itself. They are named for the fictional Baron Munchausen, who apparently hoisted himself up via his own p... | 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 |
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 |
What general tips do you have for golfing in VBScript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to VBScript. Please post one tip per answer.
Thanks to Marcog for the original idea. :)
| stackexchange_codegolf |
Your task is to generate the nth term of the RATS sequence, where n is the input. The RATS sequence is also known as the Reverse Add Then Sort sequence. This sequence can also be found here: http://oeis.org/A004000.
test cases:
0 > 1
1 > 2
2 > 4
3 > 8
4 > 16
5 > 77
6 > 145
7 > 668
For example, the output for 5 is 77 b... | stackexchange_codegolf |
(I am not sure that this is the best place to put this question, but I will give it a shot. Forgive me if it is improper. This is just a fun project with which I am tinkering and I am looking for advice on how best to implement it; but it is also something of a 'challenge' (not implying that it is hard!), so I thought ... | stackexchange_codegolf |
Main objective
The main objective is to output a text, it doesn't mind which text or where the text gets its output (it can be on a browser window, the default console etc).
It just requires the condition that what is output must be indeed "real chars" (the ones in UNICODE for example), it's not considered valid to dis... | stackexchange_codegolf |
Generate \$T=\{T_1,...,T_x\}\$, the minimum number of \$k\$-length subsets of \$\{1,...,n\}\$ such that every \$v\$-length subset of \$\{1,...,n\}\$ is a subset of some set in \$T\$
Here, \$n > k > v\$ and \$v \ge 2\$
Any number can appear only once in 1 set
Order of numbers is not important
Answer with code & explan... | stackexchange_codegolf |
This question is heavily based off this question, but should pose a number of additional difficulties.
Your Task
You must write a program or function that, when receiving a string, prints out all possible anagrams of it. For the purpose of this question, an anagram is a string that contains the same character as the o... | stackexchange_codegolf |
In this challenge, bots (consisting of JS functions) move around an infinite factory (playing field), collecting characters. These characters can be used to build worker bots, or dropped for other bots to pick up.
This challenge is a modified redo of Bot Factory KoTH, which was broken by a mistake in the spec.
Results
... | stackexchange_codegolf |
Given a matrix, the goal is to ensure all the values in each column occur at least once, while at the same time doing so requiring the least possible amount of rows. Fastest solution wins.
Note: a value in one column (e.g. 1) is considered different from the same value in another column.
Expected output: an array/list... | stackexchange_codegolf |
This page is not for Visual Basic Tips
Visual Basic .NET (VB.NET) is an multi-paradigm dialect of basic that was developed and released by Microsoft in 2002 as a replacement for Visual Basic. The current version of VB.Net as of Feb 2018 is Visual Basic .NET 15.0.
Unlike Visual Basic (VB), Visual Basic .NET (VB.NET) is ... | stackexchange_codegolf |
In this question Tom learned that, in general, there are many motivations to choose to include case sensitivity in his programming language, because the possible combinations for a variable name are much more than what's possible with a case insensitive programming language for a name of the same length.
But, as a more... | stackexchange_codegolf |
Use any programming language to display "AWSALILAND" in such a way, so that each letter is in a new line and repeated as many times as its position in the English alphabet. For example letter, (A) should be displayed just once because it is the first letter of the alphabet. Letter D should be displayed 4 times because ... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
I've got an infinite supply of \$n\$-dimensional chocolate for some positive integer \$n\$. The shape of the chocolate is not important. You may assume that they are just \$n\$-dimensional hypercubes with side length \$1\$.
To celebrat... | stackexchange_codegolf |
Create a script that, when run from a console, will display the text already in the console, prior to running.
Challenge
How will the winner of the challenge will be determined?
The golf with the shortest length (in bytes) will win.
Example Input and Output
Input:
(Shown is Windows)
Microsoft Windows [Version 10.... | stackexchange_codegolf |
SPECIFICATION
Given m variables, create every combination up to order n. For example,
The output of mapping two variables (a and b) to order 1 would be:
a
b
a b
The output of mapping two variables (a and b) to order 2 would be:
a
a2
b
b2
a b
a2 b
a b2
a2 b2
The output of mapping two variables (a and b) to order 3 ... | stackexchange_codegolf |
Your task
Given a integer input, \$ n \$ (such that \$ n > 1 \$), decide whether it can be written as the sum of (at least 2) consecutive square numbers.
Test cases
Truthy:
Input Explanation
5 1 + 4
13 4 + 9
14 1 + 4 + 9
25 9 + 16
29 4 + 9 + 16
30 1 + 4 + 9 + 16
41 16 + 25
50 9 + 16 + ... | stackexchange_codegolf |
As the title may suggest, this problem is semi-inspired by the Polite Near-Sighted Drunk Bot by @N.P.
Our poor bot is placed on a cartesian grid at the origin, and after each minute, it moves 1 unit in one of four directions (Up, Down, Left, Right).
After n minutes, all of the latent mines on the grid activate, killin... | stackexchange_codegolf |
Challenge
You will be given a string that can contain lowercase letters, uppercase letters, or spaces. You have to turn the vowels (a, e, i, o, u) in the string to upper case and consonants to lower case. This applies whether or not the letter was originally upper case or lower case. Spaces remain as is. Note that "y" ... | stackexchange_codegolf |
Sometimes I find myself wanting a hot dog (don't we all) and so I make one. Now to make a hot dog, it is very simple.
1) Put the hot dogs into boiling water
2) Wait for a certain amount of time (detailed below)
3) Eat the hot dog once the time has elapsed.
You may have noticed that I said
certain time (detailed below... | stackexchange_codegolf |
Given guaranteed strictly positive integers \$w\$ and \$n\$, output
An equilateral triangle array with side length \$w\$, filled with two distinct, consistent values. I'll call these 0 and 1 but they do not have to be equal to 0 and 1.
The number of 1s inside this array must be equal to \$n\$.
The output triangle must... | stackexchange_codegolf |
Given an integer n >= 2, output the largest exponent in its prime factorization. This is OEIS sequence A051903.
Example
Let n = 144. Its prime factorization is 2^4 * 3^2. The largest exponent is 4.
Test Cases
2 -> 1
3 -> 1
4 -> 2
5 -> 1
6 -> 1
7 -> 1
8 -> 3
9 -> 2
10 -> 1
11 -> 1
12 -> 2
144 -> 4
200 -> 3
500 -> 3
1024... | stackexchange_codegolf |
Minesweeper is a puzzle game where mines are hidden around a board of nondescript tiles with the goal of identifying the location of all mines. Clicking on a mine loses the game, but clicking on any other tile will reveal a number from 0-8 which signifies how many mines directly surround it.
Given a number, you must di... | stackexchange_codegolf |
In this challenge, you must parse a list of lists, into a simpler list format.
This challenge is based on my sadflak parser. In my sadflak parser, it has all the () removed, replaced with the sum of the ()s at the start of the list, to make the program run faster.
To parse into a Sad-List, you have to do this (python i... | stackexchange_codegolf |
Given a positive input \$n\$, output a random pair of primes whose difference is \$n\$. It's fine if there's another prime between them.
Every pair should possibly appear and the program should have zero possibility to fall into infinite loop.
It's promised that such pair exist, but not always infinite, so beware. You ... | stackexchange_codegolf |
This challenge is as follows.
(Uhoh no! Now everyone is going to use reciprocal division. Now all the answers are going to look the same and lose originality, ugh!)
Given two integers multiply them, ... but you can't use the multiplication symbols "*" and "x". As you probably know multiplication is just an extension... | stackexchange_codegolf |
I have made a short script that will pull dns txt records down from a server and combine them into a single string.
DNS txt records are:
1.website.com
2.website.com
3.website.com
Each of these are iterated through using the single digit number.
The double quotes at the beginning and the end of the strings are trimmed
T... | stackexchange_codegolf |
Befunge Chess is an esolang mini-game I invented that is centered around the Befunge esolang. The general gist of the game is to make the instruction pointer land on a specific target cell while avoiding the opponent's target cell.
Today's challenge isn't to play the game, but to simply execute arbitrary boards.
The Ru... | 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 |
First, a mathematical interlude, short, and worth your while:
If 0 < a < 4, the logistic function f(x) = ax(1-x) maps the interval [0,1] inside itself. This means that one can play the iteration game; for instance, if a=2, the initial value 0.3 becomes 0.42, then 0.4872, etc.
As the parameter a increases, the quadratic... | stackexchange_codegolf |
The dealer has been sloppy and lost track of what cards his/her deck contains and what cards are missing, can you help him/her?
A complete deck consists of 52 playing cards, namely:
Each color in the deck (hearts, diamonds, spades, clubs) contains:
The numbers [2 - 10]
A Jack
A Queen
A King
An Ace
Task
Your program... | stackexchange_codegolf |
Definition
The rank of a word is defined as the position of the word when all the possible permutations (or arrangements) of its letters are arranged alphabetically, like in a dictionary, no matter if the words are meaningful or not.
Let us consider these two words - "blue" and "seen". To begin with, we would write all... | stackexchange_codegolf |
Input
None
Output
52 cards. No duplicates. Cards are represented as their unicode characters, e.g. .
The Unicode codepoints follow the following format:
The first three digits are 1F0.
The next digit is A, B, C, or D for spades, hearts, diamonds, and clubs respectively.
The next digit is 1 through C and E for the vari... | stackexchange_codegolf |
Let's say you are given an integer array. Create a function to determine the largest sum of any array's adjacent subarrays. For instance, the contiguous subarray with the largest sum is [4, -1, 2, 1] in the array [-2, 1, -3, 4, -1, 2, 1, -5, 4].
You can employ a variant of Kadane's algorithm to resolve this issue. The ... | stackexchange_codegolf |
"A picture is worth a thousand words"—so the old saying goes. The average word is about four characters long, so a picture conveys 4kB of information. But how much entropy, rather than information, can a picture convey?
Your task is to generate an image, exactly 4,000 bytes in size, with the highest entropy possible. Y... | stackexchange_codegolf |
Fast and Golfiest Cops Thread
Welcome to the first season of Fast and Golfiest, a cops-and-robbers challenge! I designed this challenge to encourage competitive coding for efficiency (fastest algorithm) to become more popular on the site.
The rules are simple. The cops must choose a problem from LeetCode, the prestigio... | stackexchange_codegolf |
What general tips do you have for golfing in QBasic? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to QBasic (e.g. "remove comments" is not an answer).
Tips pertaining to the QB64 emulator are also welcome. It has some extra features that aren't in Micros... | stackexchange_codegolf |
Forget BIDMAS! Write a program that takes an equation and an operator precedence order, and prints the result.
Example input format:
1.2+3.4*5.6/7.8-9.0 */+-
Rules & guidelines:
The only operators that are defined are addition (+), subtraction (-), multiplication (*), and division (/). No parentheses, no exponentiati... | stackexchange_codegolf |
Inspired by one of many bugs I ran into while implementing selection sort in trilangle.
Given a non-empty list of non-negative integers, "sort" the list using the following procedure:
Find and output the smallest value in the list.
If the list only has one element, stop.
Recurse on a sublist:
If the last element in t... | stackexchange_codegolf |
Problem
Create a function that can determine whether or not an arbitrary DNA string is a Watson-Crick palindrome. The function will take a DNA string and output a true value if the string is a Watson-Crick palindrome and a false value if it is not. (True and False can also be represented as 1 and 0, respectively.)
The... | stackexchange_codegolf |
Given required values for an expression with 2 variables, output a short expression which fulfill these values
Input
You may take the input in any reasonable format, e.g. f(x,y)=z, {(x, y): z}, [[[x,y],z]], but please write what format is your input is taken in
Output
Your output needs the be a valid infix expression f... | stackexchange_codegolf |
The above image displays a hexagonal grid of hexagons. Each cell in the grid is assigned an index, starting from the center and spiraling counterclockwise around as shown. Note that the grid will continue indefinitely - the above picture is simply the first section. The next hexagon would be adjacent to 60 and 37.
You... | stackexchange_codegolf |
Given a string, find the first word starting with each letter (case insensitive).
Sample
Using Ferulas flourish in gorgeous gardens. as input:
"Ferulas flourish in gorgeous gardens."
^^^^^^^ ^^ ^^^^^^^^
| | |
| | --> is the first word starting with `g`
| --> i... | stackexchange_codegolf |
Deserializing binary trees depth-first is pretty easy, but doing it breadth-first is (hopefully) harder. Your mission, should you choose to accept it, is to do the latter.
The input will be a 1-D list of positive integers representing node values and some other consistent value representing the absence of a child (I'll... | stackexchange_codegolf |
We are going to bring down an imaginary building with a series of explosions. Our building is a 5x5 matrix of integers ranging 1-9, each representing a single brick.
The challenge is to set of a series of explosions to bring down our building as much as we can, why not! Each brick that is connected (horizontally, verti... | stackexchange_codegolf |
The bots are looking for love. Can you help them?
The rules
The goal of this game is find the bot you have the highest compatibility with. However, robots, who are inexperienced at dating are unable to tell how well a date went.
In the game, bots take turns "speed dating" some other bot. After each date, each bot choos... | stackexchange_codegolf |
This challenge is inspired by this app.
This is a much easier version of this challenge. This challenge is code-golf, while the other one is fastest-code.
You'll be given a square input grid, of dimensions 6-by-6 which is divided into 6 areas, where the cells of each area have a unique identifier (I'll use lower case... | stackexchange_codegolf |
Challenge
Given a list of SI base units, a list of equations and a target, you must derive the units of the target using only the base units.
Derived Units
From Wikipedia:
The International System of Units (SI) specifies a set of seven base units from which all other SI units of measurement are derived. Each of these ... | stackexchange_codegolf |
2019 has come and probably everyone has noticed the peculiarity of this number: it's in fact composed by two sub-numbers (20 and 19) representing a sequence of consecutive descending numbers.
Challenge
Given a number x, return the length of the maximum sequence of consecutive, descending numbers that can be formed by t... | 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 |
For this challenge a "binary tree" is a rooted tree where each node has 0 children (leaf) or 2. The children of a node are unordered, meaning that while you might draw the tree with left and right children there isn't a distinction between them and mirroring the tree or a sub-tree does not produce a new tree.
In this... | stackexchange_codegolf |
Although what is a Pascal's triangle is well-known and we already can generate it, the task is now different:
Output \$n\$ first lines of the Pascal's triangle as colored bricks.
Color number is computed as maximal power of \$d\$, that divides the needed-to-color element or \$7\$ if power is more than \$7\$.
Numbered c... | stackexchange_codegolf |
The formula
Take for instance the number 300
The prime factors of 300 are [2, 3, 5] (unique numbers that are
factors of 300 and prime)
Squaring each of those numbers will give
you [4, 9, 25]
Summing that list will give you 4 + 9 + 25 = 38
Finally subtract that sum (38) from your original number 300-38 = 262 (this is ... | stackexchange_codegolf |
"Baby Shark" is a children's song about a family of sharks. Having long been popular as a campfire song, it has been popularized since the mid-2000s by social media, online video and radio. - Wikipedia
Write program that takes no input, and writes the following text to the standard output or an arbitrary file:
Baby S... | stackexchange_codegolf |
Given as input a list of positive integers, your task is to determine if every integer present has exactly two neighbors in the list. The neighbors of a integer \$x\$ are the distinct integers that appear next to an \$x\$ anywhere in the list. For example in the list:
[1,3,4,4,3,2,1]
The number 3 has 3 neighbors 1, 4... | stackexchange_codegolf |
Tonight, 31 January 2020, Brexit will happen and the United Kingdom will leave the European Union, the first time that the number of EU member states will decrease.
Your job is to take a date and output the number of EU1 members on that date, according to the following table:
| Start | End | Number of memb... | stackexchange_codegolf |
Write the shortest program or function that will determine if an input is a valid Go type.
Spec
This challenge will use the following simplified subset of Go types. For more information, see the Golang specification.
"Primitive" types:
bool
int,uint,float(32|64),complex(64|128),byte,rune
string
*T where T is any ty... | stackexchange_codegolf |
Read infinitely from stdin, and convert every number to the corresponding symbol on a US qwerty keyboard.
No string or character literals anywhere are permitted.
E.g. if the input is 117758326, the output is !!&&%*#@^.
Letters and symbols that aren't on numbers are left alone; 11g2;;'1g2311hh21930 turns into !!g@;;'!g... | 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 |
This simple challenge is very similar to this one: How many days in a month? The only difference is you yield the number of days in a month given the index of the month instead of its name.
The reason I ask this near-duplicate is curiosity about mathematical patterns in the sequence of numbers. For example, a simple ob... | stackexchange_codegolf |
There's a simple digital number lock. After each button press the lock checks if the previous four presses constitute the correct code. I.e. typing 44445 tests two codes: 4444 and 4445. You must brute force it with a code golfed program.
Rules
Your program must test numbers by printing ASCII digits 0-9 to standard out... | stackexchange_codegolf |
I'm currently cooking us some cup noodles, but we're really sleepy at the moment. They'll be finished in 50 seconds from now, can you wake me up then?
Problem:
Write a program or function that waits 50 seconds of busy waiting (so that you too doesn't sleep) and then outputs at least 1 visible character to wake me up.
B... | stackexchange_codegolf |
One of my favorite memes is the bouncing DVD logo. Yet silly but extremely satisfying, a DVD logo keeps bouncing on a screen and if you ever happened to watch this screensaver, you were most likely anxiously waiting for the logo to exactly hit the corner.
I know part of the fun is the waiting, but let's try to predict... | stackexchange_codegolf |
Find out the dimension of a simple nested list:
[] -> 1
[[]] -> 2
[[[]]] -> 3
...
List taken as input, dimension as output.
No counting length of strings - list manipulation and loops only.
i.e. no getting the length of the input and dividing by 2.
Any language is permitted. Get golfing!
| stackexchange_codegolf |
Your boss just emailed you a list of 12 programming tasks he needs done as soon as possible. The tasks are simple enough but your boss, being a young software tycoon suckled by social networking, insists that your solutions be able to fit within a single Twitter tweet.
This means that you only have 140 bytes worth of c... | stackexchange_codegolf |
If you like, write a program which sorts cities according to the rules of city name game.
Each name of the city should start from the last letter in the previous city name. E.g. Lviv -> v -> Viden -> n -> Neapolis -> s -> Sidney -> y -> Yokogama -> a -> Amsterdam -> m -> Madrid -> d -> Denwer
In the sorted list first ... | stackexchange_codegolf |
Do you know the book Murderous Maths, in the Horrible Science series? In the book, the Laplace Princess' "ridiculous" cipher might be interesting enough and simple enough to be a code-golf challenge.
Task
The original cipher looks like this:
Please read primes elephant help you me like cold
The nth word is only meani... | stackexchange_codegolf |
NDos' Numeral System
NDos' numeral system is a numeral system invented by me. It represents every nonnegative integer by a binary tree. Given a nonnegative integer \$n\$:
If \$n=0\$, it is represented as the empty tree.
Otherwise, the tree has a root. With the binary expansion of \$n\$:
The left sub-tree of the root... | stackexchange_codegolf |
In the hovertext of this xkcd:
There's an "encoding" based on replacing runs of roman numerals with their sums. To do this:
Find all runs of at least 1 roman numeral (IVXLCDM)
Replace them with their sums, as numbers
The Roman Numerals are IVXLCDM, corresponding respectively to 1, 5, 10, 50, 100, 500, 1000. You shou... | stackexchange_codegolf |
Let's consider the following sequence:
$$9,8,7,6,5,4,3,2,1,0,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71...$$
This is the sequence of \$9\$'s complement of a number: that is, \$ a(x) = 10^d - 1 - x \$ where \$ d \$ is the number of digits in \$ x \$. (A061601 in the OEIS).Your task is to add the first \$n\... | stackexchange_codegolf |
Background
A ray of light is fired from the top left vertex of an MxN Chamber, where M a denotes the width and N denotes the height of the chamber. The ray of light advances one grid space per second. Given that T is the number of seconds to be simulated, calculate the number of reflections in this time frame.
For exam... | stackexchange_codegolf |
Read this if you're confused.
Challenge:
The goal of this code-golf is based around the number 8675309...
Your goal is to print out every prime number from 2 to 8675309, starting with the number 2 and then skipping 8 prime numbers, then skipping 6, then skipping 7, etc. In essence, skip a number of primes determined by... | stackexchange_codegolf |
The size of the moon mystery
I am sure you have heard that the moon changes its size. When you're in love and you're lucky, the moon is almost twice in size compared to normal situations. Some people say the reason is the atmosphere which acts as a lens. Others think that it is only a matter of comparison to other obje... | stackexchange_codegolf |
This is a very simple challenge, and it is to print the numbers -1, 0, and 1.
The following paragraph is credited to Print numbers from 1 to 10
Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of those, etc., but no digits), and pr... | stackexchange_codegolf |
Write a program or function that takes in a nonempty list of integers in any reasonable convenient format such as 4, 0, -1, -6, 2 or [4 0 -1 -6 2].
Print or return a string that depicts the list as an ASCII art forest where each number becomes a tree of proportional height. Each tree takes up four columns of text in t... | stackexchange_codegolf |
Write a program for a specific language that in different orientations performs different tasks.
Your code should have at least two non-empty lines and at least two non-empty columns and should complete at least one challenge from each category of challenges below when oriented in different ways.
Orientations
Your code... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.