instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
The Golden Ratio Bureau is obsessed with this new thing they call base-phi. You see it and decide to code-golf, as is your natural instinct.
To be specific, base-phi is a number system like base 10, except it uses the number phi, or the golden ratio, as its base. A ones digit would be x*10^y, but in base phi 10 is repl... | stackexchange_codegolf |
Write a program that outputs the number 0.
That's a bit trivial, isn't it?
Let's sort all distinct permutations of your code in lexicographical order. When any of these codes are run, it should output the its location in the array (0-indexed or 1-indexed).
This means that your code must be the lexicographically smalles... | stackexchange_codegolf |
(The word frame in the following text does not mean an actual frame, it is used as a placeholder for an undefined time unit)
The task
Imagine you have a keyboard layout with only letters like so:
q w e r t y u i o p
a s d f g h j k l
z x c v b n m
Whenever you press a key, for example f, the keyboard lights up the ... | stackexchange_codegolf |
The goal is to animate a star exploding in ASCII art, starting from a single star character * to a supernovae and finally to the space void.
Rules :
You have to display only 80 characters per line on 24 lines (this is
the default terminal size on Linux)
Only these 95 printable characters from ASCII are allowed
Steps:
... | stackexchange_codegolf |
Gobar primes (A347476) are numbers which give a prime number when 0's and 1's are interchanged in their binary representation.
For example, \$10 = 1010_2\$, and if we flip the bits, we get \$0101_2 = 5\$ which is prime. Therefore, 10 is a Gobar prime
As simple as that: print the series with any delimiter. Shortest code... | stackexchange_codegolf |
Background
K functions have a feature called projection, which is essentially partial application of values to a function. The syntax for projections is a natural extension of the regular function call syntax:
f[1;2;3] / call a ternary function f with three arguments 1, 2, 3
f[1;2;] / the third argument is missi... | stackexchange_codegolf |
Inspired by the problem with the same name on Puzzling SE by our very own Dmitry Kamenetsky.
You are to find the largest number that only uses every digit pair once, in a given base. For example, in ternary we have 2212011002.
Challenge: Given a base from 2-10, output the largest number in that base with no repeating d... | stackexchange_codegolf |
\$\newcommand{T}[1]{\text{Ta}(#1)} \newcommand{Ta}[3]{\text{Ta}_{#2}^{#3}(#1)} \T n\$ is a function which returns the smallest positive integer which can be expressed as the sum of 2 positive integer cubes in \$n\$ different ways. For example, \$\T 1 = 2 = 1^3 + 1^3\$ and \$\T 2 = 1729 = 1^3 + 12^3 = 9^3 + 10^3\$ (the ... | stackexchange_codegolf |
Since Halloween is coming up I thought I might start a fun little code golf challenge!
The challenge is quite simple. You have to write a program that outputs either trick or treat.
"The twist?" you may ask. Well let me explain:
Your program has to do the following:
Be compilable/runnable in two different languages. D... | stackexchange_codegolf |
I like pizza!
Task
Given the radius of a pizza and a list of ingredients, create the corresponding ascii pizza!
Example size 4 pizza with mozzarella cheese, olives and ham:
#####
#@@@@M#
#H@O@@@@#
#M@@@H@@#
#@OO@@@@#
#@@H@@@@#
#M@M@@@@#
#O@@@H#
#####
Input
A positive integer r for the size of the pizza and... | stackexchange_codegolf |
Background
Gödel numbers are a way of encoding any string with a unique positive integer, using prime factorisations:
First, each symbol in the alphabet is assigned a predetermined integer code.
Then, to encode a string \$ x_1 x_2 x_3 \ldots x_n \$, where each \$ x_i \$ represents an symbol's integer code, the resultan... | stackexchange_codegolf |
I am trying to push my limits of making a python code as short as possible.
I left the readability part way behind.
I was attempting the K-Goodness String problem from Round A of Google Kick Start 2021.
The following was my initial solution:
def func(N, K, S):
if not S: return 0
y = 0
for i in range(N//2)... | stackexchange_codegolf |
This challenge has been divided into parts.
Your goal is to convert a sentence into a form of 'short-hand'
For Part 1 these are the rules
Take in 1 word
Remove all vowels(a,e,i,o,u), except the ones at the beginning and the end
If a letter is repeated more than once consecutively, reduce it to only one (e.g. Hello -> ... | stackexchange_codegolf |
Background
The echo program is so neat. You can say anything to it, and it repeats your words perfectly, every time! How cool is that! Disappointingly, it repeats the input all at once, regardless of your typing speed, which is not very realistic. We'll have to fix that.
The Task
Your program shall take its input from ... | stackexchange_codegolf |
Vyxal is a golfing language that has 500+ different commands (achieved through overloads), and is a known beater of Jelly, 05AB1E and most golfing languages.
Henceforth, it seems like a good idea to share some of the tips and tricks of the industry used to get terse programs in Vyxal.
One tip per answer, and no stupid ... | stackexchange_codegolf |
Challenge
Train a single perceptron with 2 inputs and 1 output.
Step 1: Initialize the weights
Step 2: Calculate the output
For inputs: [i1, i2, ..., in] and weights: [w1, w2, ..., wn] the output is:
i1 * w1 + i2 * w2 + ... + in * wn
Step 3: Apply activation function on the output (i.e sigmoid)
Step 4: Update the we... | stackexchange_codegolf |
Your Task:
You all know what a magic square is! But what about a magic cube? A magic cube is the 3D version of a magic square, and is a set of numbers in a cube, where the sums of every straight (not diagonal) line are equal. You must write a program or function that receives an integer, and returns the number of va... | stackexchange_codegolf |
Definition
Here is the process to describe a number:
For each number from 0 to 9 that is present in the number:
Write down the frequency of that digit and then the digit.
For example, for the number 10213223:
There is 1 occurrence of 0,
2 occurrences of 1,
3 occurrences of 2,
2 occurrences of 3.
Therefore, the numb... | stackexchange_codegolf |
In Bgil Midol's question, the score of a sequence of slice is defined as
sumof|startslices|∗2+sumof|endslices|∗2+sumof|stepslices|∗3
Such scoring method makes multiple slices possibly take less score, e.g.
[::25] 75
[::5][::5] 30
Given the length of a string, an upper bound of number of slices1, and the one slice i... | stackexchange_codegolf |
Write a program/function that finds the amount of fuel needed to escape Earth's gravity well given the exhaust velocity of the fuel and the amount of mass to transport using the Tsiolkovsky rocket equation:
$$\Delta v = v_\text{exhaust}\ln\dfrac{m_\text{start}}{m_\text{end}}$$
where
\$\Delta v\$ is the change in veloc... | stackexchange_codegolf |
First, study this puzzle to get a feel for what you will be producing.
Your challenge is to write a program or function which will output a circular graphic like the ones from the puzzle, given a (base 10) number between 1 and 100 (inclusive). This is similar to this challenge, except that you will be producing a graph... | stackexchange_codegolf |
The MMIX architecture is a fairly simple big-endian RISC design. It has a couple of interesting features, one of them is the MXOR instruction, which is what you should implement.
The MXOR instruction interprets its arguments (two 64-bit registers) as two 8×8 matrices of bits and performs a matrix multiplication where e... | stackexchange_codegolf |
There is a sentence with many cats:
there is a cat house where many cats live. in the cat house, there is a cat called alice and a cat called bob. in this house where all cats live, a cat can be concatenated into a string of cats. The cat called alice likes to purr and the cat called bob likes to drink milk.
The Task
... | stackexchange_codegolf |
Background
The look-and-say sequence begins with \$1\$, each following term is generated by looking at the previous and reading each group of the same digit (eg. \$111\$ is three ones, so \$111 \rightarrow 31\$). The first few terms are
$$ 1, 11, 21, 1211, 111221, 312211, \dots $$
Conway's cosmological theorem says tha... | stackexchange_codegolf |
Write a script, program or function which takes one input of type string and outputs or returns some sort of indication wether the input string was 'hi whats up' (without the apostrophes) or not.
You can for example return true if it was and false if it wasn't. Or print something to the screen, like 1 or 0.
It just has... | stackexchange_codegolf |
Now, we all know most languages have very simple ways to "self-modify" code.
However, what if you were to actually modify the code and edit parts of it...on disk?
Your goal is to make code that prints a number, then edits its own file to replace the number with the next one in the Fibonacci sequence like so:
$ ./progr... | stackexchange_codegolf |
The Blow-up is a powerful tool in algebraic geometry. It allows the removal of singularities from algebraic sets while preserving the rest of their structure.
If you're not familiar with any of that don't worry, the actual computation is not difficult to understand (see below).
In the following we are considering the ... | stackexchange_codegolf |
In this challenge you've to print multiplication tables by input, Here are some examples:
Input: 2
Output:
0 2 4 6 8 10 12 14 16 18 20
Input: 20
Output: 20 40 60 80 100 120 140 160 180 200
Rules
The shortest code in bytes wins.
This challenge is a code-golf, It follows code-golf general rules (code-golf)
... | stackexchange_codegolf |
Wordle is a daily online word game that has received considerable attention recently.
The Game
The object is to guess a secret word in the fewest attempts. Consider the following instance of the game:
The secret word is rebus, and the player's first guess was arise. The letters r, s, and e are displayed in yellow to i... | stackexchange_codegolf |
Task
Given a representation of a line, output the number of quadrants that that line passes through.
Valid Representations of a Line
You can represent a line as
Three signed integers A, B, and C which share no common factor and where A and B are not both zero, representing the line Ax + By = C,
Four signed integers X1... | stackexchange_codegolf |
There are 5 different "special characters": % & # $ !
These special characters are in a string with numbers. Like so: "5 ! 60%2$5.3" (valid). You must determine the validity of the string and there are certain rules in order to determine validity of the string.
Rules:
These special characters can exist in a string... | stackexchange_codegolf |
There's never really been a definitive ASCII-cards challenge AFAIK. So, using the following deck of ASCII cards:
.------..------..------..------..------..------..------..------..------..------..------..------..------.
|2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||Q.--. ||K.--. ||A.--.... | stackexchange_codegolf |
Write a program that reviews posts for the Close Votes queue on Stack Overflow.
Since it's near-impossible to write a bot that can accurately review posts in the actual queue, we're instead going to use a grossly oversimplified version of the queue and its rules.
Your program should take in the body of a question as a ... | stackexchange_codegolf |
Introduction (may be ignored)
Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the fifth challenge in this series (links to the first, second, third and fourth challenge).
I... | stackexchange_codegolf |
Originally posted (and deleted) by @Tlink, which was most likely inspired from this StackOverflow question.
Since it was a shame it got deleted, because it seemed like a good challenge in general, I figured I'd repost it with proper formatting and rules. (I've tried contacting @Tlink and get his/her permission to post ... | stackexchange_codegolf |
The challenge
Find the smallest feedforward neural network such that, given any 3-dimensional input vector \$(a,b,c)\$ with integer entries in \$[-10,10]\$, the network outputs the largest (i.e., "most positive") root of the polynomial \$x^3+ax^2+bx+c\$ with error strictly smaller than \$0.1\$.
Admissibility
The notion... | 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 |
A space cleaner is a special character which removes all spaces between it and the first non space character to its left and it is represented by a '!' character.
If it reaches the beginning of the string it stops.
Given a string output the string in any reasonable format after the cleaning process.
Trailing spaces at ... | stackexchange_codegolf |
A similar play on the boggle problem from before (some text from that has been used below, edited to fit)
any code that solves the familiar "text-twist" game
Objective
7 letters are given at random, to which there is a minimum 1 word that uses all 7 letters, and multiple words using less (3 or more required)
The letter... | stackexchange_codegolf |
Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.
Your program must output the least precise amount of time which has passed, among the following metrics and their lengths in seconds:
second = 1
minute = 60
hour = 60 * 60
day = 6... | stackexchange_codegolf |
This is thematically similar to Generate keyboard shortcuts for a menu, but its actually a pretty different challenge.
Let's take PHPStorm's menu as an example:
New Project
New
Open Directory
Open
Open URL
New Project from Existing Files
Save As
Open Recent
Close Project
Rename Project
We need to assign a single-lette... | stackexchange_codegolf |
Task
In this challenge, your task is to write a program or function which takes an array of paths with an additional boolean indicating it is a file or directory and outputs a file/directory tree in any reasonable format.
Remarks
Some directories can end with a forward slash ("/") but this is not always the case
A par... | stackexchange_codegolf |
Suppose we have an array \$\texttt{ps}\$ of length \$n\$ with pointers pointing to some location in the array: The process of "pointer jumping" will set every pointer to the location the pointer it points to points to.
For the purpose of this challenge a pointer is the (zero-based) index of an element of the array, thi... | stackexchange_codegolf |
Create three programs, which we'll call Rock, Paper, and Scissors.
Each program must be unique, and accept input.
If a program gets any input which is not one of the programs Rock, Paper or Scissors, it must print itself.
RPS style, the programs will each print one of the following four outputs:
"win" if the running ... | stackexchange_codegolf |
Background
Most (halfway decent) text editors allow you to navigate text using the arrow keys. Up and down allow you to navigate lines, while left and right move across a line but also wrap around. Furthermore, if the line is shorter than your cursor's X position, the cursor appears at the end of the line but returns... | stackexchange_codegolf |
I'm recieving 2-dimensional positions of two objects as a string with this format: x1,y1,x2,y2. The string is recieved from a readline call (replaced in the snippet with a prompt).
In order to get the horizontal and vertical position differentials, I'm writing the following code:
[x1,y1,x2,y2]=prompt("Please enter th... | stackexchange_codegolf |
Note, challenge copied from question asked at math.stackexchange.
Recently, I attained quite some skill at blowing bubbles. At first I would blow bubbles like this:
But then things started getting strange:
After a while, I was blowing some pretty weird bubbles:
After blowing hundreds, maybe even thousands of such bu... | stackexchange_codegolf |
You know how you get a voicemail message and the person's connection wasn't great, and you're trying to figure out how to call them back, but you're not sure if that was a "5" or an "8" they said?
That's this challenge.
The good news is that the caller read off their number twice, but it's garbled in both places.
Your ... | stackexchange_codegolf |
Here is an ASCII-art of a 4-way intersection:
| | |
| |
| | |
| |
| | |
-----+-----+-----
| |
- - -| |- - -
| |
-----+-----+-----
| | |
| |
| | |
| |
| | |
(Note how the horizontal roads are 3 rows tall, while... | stackexchange_codegolf |
Your task is to convert non-empty strings - between strings using the 26 letters, and programs, which are strings of bytes, where each byte has 256 possible values. You should use the same codepage your answer is written in for the possible values of bytes.
You need to do the following to do the conversion:
Convert th... | stackexchange_codegolf |
Background
An Eisenstein integer is a complex number of the form \$ z = a + b\omega \$ where \$a, b\$ are integers and \$\omega\$ is the third root of unity \$\frac{1-\sqrt3i}{2}\$. The Eisenstein integers can be viewed as the triangular lattice points, as shown in the image below (from Wikipedia):
Following the trian... | stackexchange_codegolf |
Print the biggest-size subset of strings in the input that are all permutations of each other. If there are ties, any one will do. If no strings are permutations of each other (for example, only one string was given or the strings contain distinct characters), this is just one of the strings. If no strings were passed ... | stackexchange_codegolf |
In chess, the queen piece can move arbitrarily far in each cardinal and intercardinal direction. What does this mean? Well, I'll show you with an ASCII drawing:
\..|../
.\.|./.
..\|/..
---Q---
../|\..
./.|.\.
/..|..\
It means the queen (notated as Q) can move along these lines (notated as \, |, /, and -), and cannot r... | stackexchange_codegolf |
Think of cleave as the conceptual inverse of map. If map applies a function to each number in a list...
map([1, 2, 3], x -> x * 5) -> [5, 10, 15]
then cleave applies each function in a list to a number.
cleave(5, [x -> x * 2, x -> x - 1, x -> x * x]) -> [10, 4, 25]
More formally, given:
\$n\$, an integer, and
\$L\$, a... | stackexchange_codegolf |
You must write a program or function that, when given a nonempty string S of N printable ASCII characters†, outputs a program that will exit with exit code C, where C is the ASCII codepoint at position 0 in S. This program you write will additionally output a program P, such that, when run, it exits with exit code C′, ... | stackexchange_codegolf |
Task
This one is simple. We want to compress a URL, but don't trust URL shorteners.
Write a program that prints to stdout (or a 0-argument function that returns) the following, working URL:
http://a.b.c.d.e.f.g.h.i.j.k.l.m.n.oo.pp.qqq.rrrr.ssssss.tttttttt.uuuuuuuuuuu.vvvvvvvvvvvvvvv.wwwwwwwwwwwwwwwwwwwwww.xxxxxxxxxxxx... | stackexchange_codegolf |
The Najdorf Variation of the Sicilian Defence is an opening often played at the highest level of chess. It is named after GM Miguel Najdorf and is known for being extremely sharp and theory heavy.
Your task is to write a program that, given a Boolean-like input, prints a chessboard representation of the opening from ei... | stackexchange_codegolf |
I recently saw this language in a challenge and it's awesome. Does anyone have some tips for code-golfing in it?
Your tips should be at least somewhat specific to MarioLANG.
Please post one tip per answer.
| stackexchange_codegolf |
A leaper is a category of fairy chess piece which moves by "jumping." A normal knight is a (1,2)-leaper, meaning each move involves moving a distance of 1 square in an orthogonal direction and 2 squares in the perpendicular direction.
.o.o.
o...o
..N..
o...o
.o.o.
There are many different leapers. The (1,3)-leaper is... | stackexchange_codegolf |
Challenge:
To take two points on the plane and figure out the position of the point that's a) on the line that connects them, and b) equally distant from each of the original points.
Example:
(0,0), (3,3) -> (1.5,1.5)
(-1,-1), (1,1) -> (0,0)
(-7,3), (2,-2) -> (-2.5,0.5)
(3, 1), (-5,9) -> (-1,5)
Rules:
The input an... | stackexchange_codegolf |
After all assignments are submitted, a dictionary is created that maps student number to the hash of their file.
This dictionary, or hashmap, or mapping (whatever your language calls it) will look as follows:
{100: "aabb", 104: "43a", 52: "00ab", 430: "aabb", 332: "43a"}
The key is the student number, and the value is ... | stackexchange_codegolf |
I'm trying to shorten a bash solution to a Code Golf challenge, which requires an output of true or false. I've managed to condense the key piece of the code down to a substring check, to determine if the provided argument, $1, is a substring of a particular hard-coded fixed string, of the form:
[[ FIXEDSTRING = *$1* ]... | stackexchange_codegolf |
In any programming language, make a program that outputs infinite subsequent powers of two, starting at any power of two with finite integer exponent. There does not need to be a seperator between outputs.
Note: it only has to theoretically output infinite subequent powers of two given infinite integer size (so you can... | 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 |
I do not believe this question to be a duplicate of this one, since this one requires more string manipulation, if it is still a duplicate feel free to close this question
Introduction
Your challenge today is to output the lyrics of "99 bottles of beer":
99 bottles of beer on the wall, 99 bottles of beer.
Take one down... | stackexchange_codegolf |
Challenge
Given the formula of a chemical, output the Mr of the compound.
Equation
Each element in the compound is followed by a number that denotes the number of said atom in the compound. If there isn't a number, there is only one of that atom in the compound.
Some examples are:
Ethanol (C2H6O) would be C2H6O where ... | stackexchange_codegolf |
In this challenge, you will write an interpreter for 2Ω (transcribed as TwoMega), a language based loosely on brainfuck with an infinite-dimensional storage space.
The Language
2Ω contains three pieces of state:
The Tape, which is an infinite list of bits, all initialized to 0. It has a leftmost element, but no rightm... | stackexchange_codegolf |
Input
Integers a1, a2, a3, b1, b2, b3 each in the range 1 to 20.
Output
True if a1^(a2^a3) > b1^(b2^b3) and False otherwise.
^ is exponentiation in this question.
Rules
This is code-golf. Your code must terminate correctly within 10 seconds for any valid input on a standard desktop PC.
You can output anything Truthy ... | stackexchange_codegolf |
Inspired by this. No avocados were harmed in the making of this challenge.
Hello I have challenge I need help juic an avocado so I need program to tell me how long to juic avocad for
Observe this ASCII art avocado:
######
# #
# #### #
# # p# #
## #### #
# #
######
This avocado consists... | stackexchange_codegolf |
Input
Your input is a list of single-digit numbers in any reasonable format, including a string of digits.
The input will not be empty.
Output
Your output shall be the input list, but with each maximal run of nonzero digits being reversed.
Example
Consider the input
95883007414830
<---> <---->
where the nonzero runs ... | stackexchange_codegolf |
Modern British number plates (a.k.a. registration marks or license plates) use the format AANNXXX where AA is a "DVLA memory tag" (basically a location code), NN is the age identifier, and XXX is three random letters.
Your task is to, given a date, generate a random valid number plate with a date code matching the supp... | stackexchange_codegolf |
Introduction and Credit
We all know and love our awesome rules to test whether a number is divisble by 11 or 3, which is just some clever sum over the digits of the number. Now this challenge takes this to a new level, by requiring you to compute the sum of the digits and then checking whether the result is a perfect i... | stackexchange_codegolf |
Specifications
Your program must can take in an integer n, then take in n more strings (containing only alphanumeric characters) in your preferred method (separated by whitespace, file input, hash table etc.). You must then find the permutation before the inputted strings when sorted in lexicographical order, and outpu... | stackexchange_codegolf |
Given an integer N from 1-9, you must print an NxN grid of NxN boxes that print alternating 1s and Ns, with each box having an alternating starting integer.
Examples
Input: 1
Output:
1
Input: 2
Output:
12 21
21 12
21 12
12 21
Input: 3
Output:
131 313 131
313 131 313
131 313 131
313 131 313
131 313... | stackexchange_codegolf |
Goal
Write a program or function that translates a numerical telephone number into text that makes it easy to say. When digits are repeated, they should be read as "double n" or "triple n".
Requirements
Input
A string of digits.
Assume all characters are digits from 0 to 9.
Assume the string contains at least one cha... | stackexchange_codegolf |
The task is to provide code that evaluates to 0.5 numerically, i.e. the output must be recognized by your chosen language as a numeric value (Number, float, double, etc), not as a string. The catch, the characters 0 through to 9 cannot be used.
PLEASE NOTE: This IS NOT a golfing challenge, this is a popularity contest,... | stackexchange_codegolf |
Write a program which removes any common leading spaces from the input string. For example, if the least indented line started with 3 spaces, and every other line has >= 3 leading spaces, then remove 3 spaces from the beginning of each line.
The indentation consists solely of spaces, and the string will not contain any... | stackexchange_codegolf |
Dart is an object oriented programming language borrowing from both Java and Javascript. What general tips do you have for golfing in Dart? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Dart (e.g. "remove comments" is not an answer). Please post one ti... | stackexchange_codegolf |
I define the method of combining a sequence to mean that every number in the sequence is concatenated as a string, then that result is made an integer.
[1, 2, 3] -> 123
For every finite sequence of at least 3 consecutive integers, missing exactly one element in the sequence, and this missing element may not be the fir... | stackexchange_codegolf |
A simple Markov Model will be used in this question. For more information about Markov Chains, see http://setosa.io/ev/markov-chains/.
Take a string. For this example, we will use the word:
reader
Now, for each character, take the characters that appear after each occurence of the character in the string. (`^` repre... | stackexchange_codegolf |
Hermite polynomials refer to two sequences of polynomials:
The "probabilist's Hermite polynomials", given by
$${He}_n(x) = (-1)^n e ^ \frac {x^2} 2 \frac {d^n} {dx^n} e ^ {-\frac {x^2} 2}$$
where \$\frac {d^n} {dx^n} f(x)\$ refers to the \$n\$th derivative of \$f(x)\$
The "physicist's Hermite polynomials", given by
$... | stackexchange_codegolf |
Sandbox
Adapted from exercise 8 of 100 little Keg exercises
String manipulation is a very important part of any programming language. Consequently, that is what this challenge is about.
The Challenge
I want you to write a program that:
Takes a series of characters as input and,
Then takes another input (integer/letter... | stackexchange_codegolf |
The cross product of two three-dimensional vectors \$\vec a\$ and \$\vec b\$ is the unique vector \$\vec c\$ such that:
\$\vec c\$ is orthogonal to both \$\vec a\$ and \$\vec b\$
The magnitude of \$\vec c\$ is equal to the area of the parallelogram formed by \$\vec a\$ and \$\vec b\$
The directions of \$\vec a\$, \... | stackexchange_codegolf |
Challenge
This challenge is pretty simple: Output the total number of possible Tweets. Given the fact that \$1{,}114{,}112\$ Unicode characters exist, and Tweets can be up to \$280\$ characters long, we calculate this number like so:
$$\sum_{l=1}^{280}1{,}114{,}112^l$$
Calculated, this number becomes:
13806352273767118... | stackexchange_codegolf |
You are the treasurer and you have received information that a counterfeit coin has entered the treasury. All you know is that the counterfeit coin is lighter than the original.
Knowing how many coins you have in total and using only a balance scale, you need to determine the minimum number of weighings to determine wh... | stackexchange_codegolf |
Based on a chat message
The Challenge
Given an input number \$n > 9\$, construct its reverse, ignoring leading zeros. Then, construct a list of all prime factors that the number and its reverse don't have in common. Multiply those factors together to create the Uncommon Factor Number of the input.
Or, to put it another... | stackexchange_codegolf |
Your challenge is to turn a Japanese word and a dictionary pitch accent number into a new string where the rises and falls in pitch are marked: e.g. (2, ウシロ) → ウ/シ\ロ.
To help you out with this, I'll explain a little about Japanese phonology.
Background: on moras
For the purpose of this challenge, we will write Japane... | stackexchange_codegolf |
Disclaimer: This challenge inspired by me spending the morning debugging recursive functions, which have been frying my brain a little.
Here's an example of recursion, from a letter, we keep going to the previous letter of the alphabet, printing out each one as we go, until we hit the letter a, then we print that and s... | stackexchange_codegolf |
You are fish in a pond that needs to survive by eating other fish. You can only eat fish that are the same size or smaller than yourself. You must create a program that takes a shoal of fish as sorted input. From this you must work out how many fish you can eat and ultimately the size you will grow to.
Size chart
+----... | stackexchange_codegolf |
Given an integer N perform the following steps: (using 9 as an example).
Receive input N. (9)
Convert N from base10 to base2. (1001)
Increase every bit by 1. (2112)
Treat the result as base3 and convert it back to base10. (68)
Return/Output the result.
Input
May be received in any reasonable number format.
You only ... | stackexchange_codegolf |
Background
Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation to make programming easier and faster.
The challenge
Let's look at snippet written by Joe a moment ago:
0+++++1+++++0[3+... | stackexchange_codegolf |
You work in a kitchen which has a peculiar rule. When you mix something into a pot you must always add at least one new ingredient.
So you can add pasta, oil, salt then pesto, but not pasta, pesto, salt and oil since pesto already contains salt and oil. You only have one pot per dish, so you can't mix ingredients in on... | stackexchange_codegolf |
You are a foreign trader, hoping to make a profit. There are 5 goods people wish to trade: Apricots, Boars, Canaries, Daffodils, and Earwigs. Starting in the winter, you need to decide what to produce. Then, in the fall, you travel and spend your days trading for a profit.
Gameplay
You start the game with 10 of each... | stackexchange_codegolf |
A Pillai prime is a prime number \$p\$ for which there exists some positive \$m\$ such that \$(m! + 1) \equiv 0 \:(\text{mod } p)\$ and \$p \not\equiv 1\:(\text{mod }m)\$.
In other words, an integer \$p\$ is a Pillai prime if it is a prime number, if there exists another positive integer \$m\$ such that the factorial... | stackexchange_codegolf |
Ouput the following banner:
_____ _ _____ _ __
/ ____| | | / ____| | |/ _|
| | ___ __| | ___ | | __ ___ | | |_
| | / _ \ / _` |/ _ \ | | |_ |/ _ \| | _|
| |___| (_) | (_| | __/ | |__| | (_) | | |
\_____\___/ \__,_|\___| \_____|\___/|_|_|
The code ... | stackexchange_codegolf |
In the spirit of Solve the Halting Problem for Befinge, let's define another 2D language called Modilar SNISP. Modilar SNISP has the following six instructions:
\ directs the instruction pointer as follows:
if approached from the top, go right;
if approached from the right, go up;
if approached from the bottom, go l... | stackexchange_codegolf |
Below on the left is a picture of a sorting network that can sort 4 inputs. On the right you can see it sorting the input 3,2,4,1.
A sorting network of size n consists of a set of n horizontal wires where two wires can be connected by a vertical wire. The inputs to a sorting network move from the left to the right on ... | stackexchange_codegolf |
The problem with the Caesar cipher is the resulting words are often unpronounceable. The problem with Pig Latin is that it is easy to decode. Why not combine them?
Input
A word consisting of the 26 english letters.
Output
First, change every consonant in the word to the next consonant in the alphabet. So, b goe... | stackexchange_codegolf |
GHC command line errors can be horrible, lets make them as bad as possible. To disincentivize very long programs use the following formula to calculate your "score".
(# of bytes of GHC output) / 2^(8 + # of bytes of code)
Template Haskell is banned as there is probably a TH configuration where you can replicate an err... | stackexchange_codegolf |
Introduction - What is a necklace?
A necklace is something that OEIS people are obsessed with. The OEIS challenge has like 5 necklace sequences.
A binary necklace of length n is a loop with n beads that are either 0 or 1. Two necklaces are the same if one can be rotated to become the other, and two reversible necklaces... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.