instruction stringlengths 34 53.1k |
|---|
Are you tired of languages with built in quining techniques?
Your challenge, should you choose to accept it, is to add a built-in quine feature to the language of your choice.
Task
Given some programming language X, you should define
A language X′ that is a subset of X.
A quine command string Q. (This is a string of ... |
An uninteresting number (which I totally didn't make up only for this challenge) is created like this:
Take a positive integer N
Create a new number O by adding the digits of N at the end of N
The final uninteresting number is O*N
For example for N=12:
O = 1212
O*N = 1212 * 12
Final number is 14544
Input
A posi... |
If an integer has a digit/sequence of digits in it which repeats continuously (You will understand why I said "continuously") 5 or more times, we call It "Boring".
For example, 11111 is Boring, whereas 12345 is not.
Instructions
Take an Integer as Input
Output a truthy value if the integer is boring, and a falsey value... |
Given n (the number of players), t (the threshold value), and s (the secret), output the n secrets generated by Shamir's Secret Sharing algorithm.
The Algorithm
For the purposes of this challenge, the computations will be done in GF(251) (the finite field of size 251, otherwise known as the integers mod 251). Ordinaril... |
Given a non-negative integer (n), create a function that returns n in alphabetical order, according to the literal spelling of each digit in n.
Examples:
Input: 101
>> one, zero, one
>> one, one, zero
Output: 110
Input: 31948
>> three, one, nine, four, eight
>> eight, four, nine, one, three
Output: 84913
Input: 5544
... |
Given a string, return that string's "luck".
A string's luck, as I completely just made up for the purpose of this challenge, is an integer, determined as so:
The base luck for a string is 1.
For each consecutive letter it shares with the word "lucky" (case insensitive), multiply the luck by 2. For instance, if your s... |
A dual graph is defined such that for every "face" in a graph G, there is a corresponding vertex in the dual graph, and for every edge on the graph G, there is an edge in the dual graph connecting the vertices corresponding to the two faces on either side of the edge of the original graph. Note that the faces on both s... |
Inspired by this, print an ascii diamond pattern built using 0-9.
Rules
Input n should be between 0-9, anything outside that range is undefined
The diamond should be padded with spaces
The middle line should always have no padding and be the only line to contain n, in the center
Print to stdout
As always, this is code... |
Stackylogic is a logic-based programming language I made up that take in 0's and 1's for input and outputs a single 0 or 1 upon completion.
A Stackylogic program consists of lines that can only contain the three characters 01? as well as exactly one < at the end of one of the lines. Lines may not be empty and the line ... |
Do you recognize the PPCG logo?
it looks like this, when you do an ascii art of it.
+---+
|PCG|
+---+
v
Now, In this Code Golf, You will make a code, that makes logos for other sites, similar to the PPCG logo.
What You should do
The "Shortened" string will be the string, with all upper case letters and numbers in t... |
Create a program that determines, given an input of the path, whether Mario can reach the end, denoted by E, from the start, denoted by S.
A path will look something like this:
S = E
=====
In a path, the various symbols and what they represent are:
=: wall/floor/ceiling. Mario cannot walk through wall , and cannot fa... |
Write a program or function which, given an input string and a standard deviation σ, outputs that string along the normal distribution curve with mean 0 and standard deviation σ.
Normal distribution curve
The y coordinate of each character c is:
where σ is given as input, and where x is the x axis coordinate of c.
Th... |
The challenge
Given an input string, and an integer n - truncate any runs of consecutive characters to a maximum of n length. The characters can be anything, including special characters. The function should be case sensitive, and n can range from 0 to infinity.
Example inputs/outputs:
f("aaaaaaabbbccCCCcc", 2) //"aabb... |
Introduction
Kipple is a stack-based, esoteric programming language invented by Rune Berg in March 2003.
Kipple has 27 stacks, 4 operators, and a control structure.
Stacks
The stacks are named a-z and contain 32-bit signed integers. There is also a special stack, @, to make outputting numbers more convenient. When a nu... |
Chameleon challenges are a bad thing, apparently. Too bad, chameleons are beautiful creatures. Time for a change!
As we all know, many chameleons posses a remarkable ability to blend in with their surroundings by changing the color of their skin. Which is also the objective of this challenge.
Challenge
Imagine a squar... |
The goal is, having taken a string as input, duplicate each latin letter and "toggle" its case (i.e. uppercase becomes lowercase and vice-versa).
Example inputs & outputs:
Input Output
bad bBaAdD
Nice NniIcCeE
T e S t Tt eE Ss tT
s E t sS Ee tT
1!1!1st! 1!1!1sStT!
n00b nN00bB
(e.g... |
Convert a classical directory structure like this:
config.yml
drafts
begin-with-the-crazy-ideas.textile
on-simplicity-in-technology.markdown
includes
footer.html
header.html
Into this
.
├── config.yml
├── drafts
| ├── begin-with-the-crazy-ideas.textile
| └── on-simplicity-in-technology.markdown
└──... |
Everybody loves golfing code. Code is written in English (eh...). Therefore, everybody loves golfing English!
Your task is to write a program or function that takes a string as input, and then returns or prints the golfed version. There will be no newlines or tabs in the input.
This is how you golf a string. The order... |
Introduction
This site is rapidly building up a huge dataset of code snippets, so let's do something with it!
Here's a data file. It contains 9,066 unique language+snippet pairs for 113 languages, all taken from this site. The format is tab-separated (language-TAB-snippet), with all newlines in the snippets replaced wi... |
Inspired by this challenge
Given a number m, output a program that prints out the string Do not repeat yourself.
Now for the challenging part: Each program the original code prints out has to have the byte at place m*n be the same as m*n + 1 and the same as m*n + 2 .... all the way down to m*n + m - 1.
(In case you can... |
Your program's input is a string containing whitespaces, parentheses, and other characters. The string is assumed to be parenthesed correctly, i.e. each right parenthesis matches a unique left parenthesis and vice versa : so the program is allowed to do anything on incorrectly parenthesed strings, such as )abc, (abc or... |
Your goal in this code golf is to take two strings, language and code (if the golfed code you wrote for this is multiline, then this variable would be multiline.), and one integer, bytes. They represent the variables for a programming language, number of bytes it takes, and the code itself.
After that, you are going to... |
i.e each byte appears in a different ANSI shell colour.
Rules
Resetting the color of the shell after output is not required
Must be output in STDOUT or the primary colour text output of your language.
Must be done programmatically (iterating through each color and letter of the string induvidually) instead of just wri... |
You know—they look like this:
source
The goal is to draw a music beats illustration like the following:
= = =
= = = = =
== = == = == = ====
== ==== == === = = =======
======== == ==== = ========= =
=================================
The rules are:
The width of the illustration is 3... |
A heap, also known as a priority-queue, is an abstract data type. Conceptually, it's a binary tree where the children of every node are smaller than or equal to the node itself. (Assuming it's a max-heap.) When an element is pushed or popped, the heap rearranges itself so the the biggest element is the next to be poppe... |
Output the current time of day as Swatch Internet Time.
Specifically, output a three-digit (zero-padded) number of ".beats" (1000ths of a day) which represent the current time of day in the Swatch Internet Time time zone of UTC+01:00 ("Biel Meantime").
For example, if the current time in UTC is 23:47, then it is 00:47 ... |
Challenge: Print the entire printable ASCII charset (not just a range!) in order.
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Rules: read closely
No other characters allowed in the output.
Program/function does not accept input.
Try not to hardcode/embed the outpu... |
Tom is going to implement a new programming language of his invention. But before actually starting working on it, he wants to know whether his language should be case sensitive or not.
On one hand, case insensitivity seems more easy to implement to him, but he worries that it could cause a lack in the possibilities o... |
This year's UEFA Euro 2016 is over and besides a couple of negative headlines there has been a very positive surprise as well – the Iceland national football team. Let's draw their national flag.
Input
Well, obviously this challenge has no input.
Output
Draw the flag of Iceland in any applicable visual format of at le... |
Generate the nth Narayana-Zidek-Capell number given an input n. Fewest bytes win.
f(1)=1, f(n) is the sum of the previous floor(n/2) Narayana-Zidek-Capell terms.
Test Cases:
f(1)=1
f(9)=42
f(14)=1308
f(15)=2605
f(23)=664299
|
Or maybe it's not really a labyrinth, but still.
Rules:
Input is a two-line string, consisting of *, 1, x and X. That string is a labyrinth to walk through. The lines have the equal length.
You could take the input as a string with , (comma) or any convenient separator between these two lines. Or you could take both l... |
0. DEFINITIONS
A sequence is a list of numbers.
A series is the sum of a list of numbers.
The set of natural numbers contains all "non-negative integers greater than zero".
A divisor (in this context) of a natural number j is a natural number i, such that j÷i is also a natural number.
1. PREAMBLE
A couple of other que... |
Power Grid Resource Costs
Introduction
In the board game Power Grid, an integral part of the game is the act of buying resources to fuel your power stations. There are four types of resource used in the game (five, if you include renewable energy, but obviously you can't buy resources for that). These are Coal, Oil, Ga... |
A Latin square is a square that has no repeated symbols in the rows or columns:.
13420
21304
32041
04213
40132
And as many Sudoku players know, you don't need all of the numbers to deduce the remaining numbers.
Your challenge is to compress a Latin square into as few bytes as possible. You need to provide one or two... |
Your task is to create a program or function that generates a zipper with a length of 10 lines. Each line of the zipper is represented by two dashes --:
--
--
--
--
--
--
--
--
--
--
The program/function will take a percentage (divisible by 10) as input, and the output will be the zipper "unzipped" (dashes separated) ... |
Write a program that, given any 'n' number of strings of 'm' length, returns 'm' number of 'n'-length strings, with this condition:
Every new string should contains the letters at the same index of the others strings
For example, the first output string must contain the first letter of all the input strings, the second... |
You must write a program or function.
The input is a 'map' of numbers. You can choose to take the map as either a string with new line characters (\n) or a 2D array of strings.
All maps are 5 characters by 5 characters, and the characters are always either digits greater than 0 or spaces.
Here is an example of a map... |
Input:
An array containing three integers: 0, 1 and 2 in any order (i.e. [2, 0, 1])
And a string of length >= 2 only containing alphabetic letters (both lower- and uppercase) and digits (i.e. a1B2c3)
Output:
Based on the array we sort and output the string.
How does this work?
The array indicates the order precedenc... |
In this challenge, you will be given a text block, and you need to perform reflection on the text.
Input:
A string to be reflected. The text may not be supplied as an array whose elements are the lines of text. For example, "ab\ncd" and ['a','b','\n','c','d'] are allowed, but ['ab','cd'] or [['a','b'],['c','d']] are n... |
Your goal is to output the strictly increasing sequence of consecutive, identical digits of pi (π). Each term in the sequence must be one digit longer than the previous. So 3 (0th digit of pi) is the first time a run of digits occurs (length 1). The next to occur is 33 (digits 24 and 25 of pi). Of course, this sequence... |
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... |
Your task is pretty simple, calculate the n-th element of A190810.
Elements of A190810 are calculated according to these rules:
The first element is 1
The sequence is increasing
If x occurs in the sequence, then 2x+1 and 3x-1 also do
You can use 1-based or 0-based indexing, but if you use 0-based indexing, please say... |
Dropbox recently released Lepton (GitHub), a method that losslessly compresses JPEG images round-trip, saving an average of 22%.
Because of the pigeonhole principle, any general compression algorithm cannot be guaranteed to result in a smaller file (general because it doesn't apply to inputs constrained to a specific ... |
Stock Time Machine
You've gained access to a dataset, tomorrowStocks, which contains the stock prices from your favorite business on the NASDAQ. This dataset is a container indexed by minutes past opening. Each index contains the price of the stock at that time.
// Assume the stock market opens at 9:30AM EDT
// tomorro... |
For this challenge, you will be given an absolute path, and a "new" path (which can be absolute or relative), and you need to return the final path.
For example, if your current directory was /var/tmp/test:
my_dir or my_dir/ should return /var/tmp/test/my_dir
../../my_dir should return /var/my_dir
/my_dir/./ should re... |
Background
The Italian definite article (corresponding to English the) has seven different forms: l', il, lo, gli, i, la, le. Which one to use depends on three variables:
Gender: masculine / feminine.
Number: singular / plural.
Initial letter of the subsequent word: vowel / consonant type A / consonant type B.
Vowel... |
Goal
The goal of this challenge is: given a string as input, remove duplicate pairs of letters, if the second item in the pair is of opposite capitalization. (i.e. uppercase becomes lowercase and vice-versa).
Pairs should be replaced from left to right. For example, aAa should become aa and not aA.
Inputs & outputs:
I... |
GolfScript automatically coerces values, according to the following ‘priority’ sequence:
integer → array → string → block
(listed from lowest to highest.)
This means that "1"7+ leaves the string "17" on the stack (and not 8), because strings have a higher priority than integers.
[To those GolfScript veterans – apolog... |
Given a directory (such as C:/), given from stdin or read from a file, produce a directory tree, with each file/folder indented based on its depth.
Example
If I have a C:/ drive which only contains two folders foo and bar, and bar is empty while foo contains baz.txt, then running with input C:/ produces:
C:/
bar/
... |
Task
Define a mod-fold as a function of the form f(x) = x % a1 % a2 % … % ak, where the ai are positive integers and k ≥ 0. (Here, % is the left-associative modulo operator.)
Given a list of n integers y0, …, yn−1, determine if there exists a mod-fold f so that each yi = f(i).
You may choose and fix any two outputs Y ... |
Write a program which outputs the square root of a given number in the shortest time possible.
Rules
It may not use any builtins or powering with non-integers.
Input format
as a function argument
as a command line argument
as a direct input on stdin or a window
Your entry hasn't to be a complete program, it may be ... |
Introduction
We all know and love our Fibonacci sequence and have seen a myriad of challenge on it here already. However, we're still lacking a very simple case which this answer is going to provide: Reversed fibonacci! So given F_n your job is to find n.
Specification
Input
Your input will be a non-negative integer, w... |
Background
The Copeland–Erdős constant is the concatenation of "0." with the base 10 representations of the prime numbers in order. Its value is
0.23571113171923293137414...
See also OEIS A033308.
Copeland and Erdős proved that this is a normal number. This implies that every natural number can be found at some point ... |
What could be the shortest code for filtering the following array in Javascript without any library?
My code is:
filtered_obj = _.where(obj, { name: "Alpha" });
This uses a JS library called underscore.
Test case:
objs = [{'id':1,'name':'Alpha'},{'id':2,'name':'Beta'},
{'id':3,'name':'Gamma'},{'id':4,'name':'Eta'},
... |
In this code golf challenge, you will verify hashtags!
#What_your_code_should_do
Input is a string. Output a truthy value if it is a valid hashtag, and a falsy value otherwise.
We define a string as a valid Hashtag if ...
It starts with a hash (#).
It doesn't have a number right after the hashtag (e.g. #2016USElection... |
In the most common contemporary graphical desktop interfaces, when you perform double-click in a text, the word around your cursor in the text will be selected.†
For example, let | be your cursor in abc de|f ghi.
Then, when you double click, the substring def will be selected.
Input/Output
You receive two inputs:
a st... |
Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
When printing to stdout, an optional trailing newline after y... |
I'm new here. I tried seeing if this challenge was introduced before. Found a close call one counting the number of cycles, but didn;t find one for listing them. So I'm writing this one. Sorry if I'm repeating...
Anyway, I'm looking for the shortest function to return all close cycles in a shuffled list of indices. For... |
Your task is to take an input n and output element n of the Rummy Sequence, a sequence which I made (looking on OEIS will not help you).
Definition
Each element of the Rummy Sequence is a set of truthy or falsey values. Ex.: [true, false].
The steps to producing a member of the Rummy Sequence are quite simple:
Start o... |
A difference pyramid is a pyramid where each new diagonal is the absolute value of the differences between the elements of the last diagonal. For example, if we start with the array
2 5 4 9 3 4
Now, we arrange these in a diagonal column:
2
5
4
9
3
4
Now, we fill in the nex... |
A binary recurrence sequence is a recursively-defined sequence of the following form:
$$F(1) = a_1 \\ \vdots \\ F(y) = a_y \\
F(n) = \alpha F(n-x) + \beta F(n-y), n > y$$
This is a generalization of the Fibonacci (\$x = 1, y = 2, a = [1, 1], \alpha = 1, \beta = 1\$) sequence and the Lucas (\$x = 1, y = 2, a = [2, 1], \... |
In this challenge, given a list of ghosts from Pac-Man, you must output which ghosts are missing. You must do it in as few bytes as you can
Input
Input will consist of a string or list, which will include a number ghosts, which could include:
Blinky
Inky
Pinky
Clyde
However, input may also include Pac-Man (with that ... |
The text of the children's book Polar Bear, Polar Bear, What Do You Hear? has a very simple pattern. You might use the text to teach introductory programming concepts.
My son was quickly bored by this idea, so I decided to play some golf with it instead.
The Challenge
In your programming language of choice, write the... |
Presented in honor of APL as an interactive tool turning 50 this year
Background
Ken [Iverson] presented his paper Formalism in Programming Languages in August 1963 at a Working Conference on Mechanical Language Structures, Princeton, N.J. The list of conferees is full of famous and soon-to-be famous names, and a few ... |
Summary
Given a list of integers, return the index each integer would end up at when sorted.
For example, if the list was [0,8,-1,5,8], you should return [1,3,0,2,4]. Note that the two 8s maintain their order relative to each other (the sort is stable).
Put another way: For each element in the list, return the number... |
This should be a simple challenge.
Given a number \$n \ge 0\$, output the super-logarithm (or the \$\log^*\$, log-star, or iterated logarithm, which are equivalent since \$n\$ is never negative for this challenge.) of \$n\$.
$$\log^*(n) = \begin{cases}
0 & \text{ if } n \le 1 \\
1 + \log^*(\log(n)) & \text{ if } n > 1... |
Lets Play Kick The Can!
Although Moogie is the current winner, if anyone can take his crown they are encouraged to do so
Kick the can is a children's game. Involving one defender, and multiple attackers. Today it is no longer such a game! Your job is to write a bot that plays it, to win, king-of-the-hill style!
https:/... |
Introduction
When you are given a boring text, you just want to get it over with as quick as possible. Let's observe the following text:
Ens colligi timenda etc priorem judicem. De quascunque ii at contingere
repugnaret explicetur intellectu. Adjuvetis hoc fortassis suspicari opportune
obversari vix eam? Dei praemia ... |
Inspired by this StackOverflow post.
Introduction
Bob's job is to create spreadsheets and organize them. The way he organizes them is known to very few except for Bob, but he creates a list of each of the spreadsheets that fall under the same group. There's a bunch of data in the spreadsheet he creates, but there's o... |
Your task is to create a program or function that takes, as input, a natural number (n) between 1 and 25 (inclusive) and prints an isometric representation of a slide and ladder with n number of rungs.
Ladder and slide specifications
The ladder is always oriented on the left and the slide on the right. We're viewing it... |
In this optimization challenge you will write a program that sorts a single array by only comparing elements through asking the user on stdout to input comparison results on stdin.
The below protocol is line-based, so everytime you print to stdout or read from stdin it is assumed a newline follows. Throughout the quest... |
This is Pascal's Braid:
1 4 15 56 209 780 2911 10864 40545 151316 564719
1 3 11 41 153 571 2131 7953 29681 110771 413403 1542841
1 4 15 56 209 780 2911 10864 40545 151316 564719
I totally made that up. Blaise Pascal didn't have a braid as... |
Validating a CPR number
A Danish CPR number (Person Identification Number) is date of birth followed by 4 digits (the last one being a control digit): DDMMYY-XXXX
The final digit validates the CPR number using Modulo 11 by satisfying the following equation:
where the are the ten digits of the complete ID number, and ... |
In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated:
$$\large{L=\{a^n b^n:n\in\mathbb{Z}^+\}}$$
mainly because this language can not be processed with finite-state automata.
This expression mean "Languag... |
The Post's Correspondence Problem (PCP) gives you a list of pairs of strings, P_1 ... P_n. Your task is to find a k, and some sequence of k indices such that fst(P_i1) ... fst(P_ik) = snd(P_i1) ... snd(P_ik)
We're trying to find some sequence of the pairs where the word we build from the first part is equal to the word... |
In this question, we will only focus on losing weight by doing exercise, although there are still many ways to lose weight.
Different sports burn different amount of calories.
For example, playing billiards for an hour can burn 102 calories[1], while playing basketball for 15 minutes can already burn 119 calories [1], ... |
This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet:
Print all Integers from 1 to 10 inclusive in ascending order to standard output.
Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of th... |
Task
Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd.
You may write a program or a function and use any of the our standard methods of receiving input and providing output.
The output should be a truthy or a falsy v... |
The specification of the "estimated" sign used by the European Union Directive (U+212e in Unicode, which you may not simply print for this challenge) is quite precise.
To copy some restrictions from this question: Render the symbol to file or screen using vector or raster graphics. If your output is rasterised, your i... |
Stackylogic is a programming language I made up in a previous challenge: Run Stackylogic. Read that post for full details and examples, but here is how it works paraphrased:
Stackylogic takes 0's and 1's for input and outputs a single 0
or 1 upon completion.
A program consists of lines that only contain the characte... |
Introduction
Let's observe this array: [3, 2, 4, 1, 1, 5, 1, 2].
Each element displays the length of the substring which must be summed up. Let's take a look at the first element of the above array:
[3, 2, 4, 1, 1, 5, 1, 2]
^
The element at the first index is 3, so we now take a substring of length three with the sam... |
In this challenge, You have to bring ASCII art (which are usually 2D) to 3D!
How?
like this,
X X DD
X D D
X X DD
to...
X X DD
X X DD D
X X DDDD
X XDDD
X X DD
Then How do we do that?
Given the ascii art and N, repeat this N times.
for every character (we will call this A):
let B be the character which is ex... |
Introduction and Motivation
I'm mainly active on Cryptography.SE and as such have already stumbled across the question: "How the hell am I supposed tools like cado-nfs to do stuff!?". They are super-complicated tools for a super-complicated task: Factoring large integers and computing large-scale discrete logarithms.
N... |
The goal of this challenge is to implement a digital low-pass filter.
You are free to implement any type of digital filter you want, however whatever results produced must pass the validation script below.
Here's a general description of what the validation script expects:
When an FFT is taken of the filtered signal, ... |
Gears transfer different amount of speeds, depending on the size of the meshed gear.
Jack has a machine, that rotates a Gear Train. but you don't know the speed of the last gear.
Luckily, You are a great code golfer, so you can help him!
So, What should I do?
Each gear is represented by 2 numbers, the radius of the in... |
Almost all digital camera sensors are organized in a grid of photosensors. Each photo sensor is sensitive for one of the primary colors: red, green and blue. The way those photo sensors are organized is called the Bayer filter, after its inventor, Bryce Bayer of Eastman Kodak. After an image is taken, four photo sensor... |
Task
Given (by any means) a sorted floating point dataset, return (by any means and within 1‰ of the correct value) the interquartile mean.
One possible algorithm
Discard the lowest and highest quarters of the data points.
Calculate the average (sum divided by count) of the remaining data points.
Note: If the dataset... |
The goal of this challenge is to collect selected items in a list and move them to a certain location in the list.
As a visual example, take the input values (represented by black boxed integers) and a corresponding list of truthy values where true denotes the item is selected (represented by blue boxes, where T is tru... |
A lot of languages have built-in ways to get rid of duplicates, or "deduplicate" or "uniquify" a list or string. A less common task is to "detriplicate" a string. That is, for every character that appears, the first two occurrences are kept.
Here is an example where the characters that should be deleted are labelled wi... |
One day you awake only to find yourself caught in an array. You try to just walk out of there, taking one index at the time, but it seems there are other rules:
The array is completely filled with natural numbers.
If you find yourself on an index n, you go to the index array[n], except:
If you find yourself on an inde... |
Your task is to output a Magical 8 Trapezium:
1 × 8 + 1 = 9
12 × 8 + 2 = 98
123 × 8 + 3 = 987
1234 × 8 + 4 = 9876
12345 × 8 + 5 = 98765
123456 × 8 + 6 = 987654
1234567 × 8 + 7 = 9876543
12345678 × 8 + 8 = 98765432
123456789 × 8 + 9 = 987654321
Output in your chosen language in the ... |
The code lock for my garage has 5 buttons, labeled "1 2", "3 4", "5 6", "7 8", and "9 0". To open the garage door, you have to enter the correct 4-digit PIN.
As you can see, every button represents two numbers. Thus some PINs, like "1357" and "2367", are essentially identical because they require the same sequence of b... |
The challenge is to detect missing integer sequences of files or directories. You have a directory filled with files/directories that are named as integers.
The files/directories are generated from multiple threads yet the job did not complete - there are therefore gaps in the sequence.
The input is two integers a sta... |
Task
Your task is to convert strings like this:
abc^d+ef^g + hijk^l - M^NO^P (Ag^+)
To strings like this:
d g l N P +
abc +ef + hijk - M O (Ag )
Which is an approximation to abcd+efg + hijkl - MNOP (Ag+)
In words, raise the characters directly next to carets to the upper line, one character for on... |
Definition
The chain rule with two functions state that:
D[f(g(x))] = f'(g(x)) * g'(x)
Or, alternatively:
D[f1(f2(x))] = f1'(f2(x)) * f2'(x)
The chain rule with three functions state that:
D[f(g(h(x)))] = f'(g(h(x))) * g'(h(x)) * h'(x)
Or, alternatively:
D[f1(f2(f3(x)))] = f1'(f2(f3(x))) * f2'(f3(x)) * f3'(x)
Et ce... |
Usually, it is said that "Doing X without Y" can be a trap to beginners writing challenges (source). However, I am cocky and think that I can definitely make an X without any Ys. Randomly. Oh yes, this will be good.
Challenge: Given an odd integer n greater than or equal to 1, output an ex of side length n made of rand... |
Given an input of an integer \$n ≥ 2\$, output a list of its divisors sorted by the
exponents in their prime factorizations, in ascending order, ordering first by
the largest prime, then by the second largest, and so on.
As an example, take the integer \$72\$, which is \$2^3\cdot3^2\$. It has
the divisors
1 3^0 · 2... |
Input:
A Date (containing dd, MM and yyyy). A date-object, or three separate integers are also valid as input.
Output:
Each part (dd, MM and yyyy) individually reverted and than rounded to the nearest valid date.
For example (in the format dd-MM-yyyy):
21-10-2016 becomes 12-01-6102
Challenge rules:
Only dd, MM, yyyy i... |
From Wikipedia:
The number e is an important mathematical constant that is the base of the natural logarithm. It is approximately equal to 2.71828, and is the limit of (1 + 1/n)n as n approaches infinity.
Challenge
Calculate the number e to 15 digits after the decimal point.
This means that your output must start wi... |
If you don't know what the Tower of Hanoi is, I'll explain it briefly: There are three rods and some discs each of which has a different size. In the beginning all discs are on the first tower, in sorted order: The biggest one is at the bottom, the smallest at the top. The goal is to bring all the discs over to the thi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.