instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Your task is to convert a given positive integer from Arabic numeral to Roman numeral.
Things get difficult when you count to 4000.
The romans did this by adding a line above a symbol to multiply that symbol by 1 000. However, overlines aren't exactly displayable in ASCII. Also, there are double overlines to multiply a... | stackexchange_codegolf |
The title is an homage of the Natural Number Game, which is a nice interactive tutorial into proving certain properties of natural numbers in Lean.
Given that the previous two were slightly too involved (either mathematically or technically) for newcomers to Lean (i.e. the vast majority of CGCC community), I decided to... | stackexchange_codegolf |
Given a positive integer n, randomly output n non negative integers that sum to one hundred. n will be at most 200. The output should be present as a list of integers (not sorted).
Your random sample should be uniformly sampled from all lists of n non negative integers that sum to one hundred.
Your code should run in a... | stackexchange_codegolf |
Hamming numbers are numbers which evenly divide a power of 60. Equivalently, their prime factors are all \$ \le 5 \$.
Given a positive integer, print that many Hamming numbers, in order.
Rules:
Input will be a positive integer \$n \le 1,000,000 \$
Output should be the first \$n\$ terms of https://oeis.org/A051037
Exec... | stackexchange_codegolf |
This is a code-shuffleboard answer-chaining challenge, where the answers will aim to, together, output the lyrics to this beloved 80s song.
This is the full lyrics of the song, line by line. The first answer will contain a program that will output the first line of the song (We're no strangers to love). The second wil... | stackexchange_codegolf |
I came across SVGCaptcha, and immediately knew it was a bad idea.
I would like you to show just how bad an idea this is by extracting the validation code from the SVG images that code produces.
An example image looks like this:
Here is the source of the example image:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE s... | stackexchange_codegolf |
You will be given a string s. It is guaranteed that the string has equal and at least one [s and ]s. It is also guaranteed that the brackets are balanced. The string can also have other characters.
The objective is to output/return a list of tuples or a list of lists containing indices of each [ and ] pair.
note: The s... | stackexchange_codegolf |
Easy As ABC, also known as "End View", is a puzzle where you are given an empty grid with letters around it; you must partially fill in the grid so that exactly one of each letter is in every row and column; in addition, letters at the end of a row (or column) must be the first letter visible in that row (or column) fr... | stackexchange_codegolf |
Challenge
Robin likes having his variables declaration in the shape of an arrow. Here's how he does it:
Input any number of strings
Order them by ascending length
Output them ordered by the middle to roughly form a negative arrowhead, like this (whichever order golfs the best):
5 or 4
3 2
1 1
2 3
4 ... | stackexchange_codegolf |
Task:
With the minimum amount of bytes, determine today's Zodiac sign using the programming language of your choice.
Rules:
This is code golf, the answer with the fewest characters wins. The initialization of getting the current date into a variable (e.g. var now = new Date();) does not add to the count. Leap years mu... | stackexchange_codegolf |
I have a bunch of boards I need to stack in as small a space as possible. Unfortunately, the boards fall over if I stack them more than 10 high. I need a program to tell me how to stack the boards to take as little horizontal space as possible, without stacking boards more than ten high, or having boards hanging out ... | stackexchange_codegolf |
Are you feeling jealousy towards Mathematica, Matlab et al. for their intricate plotting capabilities? If you answered yes, this challenge is for you!
Challenge
Given, via parameters or standard input, a list of numbers list and a positive integer h for the height of the plot, write a program/function/snippet that prin... | stackexchange_codegolf |
Let's say you have a 20-sided die. You start rolling that die and have to roll it a few dozen times before you finally roll all 20 values. You wonder, how many rolls do I need before I get a 50% chance of seeing all 20 values? And how many rolls of an n-sided die do I need to roll before I roll all n sides?
After some... | stackexchange_codegolf |
Draw the Biohazard symbol in an arbitrary colour on a distinctly coloured background. The specific proportions were published in the June 27th 1974 issue of the Federal Register of the US Government.
Details
As output, writing to a file (raster and vector formats are permitted) or displaying on the screen are both all... | 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 |
Introduction
This challenge is similar to Project Euler problems. I came up with it because I was playing a deceivingly simple board game and couldn't come up with an efficient solution to answer a simple question about its mechanics.
Quarto is a fun variant of 4 in a row. It is played on a 4 by 4 board with 16 unique ... | 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 |
You receive an input with a number and a string with a space in the middle. The string tells you what you need to do with the number, it can be:
sqrt - square root of number
sqr - square of number
cube - cube of number
abs - absolute of number
round - rounded version of number
You need to output the final result of the... | stackexchange_codegolf |
This challenge is to output to your terminal, window, canvas or screen the numbers zero to 10 inclusive. Each outputted number must be shown as a 4-bit wide nybble, so zero must show as 0000 and so on.
You may separate each number outputted with a space, comma or carriage return. Smallest solution wins but the numbers ... | stackexchange_codegolf |
This is my head:
\ /-- -|
/ -\ | | |
\ \ \ \ |
--\ | \ | |
/ |--| / / |
/|- //--| / |
| | || //\ |
| \ /| // \ |
It consists of exactly eight hairs. My hair is too long. Please cut each individual strand to a length I specify.
Input
The main attraction in this section is the act... | stackexchange_codegolf |
I'm golfing a program to sum two numbers in C++.
Example:
10 3
13
I found out that this problem can be solved in 54 symbols (without spaces and so on) using C++.
My code (63 symbols):
#include <iostream>
main() {
int a, b;
std::cin >> a >> b;
std::cout << a + b;
}
I have no idea how to make my program sho... | stackexchange_codegolf |
Rotonyms 1
ROT13 ("rotate by 13 places") is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in the alphabet. So, A becomes N, N becomes A, B <-> O, and so on to M <-> Z.
ROT13('abcdefghijklmnopqrstuvwxyz') == 'nopqrstuvwxyzabcdefghijklm'
A "Rotonym" is a word (pair) that ROT... | stackexchange_codegolf |
Write a program or function that fulfills the following
Scores less than 101 bytes under normal code-golf rules
Takes no input1 and always outputs a single integer.
Every integer is a possible output.
Your score will be the probability of the most frequent integer occurring, with a lower scoring being the goal. That... | stackexchange_codegolf |
The Peirce quincuncial projection is pretty neat. It actually tessellates the whole plane:
Your job is to generate this map projection.
To simplify things, you will only need to generate the northern hemisphere.
Also, you will be given the stereographic projection of the northern hemisphere as input:
(based on https:... | stackexchange_codegolf |
Poke is a really simple incomplete-information game. It's like "Poker", but simpler. At the start of every round, each player is dealt a hand. To simplify things, a hand is a uniformly distributed random number between 0 and 1. Each player only knows their own hand. The player that wins the round is the one whose hand ... | stackexchange_codegolf |
A directed graph G is given with Vertices V and Edges E, representing train stations and unidirectional train routes respectively.
Trains of different train numbers move in between pairs of Vertices in a single direction.
Vertices of G are connected with one another through trains with allotted train numbers.
A hop is ... | stackexchange_codegolf |
This challenge is in honor of mathematician John Conway who passed away April 11, 2020 due to COVID-19. He was famous for coming up with the Game of Life cellular automaton and many other mathematical contributions such as the surreal numbers and the monster group.
The advanced math of those topics is out scope for thi... | stackexchange_codegolf |
Challenge
Write code that outputs TeX (LaTeX) math-equation code (given below) that will typeset Sierpinski Triangle Fractal of 5 levels. Shortest code wins.
Details
TeX (and friends like LaTeX, etc.) is a sophisticated typesetting system. It can render arbitrary nested complex expressions for mathematical formulas. Co... | stackexchange_codegolf |
Pip is an imperative golfing language with infix operators. It also borrows some features from functional and array programming.
What general tips do you have for golfing in Pip? I'm looking for approaches and tricks that are commonly useful for code golf and are specific to Pip (e.g. "remove comments" is not an answer... | stackexchange_codegolf |
Given an input string, output that string with all vowels a, e, i, o and u swapped at random between each other.
For example, in the string this is a test, there are 4 vowels: [i, i, a, e]. A valid shuffling of those vowels could be [a, i, e, i] therefore yielding the output thas is e tist.
About shuffling
All shuffles... | 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 |
Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n is a natural number.
Task: Given a prime power pn > 1, return the prime p.
Testcases:
input output
9 3
16 2
343 7
2687 2687
59049 3
Scoring: This is code-golf. Shortest answer in bytes wins.
| stackexchange_codegolf |
This is a rock paper scissors competition. Algorithms will face each other in 100 rounds of rock paper scissors. Except that the algorithms will also be able to read the source code of each other!
Leaderboard
1. Chaos Bot (by Aiden4) - 27 Points, 168 bytes
2. Anti-99%-of-posts (by Lyxal) - 24 Points, 489 bytes
3. Psued... | stackexchange_codegolf |
Problem Description
Imagine you're a turtle on a grid. You're given two numbers f and b, and you're facing east. You perform a march across the grid, counting each of the cells you encounter, according to the following rules:
By default, you write the count to the cell you're in, then walk forward.
If the count is di... | stackexchange_codegolf |
Given a string ending in either "er", "ir", or "re" (the "infinitive"), output the full conjugation of the string as a French verb in the seven simple tenses. For each tense (in the order given below), output each subject pronoun in the following order: je, tu, il, elle, nous, vous, ils, elles; followed by a space, the... | stackexchange_codegolf |
There is currently a meme on the internet that consist of taking a sentence, reverse the meaning and adding n't at the end. For example, I am small becomes I am talln't
Challenge
For the sake of the challenge, we'll simplify this : Your task will be to detect whenever there is a negation in a sentence, and replace it w... | stackexchange_codegolf |
You will be given a (possibly empty) string containing brackets ([{()}]) and any other characters (A-Z, a-z, 0-9, punctuation). You need to check if it adheres to the following rules:
Non-bracket characters are ignored.
Every open bracket [{( has a closing bracket )}]. So []( is not allowed.
Brackets are nested proper... | stackexchange_codegolf |
For more information, watch this video, and go to A276523 for a related sequence.
The Mondrian Puzzle (for an integer n) is the following:
Fit non-congruent rectangles into a n*n square grid. What is the smallest difference possible between the largest and the smallest rectangle?
For 6, the optimal difference for M(6) ... | stackexchange_codegolf |
Introduction
I crochet a lot, and lately I've started writing crochet patterns. However, while I work very well from notes such as rnds 2-6 (round number = x, original number of stitches = y): *dc x-2 stitches, 2 dc in next stitch* around (xy stitches), most published patterns spell out each row in more detail. I don't... | stackexchange_codegolf |
A Geiger counter is a device that is used to detect radiation.
We will be making a Geiger counter program.
As we all know, when radiation hits a computer program it removes exactly 1 byte at random. So a Geiger counter program is a program that itself does nothing, but when any byte is removed the modified program pri... | stackexchange_codegolf |
Definitions
A perfect square is an integer which can be expressed as the square of another integer. For example, 36 is a perfect square because 6^2 = 36.
A squarefree number is an integer which is not divisible by any perfect square, except by 1. For example, 10 is a squarefree number. However, 12 is not a squarefree ... | stackexchange_codegolf |
Given a polynomial function f (e.g. as a list p of real coefficients in ascending or descending order), a non-negative integer n, and a real value x, return:
f n(x)
i.e. the value of f (f (f (…f (x)…))) for n applications of f on x.
Use reasonable precision and rounding.
Solutions that take f as a list of coefficien... | stackexchange_codegolf |
In this challenge we are going to consider lists of integers such that for every member \$x\$ at index \$i\$ then the indexes \$i+x\$ and \$i-x\$ have the value \$x+1\$ or are out of bounds for the list. We will call these trampoline lists.
If we play around with these for a while we can notice that if we start a list... | stackexchange_codegolf |
Adapted from the UIL - Computer Science Programming free response question "Carla" for 2018 District.
Introduction
In UNIX-like operating systems, each file, directory, or link is "owned" by a "user", who is a member of a "group", and has certain "permissions" represented by a ten-character string such as "drwxrwxrwx".... | stackexchange_codegolf |
Inspired by this building (United States Air Force Academy Cadet Chapel, Colorado)
Your task is simple, given a positive integer n, output the spiked building to size n
Testcases
1
->
^
/|\
/.|.\
/..|..\
_______
2
->
^ ^
/|\/|\
/.|..|.\
/..|..|..\
__________
7
->
^ ^ ^ ^ ^ ^ ^
/|\/|\/|\/|\/... | stackexchange_codegolf |
The idea for this code golf puzzle is from link: The Bridge and Torch Problem
The inspiration for this code golf puzzle is the Bridge and Torch
problem, in which d people at the start of a bridge must all cross it
in the least amount of time.
The catch is that at most two people can cross at once, otherwise the
... | stackexchange_codegolf |
The goal is to write a program (anything except explicit brainfuck) which prints Barney Stinson's best rule:
New is always better.
when interpreted normally, but
Legen... wait for it... dary!
When processed with a Brainfuck interpreter.
May the most popular bro win. You have 72 hours to be legendary.
| stackexchange_codegolf |
Background
Many people visit webpages, which require special browsers because of lack of compatibility. So you have to write a script (client sided or server sided), which just prints the name of the browser. Because not everyone has fast internet, the script has to be as short as possible. (This is a joke xD)
Rules
Y... | stackexchange_codegolf |
Usually to run multiple commands consecutively one would do:
sudo apt update && sudo apt upgrade # 35 characters
I can't help but feel there's a neat trick to running these with less keystrokes, and you golfers here love challenges :)
I've found a ton of answers around various SE Sites related to running arguments to ... | stackexchange_codegolf |
Weather conditions at airports are reported to pilots in METAR (METeorological Aerodrome Report) format. This format could be described as being "golfed." Here are some examples:
METAR KPDX 241653Z 16003KT 1/4SM R10R/4500VP6000FT FG SCT000 01/M01 A3040 RMK AO2 SLP293 FG SCT000 T00061006 $
METAR PAMR 241753Z 00000KT 10... | stackexchange_codegolf |
From Wikipedia:
Chopsticks is a hand game for two players, in which players extend a number of fingers from each hand and transfer those scores by taking turns to tap one hand against another.
In this challenge "splits" can only be 4->2+2 or 2->1+1.
Challenge
Your challenge is to make a bot (think the AI and framewor... | stackexchange_codegolf |
Introduction
In chemistry there is a type of extension, .xyz extension,(https://en.wikipedia.org/wiki/XYZ_file_format), that prints in each line
a chemical element, and the coordinates in the plane of the element. This is very useful for chemists to understand chemical compounds and to visualize the compounds in 3D. I ... | stackexchange_codegolf |
Task
Your task is to write as short as possible program preferably in Brainf**k which determines the last digit of given number after it's conversion from decimal to binary system.
Input
An integer in decimal system consisting of up to 200 digits. There is a newline character (ASCII 10) after the given number
Output
On... | stackexchange_codegolf |
Objective
Given a nonnegative integer, calculate its NDos-size as defined below, and output it.
NDos' numeral system
The concept of NDos-size comes from the numeral system I made. It represents every nonnegative integer by a nested list, as follows:
With the binary expansion of given nonnegative integer, each entry of... | stackexchange_codegolf |
Task
Given a string s, output a truthy value if the ASCII code of each letter is divisible by the length of s, and a falsey otherwise.
Input/Output
Input is a nonempty string containing only ASCII [32-126]. Output is a standard truthy/falsey value. Note that you can switch the values, for example returning 0/False if d... | stackexchange_codegolf |
Given a random coordinate (x,y), determine in which square (squares are referenced by their sidelength) it is (or the borders of which squares).
The squares are drawn in a counter clockwise direction, that is, the first square is drawn in the first quadrant, the one after is to the right, the one after that above, th... | stackexchange_codegolf |
A truncated square-pyramid of height \$h\$ has \$h\$ square layers where each layer has a side \$1\$ greater than the one above it, apart from the top layer which is a square of blocks with a given side length.
Here is a truncated square-pyramid of height \$7\$ and top side-length \$4\$ viewed from the side:
... | stackexchange_codegolf |
Challenge
Given an ASCII representation of a Babylonian number as input, output the number in Western Arabic numerals.
Babylonian Numeral System
How did the Babylonians count? Interestingly, they used a Base 60 system with an element of a Base 10 system. Let's first consider the unit column of the system:
The Babylonia... | stackexchange_codegolf |
(inspired by this challenge over on Puzzling -- SPOILERS for that puzzle are below, so stop reading here if you want to solve that puzzle on your own!)
If a letter in a word occurs alphabetically later than the previous letter in the word, we call that a rise between the two letters. Otherwise, including if it's the sa... | stackexchange_codegolf |
Challenge
A Pixel World is a PNG image where gravitational, electromagnetic, and nuclear forces no longer exist. Special forces known as "pixel forces" are all that remain. We define this force as
Fp->q = a * (p * q) / (r * r) * r̂
F is the pixel force that p exerts on q
a is Adams' constant, defined as a = 4.2 * ... | stackexchange_codegolf |
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter:
XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK
Write a program that takes in a single letter character, A-Z, and... | stackexchange_codegolf |
The Setup
Here you can find the full text of The Tragedy of Macbeth. If you view the source, and save it as text, you will notice it comes out to 206,244 total characters (including the whitespace at the end of the html).
The Challenge
Write a program which compresses the text linked above into the smallest possible... | stackexchange_codegolf |
Presumably everybody here knows that for the legacy BIOS, the tiniest bootable disk image is 512 bytes (the lower bound is due to the 2-byte magic at offset 510), and there is a bootsector demoscene where people try to fit the entire demo into the 510 bytes of usable space.
Now that the BIOS is being superseded by UEFI... | stackexchange_codegolf |
Codegolf challenge - mapping values in a multidimensional array
[
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
]
This 2D array is sick of being so false, and wants to find the truth about life, once and for all. Your task is to write a map function to act as a highway to all the values in this array.
An example implementatio... | stackexchange_codegolf |
In atomic physics and quantum chemistry, the electron configuration is the distribution of electrons of an atom in atomic orbitals. For example, the electron configuration of the neon atom is 1s2 2s2 2p6 (From Wikipedia)
Challenge
Your challenge is to take a number representing the atomic number of an element and out... | stackexchange_codegolf |
Challenge
Given guitar tablature you must output the song represented by the tab. This may be to the speakers of your computer or to an audio file (.wav, .mp3, .midi, .aiff, etc.). There will also be a second input for timing.
The tabs may be input via a file or straight to STDIN. The tab will be in ASCII form.
Spec
Al... | stackexchange_codegolf |
Problem Description
We all love a Twix (because it is the best candy), but this is the kids' first Halloween --- we gotta grab at least one of each type of candy for them. Each Halloween all the residents of Numberline avenue send out an email saying what types of candy they'll be giving away this year.
Oh! And we live... | stackexchange_codegolf |
Challenge
Write a program that takes as input a day from April 30, 1789 to August 21, 2019 and returns as output who was president of the USA that day.
Notes
For the list of US presidents, the format of their names, and the period of their presidency, see below:
April 30, 1789 - March 4, 1797 George Washington... | 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 |
One of my favorite mathematical pastimes is to draw a rectangular grid, then to find all of the rectangles that are visible in that grid. Here, take this question, and venture for yourself!
Can you count the number of rectangles?
+-----+-----+-----+-----+
| | | | |
| | | | |
+-----+----... | stackexchange_codegolf |
Task
The prepend,append-Sequence is defined recursively, like this
a(1) = 1
a(n) = a(n-1).n , if n is even
a(n) = n.a(n-1) , if n is odd
where the . represents an integer concatenation.
So the first few terms are: 1,12,312,3124,53124,531246,7531246,... This is A053064.
Your task is, given an integer a > 0 to return... | stackexchange_codegolf |
This challenge is partly an algorithms challenge, involves some math and is partly simply a fastest code challenge.
For some positive integer n, consider a uniformly random string of 1s and 0s of length n and call it A. Now also consider a second uniformly chosen random string of length n whose values are -1, 0, or 1... | stackexchange_codegolf |
It frustrates me that when you say "base 16", the 16 is in base 10. We need a base neutral way of writing down numbers when favoring a specific base would be inappropriate.
How it works
We define <n> to be the nth prime. So <1>=2, <2>=3, <3>=5. Note that every positive integer can be uniquely represented by the product... | stackexchange_codegolf |
Introduction
In Android Studio and other IDEs there are code completions to assist efficient code insertion (especially when the names of the classes or methods are so verbose), like the one in the image below.
There are slightly different logics used between IDEs to determine what classes, methods and variables to su... | stackexchange_codegolf |
A boring version of yourself
Have you ever dreamed of a boring version of you which types the text you just typed ?
No ? Because that's exactly what I'm challenging you to do !
The program needs to check how many time it took for the user to input a text at program launch and then retype the text again using the same p... | stackexchange_codegolf |
Write a program that takes an undirected graph and finds the minimum cut, i.e., the set of edges that, if removed, would disconnect the graph into two or more connected components. The program should have a time complexity of \$O(n^2m)\$, where n is the number of vertices and m is the number of edges in the graph.
One ... | stackexchange_codegolf |
So glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have fun!
Challenge: write efficiently and securely a program that creates an array of n threads that communicate with each o... | stackexchange_codegolf |
Rules
In this challenge, I'm going to redefine the definition of "quotes" a bit.
Quotation marks (AKA quotes) are any identical characters used in pairs in various writing systems to set off direct speech, a quotation, or a phrase. The pair consists of an opening quotation mark and a closing quotation mark, which is t... | stackexchange_codegolf |
A Shift matrix is a binary matrix with one superdiagonal or subdiagonal formed by only ones, everything else is a zero.
A superdiagonal/subdiagonal is a diagonal parallel to the main diagonal, which is not the main diagonal, i.e. all entries \$a_{ij}\$ where \$i=j+k\$ and \$k \neq 0\$.
The main diagonal is defined to b... | stackexchange_codegolf |
A boring version of yourself
Have you ever dreamed of a boring version of you which types the text you just typed ?
No ? Because that's exactly what I'm challenging you to do !
The program needs to check how many time it took for the user to input a text at program launch and then retype the text again using the same p... | stackexchange_codegolf |
Simple Mancala Game
Create a mancala game using as few bytes as possible.
The game
Mancala is a family of games where a player has a control over a set amount of pots filled with stones/seeds. The particular version which you should implement has a board with 14 pots, of which two are designated as scoring pots. At the... | stackexchange_codegolf |
The Challenge
Create an terminating expression in SKI Combinator Calculus in less than 200 combinators (S, K, I) that reduces to the expression with the most combinators.
There will be no limit on how many parenthesis/applications can be used.
SKI
SKI expressions are created using S, K, I and parenthesis. They are redu... | stackexchange_codegolf |
A perfect power is a number of the form \$a^b\$, where \$a>0\$ and \$b>1\$.
For example, \$125\$ is a perfect power because it can be expressed as \$5^3\$.
Goal
Your task is to write a program/function that finds the \$n\$-th perfect power, given a positive integer \$n\$.
Specs
The first perfect power is \$1\$ (which... | stackexchange_codegolf |
This is the robbers' thread. The cops' thread is here.
Your challenge is to take an uncracked submission from the cops' thread and try to find the original unredacted program. Please comment on the cop's submission when you've cracked their code.
| stackexchange_codegolf |
Gozinta Chains
(Inspired by Project Euler #606)
A gozinta chain for n is a sequence {1,a,b,...,n} where each element properly divides the next.
For example, there are eight distinct gozinta chains for 12:
{1,12}, {1,2,12}, {1,2,4,12}, {1,2,6,12}, {1,3,12}, {1,3,6,12}, {1,4,12} and {1,6,12}.
The Challenge
Write a progr... | stackexchange_codegolf |
Challenge
Create a program that will build a recursive list of all linked webpages (given a starting point), to a depth determined by user input.
Any valid link in the HTML should be crawled, whether or not it is a script, image, etc.
Example Input
<program name> <url to crawl> <depth>
webcrawler http://crawlthissite.c... | stackexchange_codegolf |
disclaimer: I'm not aware of any non-bruteforce solutions
A Graeco-Latin square is, for two sets of same length \$n\$, a \$n \times n\$ arrangement of cells, each containing a unique (across the entire square) pair of a element of the first set and a element of the second set, such that all first elements and all sec... | stackexchange_codegolf |
Given two sets of strings, \$ D \$ and \$ R \$, find the shortest string which contains every string in \$ D \$, but contains none of the strings in \$ R \$.
There are almost always multiple possible outputs; you should output at least one of them, but you can output more.
You can assume this is possible with the input... | stackexchange_codegolf |
Your challenge is to write a program that is a quine, meaning it prints out its own source code.
For at least one individual character, when it is removed from the program's source, a single different character is removed from the output.
By different, I mean that the character removed from the code is distinct from th... | stackexchange_codegolf |
Consider, for a given positive integer \$k\$, the sequence \$(a, a+1, a+2, ..., a+k)\$, where \$a\$ is some positive integer. Is there ever a pair \$a, k\$ such that for each element \$a+i\$ in the sequence, either \$\gcd(a, a+i)\$ or \$\gcd(a+i, a+k)\$ are greater than 1?
This was investigated by Alan R. Woods as part... | stackexchange_codegolf |
Given a natural number \$n\$, return the \$n\$-th cuban prime.
Cuban Primes
A cuban prime is a prime number of the form
$$p = \frac{x^3-y^3}{x-y}$$
where \$y>0\$ and \$x = 1+y\$ or \$x = 2+y\$
Details
You may use 0 or 1 based indexing, whatever suits you best.
You can return the \$n\$-th prime given the index \$n\$ or... | stackexchange_codegolf |
Given a number and either "+" or "*", return an addition or multiplication table with the dimensions of that number.
Specifications
The input will be formatted as dimension, operation.
The program should not return anything if the operation input is not + or *.
The program should not return anything if the dimension i... | stackexchange_codegolf |
This is a Cops and Robbers challenge. This is the cop's thread. The robber's thread is here.
As a cop, you must pick any sequence from the OEIS, and write a program p that prints the first integer from that sequence. You must also find some string s. If you insert s somewhere into p, this program must print the second ... | stackexchange_codegolf |
Inspired by this post. For those marking this question as a duplicate I urge you to actually read the question to see that mine is a modification of the one linked. The one linked does not ask for an input and is to just print the alphabet diagonally.
The Challenge
Given an input between 1-26 inclusively, print the alp... | stackexchange_codegolf |
You are given a string of unknown length that contains a varied amount of (, {, [ and their respective closing parentheses (in this context all referred to as brackets).
With one exception, all the brackets are all balanced, meaning an opening one has a corresponding closing one somewhere afterwards in the string.
The ... | stackexchange_codegolf |
The task is to generate all the strings from 'a' to '999' including upper case characters like so:
'a', 'b', 'c' ... 'y', 'z', 'A', 'B', 'C' ... 'Y', 'Z', '0', '1', 2' ...
'8', '9', 'aa', 'ab', 'ac' ... 'az', 'aA', 'aB' ... 'aZ', 'a0' ... 'a9', 'ba'
and so on (filling in the gaps), optionally starting with the empty ... | stackexchange_codegolf |
...Ordinal numbers (or ordinal numerals) are words representing position or rank in a sequential order.
From Wikipedia.
Your task is, using 2 separate programs (of which can be made from 2 different languages), to output the ordinal sequence from first to nth. You will be outputting the full word second as opposed t... | stackexchange_codegolf |
Write a program that takes two lists of strings and generates a javascript regex that fully matches all the strings in the first list and matches none of the strings in the second list.
To be specific when for all stings in the first list str.match(/[your-output]/) must produce a match for the full string and for all s... | stackexchange_codegolf |
You have been given the charge to calculate the current balance as of the day that you perform the calculation for 330,000 individuals who worked for an average of 30 years spanning 300 years where the initial principal was 1 with an addition of 1 per day and interest rate set at 3%.
You initially tried to use online ... | stackexchange_codegolf |
You've gotten out of Earth's gravity well - good for you! However, you're feeling a bit uncomfortable in zero-gravity, and you want to replicate 1 \$g\$ of force in a centrifuge. Use the equation for force in a centrifuge:
$$\text{RCF} = \frac{r_\text{m} \, \left(\frac{2 \pi N_\text{RPM}}{60}\right)^2}{g}$$
Where
\$\t... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.