instruction stringlengths 34 53.1k |
|---|
Challenge
Given a number x and a precision e, find the lowest positive integer q such that x can be approximated as a fraction p / q within precision e.
In other words, find the lowest positive integer q such that there exists an integer p such that abs(x - p/q) < e.
Input
The pair (x, e) where x is a floating-point n... |
In this game of cops and robbers, each cop will make a vault: a program that stores a secret, and requires a key to unlock. The robbers should find a way to get the vault to reveal its secret without knowing the key.
Cop rules
Cops will write two short segments of code:
A vault, which takes a key and secret, then allo... |
This is the robbers' thread. The cops' thread is located here.
Robber rules
Should work for all keys and secrets
Should require the same number or fewer guesses as the cop's fault, to prevent brute forcing
Does not need to be the same as the cop's intended fault
Multiple cracks may be made for the same cop, as long as... |
Input a String and surround it with a rounded rectangle of alternating "friendliness pellets".(0)
Sandbox
Idea originally from Lyxal.
Challenge
Given a single line non-empty String of length \$<100\$, print the string with a rounded rectangle of alternating pellets(0) around it.
The rectangle must be 11 lines in heigh... |
Banknotes in many countries come in denominations of 1,2,5,10,20,50,100,200,500,1000, etc. That is, one of \$ \{ 1,2,5\} \$ times a power of \$10\$. This is OEIS A051109, except we'll extend the sequence to bigger values.
Given a positive integer as the input, the program should output the largest bank note that is les... |
A mortality table or life table is an actuarial tool that gives the probability that a person aged \$A\$ years will die in the next year, and is used to help calculate the premiums for life insurance, among other things. One of the first people to compile a life table was Edmond Halley, of cometary fame. These probabi... |
Consider a word/string of length \$n\$, only including the letters A-Z, a-z. A word/string is a double prime word if and only if n is prime and the sum of the letters, s, is also prime, using their numeric position in the alphabet (a=1, B=2, c=3, etc.).
Input can be any combination of upper or lower case alphabetic cha... |
Introduction
Arrays are usually used with for-loops or iterators. One different task might be the use as a cheap way to rotate through a set of items, so after reaching the last index, the next item would be the first item of the array. This is useful for cases like menus and physical controls.
Challenge
Given the size... |
Background
A staircase polyomino is a polyomino made of unit squares whose shape resembles a staircase. More formally, a staircase polyomino of size \$n\$ is defined as follows:
A staircase polyomino of size 1 is a single unit square.
A staircase polyomino of size \$n\$ is the same as that of size \$n-1\$ with a horiz... |
Summary
We already have a challenge for the minimal number of characters for Turing completeness. But what about the minimal maximum byte?
Challenge
For a language of your choice, find a subset of characters that allows your language to be Turing complete with the minimal maximum byte value.
Example
If your language is... |
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... |
Challenge
Given daily arrival and departure times of every train that reaches a railway station, find the minimum number of platforms required for the railway station so that no train waits.
In other words, find the maximal number of trains simultaneously present in the station.
Input
a pair of lists of times: arrival... |
A drug comes in 5mg, 2.5mg, and 1mg sized pills. The drug is taken once a day. The total daily dose will be only one of the following (all in mg):
1, 2, 3, ... 20, 22.5, 25, 27.5, 30, 32.5, 35, 37.5, 40, 42.5, 45, 47.5, 50
In words: any whole number less or equal to 20, then at 2.5mg increments up to 50.
Your task is t... |
Given a rectangle, a start point, and an end point, find any path from start to finish that avoids the rectangle.
Example
Suppose you were at \$(1.5, -1.5)\$ and you needed to get to \$(2, 4)\$. However, there is a rectangle with upper left corner \$(1, 3)\$ and bottom right corner \$(4, 1)\$ in your way. It would look... |
Not to be confused with Is my OS 32-bit or 64-bit.
This one is very simple, tell me whether or not my CPU supports 64-bit instructions. If my CPU supports 32-bit instructions, print '32', if my CPU supports 64 bit instructions, print '64', if my processor naitively supports other lengths of instructions, print 'other'.... |
You are a medieval overlord tasked with designing a road network between three kingdoms placed on a \$9 \times 9\$ grid. A sample placement of kingdoms might look like this:
Non-commercial use of tileset by douteigami. Thanks!
The kingdoms make the following three demands:
The road network must be connected: for any ... |
Let us take a break from the brain-wrecking questions and answer some of the simpler ones
You have recently read something extremely funny, and want to express your laughter to the world! But how can you?
Task
You have to display the string:
Lololololololololololololololololololololololololololololololololololololololo... |
Starting an the origin on an infinite grid, you follow a predetermined path going up (U), down (D), left (L), or right (R). You paint every square you visit, including the square you started at and the square you finish at. Using this method, we can paint the number six using the instructions RRDDLLUUUURR:
The origin ... |
A positive integer \$x\$ is an \$n\$-perfect number if \$\sigma(x) = nx\$, where \$\sigma(x)\$ is the divisor sum function. For example, \$120\$ is a \$3\$-perfect number because its divisors sum to \$360\$:
$$360 = 3\times120 = 1+2+3+4+5+6+8+10+12+15+20+24+30+40+60+120$$
and
$$926073336514623897600 = 6\times1543455560... |
Background
Tetris is a single-player game played on a rectangular grid with tetromino pieces.
When you fill one or more lines with tetrominoes, the filled lines are removed, and all blocks above them move down accordingly. In the following diagrams, . is an empty space, # is an existing block, and the tetromino marked ... |
Your program is supposed to create a full red screen in MSDOS. The source of the binary (.com file) must be 5 bytes or less. No wild assumptions, the binary must work in MsDos, DosBox, and FreeDos alike. For winning, you have to post x86 assembler code which can be assembled with NASM (FASM) or directly the hex code of... |
A little while back, data was frequently stored on punched card. A typical card would have 80 columns of 12 possible 'punch' positions. A plethora of encodings was used, each for their own specific purpose.
These days we like to think of a byte as 8 bits. In this challenge, you're tasked to convert an 8-bit byte to a 1... |
Backstory
You own a tiny jewellery shop in the suburbs of the city. The suburbs are too much overpopulated, so your shop has a thickness of only one character to fit in the busy streets.
Recently, there has been lots of cases of robbery on the neighborhood, and you fear that robbers will also come to get your bounty.
T... |
Check if two blocks of bits dovetail perfectly.
Specifications
A block of bits is a fixed sequence of 8 bits just like this for example : 11110101.
For simplicity we refer to truthy/falsey values as 1/0 bits but they can be everything capable of representing those two states in a clear, well defined and consistent wa... |
The random Fibonacci sequence is defined as follows:
$$
f_n =
\begin{cases}
f_{n-1}+f_{n-2} \text{ with probability } 1/2 \\
f_{n-1}-f_{n-2} \text{ with probability } 1/2 \\
\end{cases}
$$
$$
f_1 = f_2 = 1
$$
i.e. whether the next term is the sum or difference of the previous two is chosen at random, independently of ... |
It's one of these again :D
Your task, if you wish to accept it, is to write a program/function (without any uppercase letters) that outputs/returns its string input/argument. The tricky part is that if I convert your source code to uppercase, the output must be reversed.
For simplicity, you can assume that the input is... |
Inspired by this OEIS entry.
Background
A saturated domino covering is a placement of dominoes over an area such that
the dominoes are completely inside the area,
the dominoes entirely cover the given area,
the dominoes may overlap, and
removal of any domino reveals an uncovered cell (thus failing to satisfy condition... |
Background
We've studied at least five different types of numbers based on the IDs of different users on this site. Why not study another?
My user ID is \$91030_{10}\$. Its binary representation is \$10110001110010110_2\$, a representation which has an interesting property of its own:
One option for the longest palind... |
Who's up for a second attempt?
If you've ever listened to the radio program "I'm sorry, I haven't a clue", then you've probably heard of the game called "Mornington Crescent". For those who haven't, it's a game where players name random stations on the London Underground network. The first person to name "Mornington Cr... |
The coefficients of a perfect square polynomial can be calculated by the formula \$(ax)^2 + 2abx + b^2\$, where both a and b are integers. The objective of this challenge is to create a program that not only can find if an input trinomial is a perfect square, but also find its square root binomial. The input trinomial ... |
I tested the waters on this sort of question with python, but now I get to the real question I want to ask.
restricted-source challenges are uniquely rewarding in Haskell because of Haskell's strict rule set. Type coercion which is the bread and butter for other languages in these sort of challenges is arguably non-ex... |
The purpose of this challenge is to figure out whether all the dominoes will fall, given an input string representing a top view of the table.
Input format
The program can take the input as a single string with newlines or a list of strings. Spaces denote, well, empty spaces, and the rest represent dominoes.
The start ... |
Inspired by Find the largest fragile prime.
By removing at least 1 digit from a positive integer, we can get a different non-negative integer. Note that this is different to the Remove function in the linked question. We say a prime number is delicate if all integers generated this way are not prime. For example, \$606... |
You must write a program that takes an encrypted string and decrypt it according to specific rules and then print it out. Decryption will occur by performing two operations.
Sample Input Argument 1 (the encrypted string)
HGJILKBADCFE
Operation 1:
Swap the first half of the string with the second half, which should lea... |
A port of my other question: Double Prime Words
Consider a word/string of n alphanumeric characters with sum of the characters, s, using their numeric position in the alphabet (a=1, B=2, c=3, etc.) or numeric value (0,1, 2, 3 - 9). Numeric characters should be taken at individual value. (66 is two 6 characters for a su... |
In this challenge, the goal is to find the values of some variables after a number of assignments are done. An example input:
a = 5
b = 4
c = a = b
a = 2
b = a
This would result in:
a = 2
b = 2
c = 4
Each statement will be one of the following:
A variable name ([a-z_]+)
A numeric value ([0-9]+)
An assignment operati... |
Intro
Given radius \$r\$, draw a circle in the center of the screen.
Sandbox.
The Challenge
Here is a simple challenge.
Plot a circle using the formula \$x^2+y^2=r^2\$, or any other formula that will plot a circle according to the given parameters.
You may use any units that your language provides, so long as they are ... |
Create a function which takes in a input integer and then returns the number of factors it has, like if you pass 25 then it will return 3 since it has 3 factors i.e. 1,5,25.
Challenge:
Make the fastest and the smallest code!
|
At time of writing, my reputation is \$16,256\$. As I noted in chat,
Oh cool my rep is the concatenation of two powers of 2: 16,256
Or even the concatenation of a power of 2 and its square, which is much more interesting
which then spawned a CMC about checking if a number has this property.
Given an integer \$n > 0\... |
You place a standard die at the origin of a 2D grid that stretches infinitely in every direction. You place the die such that the 1 is facing upwards, the 2 is facing in the negative y direction, and the 3 is facing in the positive x direction, as shown in the figure below:
You then proceed to execute a series of move... |
Background
There is an interesting question on MathSE about some conjectures that are disproven by extremely large counter-examples. This delightful answer tells the story of a sequence of numbers called Gijswijt's sequence, which is now registered as A090822. The sequence is defined as follows
Let \$a_1 = 1\$ and for... |
The International Phonetic Alphabet is a system of phonetic notation intended to be able to accurately represent every sound used in spoken language.
The alphabet contains 29 vowel letters iyɨʉɯuɪʏʊeøɘɵɤoəɛœɜɞʌɔæɐaɶäɑɒ and 81 consonant letters, although I missed three (ɦǀǂ) when I first posted this challenge, so you on... |
Rest in peace, John Horton Conway
There are a ton of different Game of Life interpreters out there! A ton!
Currently for you, getting an interpreter is just a dozen types and a couple of clicks away.
But wait, do you notice a common thing in the interpreters? Every interpreter is graphical, i.e there are only images an... |
The Xerox Alto, originally released in 1973, was the first computer to feature the now-familiar angled mouse pointer. The Alto's bitmapped pointer looked like this (redrawn from Fig. 2 here):
Your task in this code-golf challenge is to write a program/function that generates an ASCII art representation of the mouse po... |
I guess you could call this the next challenge in the "Irreducible series".
Hello World
Challenge
Create a cat subject to the constraint that it is irreducible.
A cat program C is considered irreducible if there does not exist a cat (in the same programming language as C) that can be constructed by removing character... |
Introduction
Logic gates! Everyone knows them, everyone loves them (unless you're starting to learn them). Take two booleans, compare them, get a single boolean in return. AND, NAND, OR, NOR, XOR, XNOR. Fun! But, what if you only had the inputs and output, but not the operator?
Challenge
Given a three digit number, xy... |
Challenge
Unlike the circumference of a circle (which is as simple as \$2\pi r\$), the circumference (arc length) of an ellipse is hard.
Given the semi-major axis \$a\$ and semi-minor axis \$b\$ of an ellipse (see the image below, from Wikipedia), calculate its circumference.
By definition, you can assume \$0 < b \le a... |
Deserializing binary trees depth-first is pretty easy, but doing it breadth-first is (hopefully) harder. Your mission, should you choose to accept it, is to do the latter.
The input will be a 1-D list of positive integers representing node values and some other consistent value representing the absence of a child (I'll... |
Introduction
Just on Hacker news, John Resig contemplates
transforming a query “foo=1&foo=2&foo=3&blah=a&blah=b” into one that looks like this: “foo=1,2,3&blah=a,b", https://johnresig.com/blog/search-and-dont-replace/.
He claims "being 10 lines shorter than Mark’s solution".
Query strings consist of sequences of name-v... |
OG post
Task
In this challenge, you will be given an string emoticon, and your task will be to output its happiness.
How?
An emoticon will always have eyes and mouth. It can also include eyebrows and nose. Each part will influence the overall happiness rating, which is the sum of happiness ratings of all parts. Emotic... |
As the title says, you are to create a pristine program in as many languages as possible. A pristine program, taken from here, is:
Let's define a pristine program as a program that does not have any errors itself but will error if you modify it by removing any contiguous substring of \$N\$ characters, where \$1 \le N ... |
Let's start by defining a Two Bit Number™:
It is a positive integer
When expressed as a binary string it has exactly 2 true bits OR
When expressed as a decimal number, it has exactly 2 of the numeral one, and all other numerals are zero.
Or as a sentence
A Two Bit Number™ is a number which contains exactly 2 of the n... |
Introduction:
You're a key maker, and want to access something from a safe that has a lock. Unfortunately, the key to that lock is lost, so you'll have to make a new one. You have access to a bunch of blank keys, to which you can add notches to turn it into actual keys. You also have loads of keys with notches already ... |
Executive summary:
Print NxN matrices \$A\$ and \$B\$ where \$ AB = 10A + B \$. Largest N wins!
Details:
Entrants in this challenge should choose an N. Submit a program that takes an input integer 'seed', and produces two full rank NxN matrices \$A\$ and \$B\$, where each element of \$A\$ and \$B\$ is an integer from ... |
Objective
Mimic Haskell's reads :: ReadS ().
Or in other words, parse nested parentheses. Since the target type is () (the type with one possible value), "parsing" means discarding a leading nested parentheses.
Valid Input
"Nested parentheses" means (), (()), ((())), and so on. That is, leading nonzero (s and trailing ... |
Find what is the distance for a given string to its closest palindrome of the same length.
For this task I decided to give the characters further away from the string's center more weight (think of it as contributing more torque), proportional to their distance to the center.
Let's define the palindrome distance for a ... |
Introduction
Ah, INTERCAL...
As much as I'd like encourage everyone to Try it Online, text output is just painful.
According to the docs it uses the "Turing Text Model".
While an... interesting concept, using it is about as much fun as shooting yourself in the foot.
And what do we do with a task like this? Automate it.... |
Leonhard Euler wants to visit a few friends who live in houses 2, 3, ..., N (he lives in house 1). However, because of how his city is laid out, none of the paths between any houses form a loop (so, the houses exist on a graph which is a tree).
He gets bored easily but if he visits his friends in a different order, he ... |
Intro
Given a whole number \$< 100,\$ extend/shorten the english representation of the number to have as many characters as it's value.
Sandbox
Rules
Take the number \$n\$, and get it in words from this dictionary. You may take this dictionary in any way you prefer. (a list, read from link, command line arg, STDIN, va... |
Scala isn't a very commonly used language around here. Most of those who know it like it[citation needed], but some go :\ when they encounter its user-defined operators, saying they're too complicated.
However, they're governed by a very simple set of rules, outlined here. Their precedence depends on the first characte... |
Background
Mastermind is a game of code-breaking for two players. One of the players is codemaker (Alice) and the other is codebreaker (Bob).
4x4 means that the player should guess the length-4 sequence made of four alphabets (say RGBY). The hidden sequence may have duplicate letters, so there are \$4^4 = 256\$ possibi... |
In this cops-and-robbers challenge, robbers must crack cop answers by finding out which languages the cops used.
This is the Cops thread. For the Robbers' challenge, see here
Cops, you are to write a program, which, when executed in a specific language, does one of the following:
Outputs one of the 5 phrases below
Out... |
This is the Robbers thread. For the Cops challenge, see here
As the robbers, your job is to crack the cops' answers. Choose an uncracked, unsafe cop answer and attempt to figure out which languages, in which order, the cop used.
Note that a crack is valid even if the languages are different. So long as the the language... |
Background
Sometimes when I'm golfing a program, I'm presented with the following situation: I have an integer value \$x\$ on some fixed interval \$[a, b]\$, and I'd like to test whether it's in some fixed subset \$S \subset [a, b]\$ with as few bytes as possible.
One trick that sometimes works in a language where nonz... |
Today Neil Sloane of the OEIS sent out an email asking for a confirmation of the current terms, and computation of some larger terms of the latest OEIS sequence A337663 with the keyword "nice".
Here's how this sequence works:
You label \$n\$ cells on the infinite square grid with \$1\$s, and then
place the numbers \$2... |
Given three distinct numbers from \$1\$ to \$7\$, output three other distinct numbers from \$1\$ to \$7\$, that is having no numbers in common with the original numbers. Your code must produce a different output set for each possible input set. That is, no two inputs can produce the same output, treating both as unorde... |
In this challenge, the goal is to create a pristine truth machine in as few bytes as possible. For reference, a truth machine does the following:
Takes input, which is always 0 or 1
If the input is 0, it is printed and the program terminates
If the input is 1, it is printed forever
A pristine program is one that does... |
Write a formula using only the digits 0-9, +, *, -, /, % and ^ to output a 1000 distinct primes when given input (which can be used as a variable n in the formula) of numbers 1 to 1000. (Note that / will give the quotient as all arithmetic is integer arithmetic.) Solutions can use ( and ) freely and they will not be co... |
Write a program which will eventually, given enough time, print all possible permutations of ASCII characters (both printable and non-printable) less than or equal to its length, except itself. The text of the program must not appear anywhere in its output.
For example, if your program is abc, then part of your output ... |
Inspired by and drawns from Is this number Loeschian?
A positive integer \$k\$ is a Loeschian number if
\$k\$ can be expressed as \$i^2 + j^2 + i\times j\$ for \$i\$, \$j\$ integers.
For example, the first positive Loeschian numbers are: \$1\$ (\$i=1, j=0\$); \$3\$ (\$i=j=1\$); \$4\$ (\$i=2, j=0\$); \$7\$ (\$i=2, j=... |
About geohash
Geohash is one of many encoding systems for geographic positions. Geohash positions have some advantages. It provides a short code instead of the two usual numbers for latitude and longitude.
The challenge
Given two numbers, the latitude and longitude, compute and return or print the geohash string of le... |
What?
Many programming languages, both practical and esoteric, have functions, methods, etc to convert a given string to a decimal number. This is how the process might work:
For each character in the given string.
Take the character's ASCII value and subtract it by 48.
Multiply the output value by 10. (The output at... |
This is an answer-chaining challenge where every part of your answer should aim to be unique from every other answer.
This question will work in the following way:
I will post the first answer. The next answer will stem from that, and all other answers will originate from it.
In this answer I will include a program an... |
The task
In this challenge, you are given a number and a list.
Your task is to remove from the list all occurrences of the given number except the first (leftmost) one, and output the resulting list.
The other elements of the list should be left intact.
The number will be a positive integer below 1000, and the list wi... |
Figuring out whether a given number is prime, while not very complicated, is kind of hard. But making a guess doesn't need to be.
Seeing whether a number is a multiple of 2 or 5 is easy - you can just look at the last digit. Multiples of 3 isn't much harder, just add up the digits and see if you end up with a multiple ... |
Objective
Given an ASCII string, decide whether it is a valid C integer literal.
C integer literal
A C integer literal consists of:
One of:
0 followed by zero or more octal digits (0–7)
A nonzero decimal digit followed by zero or more decimal digits (0–9)
0X or 0x, followed by one or more hexadecimal digits (0–9, A... |
Output all 95 bytes from 0x20 to 0x7E inclusive (printable ASCII including space), in any order, each at least once. The source code of your program must use all of those bytes, each at least once.
Your program must be irreducible (meaning you cannot strictly remove some characters from the program and then have it st... |
The goal of this challenge is to take a positive integer n and output (in lexicographic order) all sequences \$S = [a_1, a_2, ..., a_t]\$ of distinct positive integers such that \$\max(S) = n\$.
For example, for an input n = 3 your program should output the following eleven sequences in the following order:
[
[1, 2, ... |
Here is an easy-intermediate challenge for anyone interested!
What is that?
A thing me and brother do a bit too often is this:
One of us has a problem and asks the other to explain how to do certain stuff. The other just says the following carelessly:
How to <verb> in <n> easy steps!
... |
Write a program that takes a string as an input. For the input:
If the input doesn't match the source code, the program shall output the input intact. (Hence a cat)
Otherwise, the program shall fall in an infinite loop. (So actually not a cat)
|
Intro
Find the result of number cannibalism.
Why was 6 scared of 7? Becase 7 8 9.
Your program will have to find the result of applying the 8 operation(defined below) on a number, repeatedly.
Related, Sandbox
Challenge
Your input will be a single positive integer, n.
You need to find each 8 in the integer, and substitu... |
This challenge will have give you a positive integer \$n\$ and ask you to output \$t(n)\$, the number of triangles (up to congruence) satisfying the three conditions:
The triangles have perimeter of 1,
the triangles have side lengths \$\displaystyle\frac{a_1}{b_1}, \frac{a_2}{b_2}\$, and \$\displaystyle\frac{a_3}{b_3}... |
Context
Consider the following sequence of integers:
$$2, 10, 12, 16, 17, 18, 19, ...$$
Can you guess the next term? Well, it is \$200\$. What about the next? It is \$201\$... In case it hasn't become obvious to you, this is the sequence of positive integers whose name starts with a letter D in Portuguese.
Task
Given a... |
Martin Ender's 2D programming language Alice has two different modes depending on what orientation the IP has: orthogonal (Cardinal mode) or diagonal (Ordinal mode). Commands in Alice change their meaning depending on which mode the program is in when they're executed. One especially interesting implementation of this ... |
This code-golf challenge will give you two positive integers n and k as inputs and have you count the number of rectangles with integer coordinates that can be drawn with vertices touching all four sides of the \$n \times k\$ rectangle $$
\{(x,y) : 0 \leq x \leq n, 0 \leq y \leq k\}.
$$
That is, there should be:
at le... |
You know those riddles where every letter is swapped for another letter?
E.g. you get a text like
JME JG EPP IFAPE EPJE CJPPPC BP,
UIJCG JC EPP EFE GPJB EJIP EJ EJIP,
F EPJIG MPJEPPPP AJUC BJL UP
GJP BL MICJIJMPPJUIP CJMI.
and are supposed to find out that it stands for
OUT OF THE NIGHT THAT COVERS ME,
... |
Imagine you place a knight chess piece on a phone dial pad. This chess piece moves from keys to keys in an uppercase "L" shape: two steps horizontally followed by one vertically, or one step horizontally then two vertically:
+-+
|1| 2 3
+-+
`-------v
| +-+
4 | 5 |6|
| +-+
|
... |
One reason why ISO8601 is the best date string format, is that you can simply append as much precision as you like. Given 2 integers representing seconds and nanoseconds that have passed since 1970-01-01T00:00:00, return an ISO8601 string as described below.
Output:
The standard output format without timezone looks lik... |
This code-golf challenge will give you an integer n, and ask you to count the number of positive integer sequences \$S = (a_1, a_2, \dots, a_t)\$ such that
\$a_1 + a_2 + \cdots + a_t = n\$, and
\$\displaystyle
\sqrt{a_1+\sqrt{a_2 + \cdots + \stackrel{\vdots}{\sqrt{a_t}}}}
\$ is an integer.
Example
If n = 14, then the... |
We can read 13576870234289 digit-by-digit in English, and it makes a haiku:
one three five seven
six eight seven zero two
three four two eight nine
We say it's a "digit haiku", because when read out like this, it's 5+7+5 syllables long, and no word is broken across a line.
For example, 111171111101111 is not a digit ... |
Context
In APL, trains are tacit sequences of monadic/dyadic functions that can be called with one or two arguments. We'll code something to check if a given train follows the correct structure we need in order to have a sound train.
Task
Given the sequence of function arities in the train, determine if the train is va... |
Somehow, we don't yet have a challenge for finding the inverse of an arbitrarily-sized square matrix, despite having ones for 3x3 and 4x4, as well as a more complex version.
Your task is, given a square \$n\times n\$ non-singular matrix \$M\$, output the matrix \$M^{-1}\$ that satisfies
$$MM^{-1} = I_n$$
There are a nu... |
Inspired by this challenge, which got closed. This is meant to be an easier, but no less interesting version of that.
This is the cops thread of a cops-and-robbers challenge. For the robbers thread, see here.
Cops will provide a program/function and a flag. Robbers will try to guess a password such that, when the passw... |
Inspired by this challenge, which got closed. This is meant to be an easier, but no less interesting version of that.
This is the robbers thread of a cops-and-robbers challenge. For the cops thread, see here.
Cops will provide a program/function and a flag. Robbers will guess a password. When the password is given to t... |
Inspired in part by this
Mathologer video on gorgeous visual "shrink" proofs, and my general interest in the topic, this challenge will have you count regular polygons with integer coordinates in 3D.
You'll be provided an input n, which is a non-negative integer. Your program should find the number of subsets of \$\{0,... |
Introduction
We have 22 Collatz conjecture-related challenges as of October 2020, but none of which cares about the restrictions on counter-examples, if any exists, to the conjecture.
Considering a variant of the operation defined in the conjecture:
$$f(x)=
\cases{
\frac{x}{2}&for even x \cr
\frac{3x+1}{2}&for odd x
}... |
Background
The systematic chemical symbol is defined as such for \$ 118 < n < 1000 \$:
The first letter corresponds to the first digit, capitalized.
The second letter corresponds to the second digit.
The third letter corresponds to the third digit.
This can be generalized for all \$ n > 0\$:
For each digit, get the ... |
Note: SmokeDetector is a bot that detects spam and offensive posts on the network and posts alerts to chat.
What to implement
Smokey's !!/alive command uniformly at random picks one of these messages:
Yup
You doubt me?
Of course
... did I miss something?
plz send teh coffee
Watching this endless list of new question... |
The task is to find the smallest paper size on which it is possible to print a picture of the dimensions given in milimetres. The image will be printed without margins.
Input:
Two integers (bigger than zero) and a letter a, b, or c, for example:
290
200
A
Output:
Paper size, for example:
A4
Another examples:
218,297... |
Like the previous SmokeDetector challenge? This one is for you too ;)
Note: SmokeDetector is a bot that detects spam and offensive posts on the network and posts alerts to chat.
What to implement
Smokey's !!/coffee command uniformly at random picks one of these words (sorts of coffee):
Espresso
Macchiato
Ristretto
A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.