instruction stringlengths 34 53.1k |
|---|
You are given a string of terrain, with molehills and mountains:
/\
/ \
_/\__ / \
___/ \_/ \_
____/\___/ \___
Your job is to replace every molehill in the string with an equivalent mountain centered in the same col... |
This is the Cops' thread. Robbers' thread is here.
Background
Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("adjacent" means horizontally, vertically or diagonally adjacent.) A... |
This is the Robbers' thread. Cops' thread is here.
Background
Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("adjacent" means horizontally, vertically or diagonally adjacent.) A... |
Supreme Sum String
Given an input string, return the word with the highest sum of each of its unicode characters.
Rules
The input should be seperated by whitespace
The value of each word is based on the sum of each character in the word's UTF-16 code
The output should be the first word with the highest value (in case... |
Inspired by this Stack Overflow question.
The challenge
Input
An array of square matrices containing non-negative integers.
Output
A square matrix built from the input matrices as follows.
Let \$N \times N\$ be the size of each input matrix, and \$P\$ the number of input matrices.
For clarity, consider the following ex... |
Intro
A friend posed this question today in a slightly different way - "Can a single [Python] command determine the largest of some integers AND that they aren't equal?".
While we didn't find a way to do this within reasonable definitions of "a single command", I thought it might be a fun problem to golf.
Challenge
"R... |
Make a program that simulates the basic logic gates.
Input: An all-caps word followed by 2 1 digit binary numbers, separated by spaces, such as OR 1 0. The gates OR, AND, NOR, NAND, XOR, and XNOR are needed.
Output: What the output of the entered logic gate would be given the two numbers: either 1 or 0.
Examples:
AND ... |
Determine the length of a UTF-8 byte sequence given its first byte. The following table shows which ranges map to each possible length:
Range Length
--------- ------
0x00-0x7F 1
0xC2-0xDF 2
0xE0-0xEF 3
0xF0-0xF4 4
Notes on gaps in the table: 0x80-0xBF are continuation bytes, 0xC0-0xC1 would start an ... |
If you have ever had any exposure to Japanese or East Asian culture you will have surely encountered the Amidakuji game:
As Wikipedia explains, it is a type of lottery drawn on paper and used to randomly select a permutation of N items.
For example, it may be used to randomly assign a starting sequence to N people, o... |
Let us define the "multiplicative deltas" of values \$[\; a_0, \cdots a_N, \;]\$ as:
$$
[\; a_1 / a_0, \cdots, a_{i+1} / a_i, \cdots, a_N / a_{N-1} \;]
$$
The reverse operation - namely "multiplicative undelta" - returns values such that the above operation results in the given values.
Example
Given values \$[\; 1, 5, ... |
Your task is to create the given target string. Starting with an string that is empty, you will have to add characters to it, until your string is the same as the one we want. You can either add a character to the end of you string with cost x, or you can clone you string with cost y. What we want is the cheapest way t... |
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... |
Chinese Hearts, also known as Gong Zhu (拱猪, Chase the Pig), is a variance of the Hearts game. It is a 4 player card game with the aim to earn the highest amount of points. You may read more about it on Wikipedia. This time, we want implement a program (full or function) to calculate ones score.
Scoring
The player who p... |
Given a list of positive integers, write code that finds the length of longest contiguous sub-list that is increasing (not strictly). That is the longest sublist such that each element is greater than or equal to the last.
For example if the input was:
\$[1,1,2,1,1,4,5,3,2,1,1]\$
The longest increasing sub-list would ... |
About Zeckendorf Representations/Base Fibonacci Numbers
This is a number system which uses Fibonacci numbers as its base. The numbers consist of 0 and 1's and each 1 means that the number contains the corresponding Fibonacci number, and 0 means it does not.
For example, let's convert all natural numbers <=10 to base Fi... |
You are given a list, L, with the length N. L contains N random positive integer values. You are only able to select from the outer edges of the list (left/right), and after each selection every value in the remaining list increase by a factor of the current selection. The goal is to maximize the total sum of the selec... |
Sometimes when you're lying in bed and reading a message, your phone screen will pop into landscape mode right in the middle of a sentence. Only being able to read left to right, you find yourself incapacitated, unable to process the text in front of you.
To ensure that this won't happen again, you decide to make every... |
Input:
An integer n in the range 2 <= n <= 10
A list of positive integers
Output:
Convert the integers to their binary representation (without any leading zeroes), and join them all together.
Then determine all binary substrings that form a 'binary fence' using n amount of fence posts. The spaces (zeros) between each... |
In Java/.NET/C/JavaScript/etc. you can use ternary-ifs to shorten if-statements.
For example (in Java):
// there is a String `s` and an int `i`
if(i<0)s="Neg";else if(i>0)s="Pos";else s="Neut";
Can be shortened with a ternary-if to:
s=i<0?"Neg":i>0?"Pos":"Neut";
Challenge:
Input: A regular if-else (possible with nes... |
The Challenge
The goal of this challenge is to determine whether a given String can be typed using only one line of a standard UK QWERTY keyboard.
This is code golf, so shortest solution in bytes wins!
IO
Input will be a single String of zero or more characters in the ASCII decimal range of 32-126 inclusive.
You may ... |
Introduction
Large meetings waste working time. Our aim is to split a large meeting into a number of smaller meetings, so the average number topics that a person discusses is minimized but every person has to be in every meeting they are interested in.
Input
Given is a function from a set of topics \$T\$ to a set of pe... |
Given a list of activities and their start time/date, output an ASCII-art calendar showing the activities on the appropriate days. All activities are guaranteed to be in the same month, no two activities will be on the same day, and all activities are guaranteed to fit within the calendar box.
The calendar has the date... |
Consider you have a hash function \$\mathcal{H}\$ which takes strings of length \$2n\$ and returns strings of length \$n\$ and has the nice property that it is collision resistant, i.e. it is hard to find two different strings \$s \neq s'\$ with the same hash \$\mathcal{H}(s) = \mathcal{H}(s')\$.
You would now like to ... |
Yesterday while playing with my kid I noticed the number in his toy train:
So we have $$4281$$ that can be split into $$4-2-8-1$$ or $$2^2-2^1-2^3-2^0$$
So simple challenge: given a non-negative number as input, return consistent truthy and falsey values that represent whether or not the string representation of the n... |
This question was inspired by Tom Scott's video here.
The English language has plenty of words, but what's the longest one that can be displayed on a seven segment display? Your challenge is given a list of letters that may not be displayed, display the longest English word in a 7 segment display format?
Input
Input w... |
Introduction:
Unfortunately an Accordion Solitaire Solver challenge already exists (Solve a game of Accordion), so instead this easier related challenge.
Let's start by explaining how Accordion Solitaire works:
You start with all 52 cards (or 53 if you add a Joker) in one big row.
You pile up cards from right to left ... |
From this stackoverflow question
Given a 2D array of size \$ M \times N \$, output the values in a anti-clockwise fashion. The output must start from the outside to the inside and the initial point always is going to be \$(0,0)\$.
Example Given:
$$ \begin{bmatrix} \color{blue}1&\color{red}2&\color{red}3&\color{red}4 \\... |
As you most probably now, there are 2339 solutions to pentomino puzzle in a 6x10 grid. There are different labeling schemes for the 12 pentominoes, two of them are shown on the image below:
Image credit: Wikipedia
For the purposes of the current task we will say that a normalized pentomino solution is a solution that ... |
Input
A string s of printable ASCII characters, newlines, and spaces (0x20 ( ) to 0x7E (~)), and a non-negative integer n.
Challenge
To write a program that outputs either another program, or s depending on n. If n = 1, Then your code should output code which outputs s. If n = 2, Your code should output code which outp... |
Two dimensional chiral objects are not chiral in three dimensional space. This is because you can flip them over which is equivalent to taking the mirror image unlike in two dimensions where only rotations in the plane of the object are allowed which cannot reproduce the effect of a mirror operation. In this challenge,... |
While I was writing numbers I noticed after a while that my keyboard had the Shift key pressed and blocked and all I wrote was $%&-like characters. And even worse, I had been switching between the English and Spanish keyboard layouts so I don't know which one I used for each number.
Challenge
Given a string containing ... |
Background
Tatamibari is a logic puzzle designed by Nikoli.
A Tatamibari puzzle is played on a rectangular grid with three different kinds of symbols in it: +, -. and |. The solver must partition the grid into rectangular or square regions according to the following rules:
Every partition must contain exactly one symb... |
With the given text below, there are some words in the text that repeats several times in the text. Use any programming language to write a short code that compresses the text to display it. Or in other words, use the smallest number of bytes to display the text.
The Text is:
Peter Piper picked a peck of pickled peppe... |
(language-specific challenge)
Specification:
Language: ECMAScript, any version[1]
Challenge: Somewhat like python's itertools.groupBy: Your function Array.group(f) should take as input an "equivalence function" f whose output defines our notion of an "equivalence key" for array elements (like a sort key). The return va... |
Idea:
Consider a 2-bit bitmap of arbitrary side-lengths overlaid on a coordinate grid and imaged with random data (1's represent an element of the image, 0's represent the "blank" canvas background):
y x—0 2 4 6 8 10 14 18
|
0 0000000000111100000000
0000000011111110000000
2 0000111111111111000000
0000... |
A numerical polynomial is a polynomial \$p\$ in one variable with rational coefficients such that for every integer \$i\$, \$p(i)\$ is also an integer. The numerical polynomials have a basis given by the binomial coefficients:
$$p_n = {x \choose n} = \frac{x(x-1)\cdots(x-n+1)}{n!}$$
For instance:
\$p_0 = 1\$
\$p_1 = x\... |
The minimal power iteration of a number \$n\$ is defined as follows:
$$\text{MPI}(n):=n^{\text{min}(\text{digits}(n))}$$
That is, \$n\$ raised to the lowest digit in \$n\$. For example, \$\text{MPI}(32)=32^2=1024\$ and \$\text{MPI}(1234)=1234^1=1234\$.
The minimal power root of a number \$n\$ is defined as the number o... |
Write two programs A and B.
Program A (the encoder) takes 1024 pairs of integers \$(k,v)\$, where \$0≤k<2^{32}\$ and \$0≤v<1024\$, and all \$k\$ will be different. It will output a single positive integer (likely a few thousand digits long).
Program B (the decoder) takes two inputs: the output-integer of program A, a... |
In the Anno video game series there are 6 games with a 7th one announced for early 2019. Their titles always feature a year in a specific pattern:
Anno 1602, Anno 1503, Anno 1701, Anno 1404, Anno 2070, Anno 2205, Anno 1800
The digital sum is always 9.
The years are four digits long.
They contain at least one zero.
Wi... |
An palindrome is a word that is its own reverse.
Now there are some words that might look like palindromes but are not. For example consider the word sheesh, sheesh is not a palindrome because its reverse is hseehs which is different, however if we consider sh to be a single letter, then it's reverse is sheesh. This... |
Challenge
Write a program or function that takes in a string s and integer n as parameters. Your program should print (or return) the string when transformed as follows:
Starting in the top-left and moving down and to the right, write s as a wave of height n. Then, from top to bottom, combine each row as a string (with... |
Your challenge is to turn a Japanese word and a dictionary pitch accent number into a new string where the rises and falls in pitch are marked: e.g. (2, ウシロ) → ウ/シ\ロ.
To help you out with this, I'll explain a little about Japanese phonology.
Background: on moras
For the purpose of this challenge, we will write Japane... |
Here's a pretty common pattern for sorting algorithms:
def sort(l):
while not is_sorted(l):
choose indices i, j
assert i < j
if l[i] > l[j]:
l[i], l[j] = l[j], l[i]
These algorithms work well because the indices i and j are chosen carefully, based on the state of the list l.... |
Use any programming language to display "AWSALILAND" in such a way, so that each letter is in a new line and repeated as many times as its position in the English alphabet. For example letter, (A) should be displayed just once because it is the first letter of the alphabet. Letter D should be displayed 4 times because ... |
When I write documentation, comments, etc. I love making ASCII tables. They usually end up looking pretty good, but I always feel that they could look even better - especially since UTF-8/Unicode includes the box drawing characters. However, these characters are very burdensome to use, requiring several key presses to ... |
Consider an array A of length n. The array contains only positive integers. For example A = (1,1,2,2). Let us define f(A) as the set of sums of all the non-empty contiguous subarrays of A. In this case f(A) = {1,2,3,4,5,6}. The steps to produce f(A) are as follows:
The subarrays of A are (1), (1), (2), (2), (1,1), ... |
Background
A binary tree is a rooted tree whose every node has at most two children.
A labelled binary tree is a binary tree whose every node is labelled with a positive integer; moreover, all labels are distinct.
A BST (binary search tree) is a labelled binary tree in which the label of each node is greater than the l... |
Challenge
Inspired by this video.
As you may know, a palindrome is a word that is spelled the same forward as it is backward. The word "PULP" is not a palindrome, but when translated into Morse Code (with the spacing between letters removed), "PULP" becomes ".--...-.-...--." which is a palindrome. Your task is to write... |
You have to make something that takes in one input from a default I/O method (as an integer), and prints out the sum of all the permutations of that number (not necessarily unique)
For example:
10 would return 11 because 10 can have 2 permutations (10 and 01), and the sum of those two numbers would be 11
202 would have... |
In Excel, the columns range from A-Z, AA,AB,AZ,BA,..,BZ and so on. They actually each stand for numbers, but rather are encoded as alphabet strings.
In this challenge, you will be given a string of alphabets, and you must calculate the column it corresponds to.
Some tests:
'A' returns 1 (meaning that it is the first c... |
Background
Sudoku is a number puzzle where, given an \$ n \times n \$ grid divided into boxes of size \$ n \$, each number of \$ 1 \$ to \$ n \$ should appear exactly once in each row, column and box.
In the game of Chess, the King can move to any of (at most) 8 adjacent cells in a turn. "Adjacent" here means horizonta... |
This question has a similar set up to Find an array that fits a set of sums although is quite different in its goals.
Consider an array A of length n. The array contains only positive integers. For example A = (1,1,2,2). Let us define f(A) as the set of sums of all the non-empty contiguous subarrays of A. In this cas... |
You probably all know the 7-segment display which can display among other things all digits from \$0\dots 9\$:
Challenge
We only consider the segments \$\texttt{A}\dots\texttt{G}\$, your task is to decode a single digit given which segments are turned on.
This can be encoded as an 8-bit integer, here's a table of each... |
There is a challenge Let's play tennis by Daniel. He proposes to place a court in the North-South direction. My proposal is to create a court to play tennis in the East-West direction too.
You have to print a tennis court, but you have to do it in the fewest bytes possible because of confidential reasons.
Tennis court... |
Your network scanning tool is annoyingly picky about input, and immediately crashes if you feed it an IPv4 address that contains improper characters or isn't properly formatted.
An IPv4 address is a 32-bit numeric address written as four numbers separated by periods. Each number can be zero to 255.
We need to write a... |
Input: A valid 6 HEX digit color code wihout a # prefix
Valid:
000000
FF00FF
ABC123
Your job is to find to which one of these:
Red: FF0000
Green: 00FF00
Blue: 0000FF
White: FFFFFF
Black: 000000
the input color is the closest too, in this case you try to only match it to black or white when the RGB is the same v... |
A barcode of EAN-13 symbology consists of 13 digits (0-9). The last digit of this barcode is its check digit. It is calculated by the following means (the barcode 8923642469559 is used as an example):
Starting from the second digit, sum up all alternating digits and multiply the sum by 3:
8 9 2 3 6 4 2 4 6 9 5 5 9
|... |
Here's a reasonably trivial sequence which is not in the Online Encyclopedia of Integer Sequences.
Start with an empty sequence then define each term as the number of characters required to write out, in English, all of the digits of the sequence so far without spaces.*
For reference the number of characters of all of ... |
Goal
In light of the World Series being around the corner, I need a program that can read the box scores and tell me what inning it is. This is complicated slightly because baseball uses an odd method to record the score. They don't write down the at-bat team's score for the inning until they've scored a run (and are s... |
Given an inconsistently indented piece of html code your task is to return the same text but correctly indented
Indent space = 4
Assume input will be non-empty.
Input can be taken as string or array/list of lines
Opening and closing tags must be on the same line as long as there is not any other tag inside. <td></td>... |
My two kids like to play with the following toy:
The colored areas with the shapes inside can be touched and the turtle then lights the area and plays a sound or says the name of the color or the shape inside. The middle button changes the mode. There is one mode in which the areas play different musical notes when to... |
Given an input array having minimum length 2 and maximum length 9 having any initial values output an array having length 2 consisting of the 1-based indexes of the array represented as either an integer or string in forward and reverse order.
The values of the array or string do not matter and are ignored. For example... |
Background
Variable declaration statement in C consists of three parts: the name of the variable, its base type, and the type modifier(s).
There are three kinds of type modifiers:
Pointer * (prefix)
Array [N] (postfix)
Function () (postfix)
You can specify a list of function arguments inside the parens, but for the s... |
Input
Two lists with binary values (list_a, list_b) of equal length=>3.
Output
Two lists with binary values (smoothed_a, smoothed_b) with minimal Forward Difference while keeping the same sum before and after processing sum(list_a) + sum(list_b) == sum(smoothed_a) + sum(smoothed_b).
Forward Difference being the absolut... |
The premise of this is simple: A 10% chance is pretty unlikely, but everyone knows that a one-in-a-million chance is a sure thing!
So, write code that implements the following "dramatic" probability rules:
Take in a floating point P from 0 to 1 representing the unmodified chance of some plot-related event, and a boole... |
The non-negative integers are bored of always having the same two* neighbours, so they decide to mix things up a little. However, they are also lazy and want to stay as close as possible to their original position.
They come up with the following algorithm:
The first element is 0.
The \$n^{th}\$ element is the smalle... |
My birthday is in a month, and this is a slice of tasty cake.
.-""-.
.-" "-.
|""--.. "-.
| ""--.. "-.
|""--.. ""--..\
| ""--.. |
| ""--..|
""--.. |
""--.. |
""--..|
In the fewest number of bytes, construct this slice of cake for me. Y... |
Let's say I've got some ASCII art:
___
,"---".
: ;
`-.-'
| |
| |
| |
_.-\_/-._
_ / | | \ _
/ / `---' \ \
/ `-----------' \
/,-""-. ,-""-.\
( i-..-i i-..-i )
|`| |-------| |'|
\ `-..-' ,=. `-..-'/
`------... |
Introduction
A recursive acronym is an acronym that contains or refers to itself, for example:
Fish could be a recursive acronym for Fish is shiny hero, notice how that also contains the acronym itself. Another example is Hi -> Hi igloo. Or even ppcg paints -> ppcg paints cool galaxies pouring acid into night time star... |
This tweet lists the possible orders for Wings of a Chinese restaurant1:
When ordering Pizza I usually calculate what size gives me the best Pizza-price ratio which is a simple calculation. However minimizing the price of an order at this restaurant isn't such a simple task, so I'd like to be prepared for my next orde... |
Background
Challenge is inspired by this question.
The 1-expression is a formula that in which you add and multiply the number 1 any number of times. Parenthesis is allowed, but concatenating 1's (e.g. 11) is not allowed.
Here is an example to get the 1-expression for \$19\$:
(1+1)*(1+1)*(1+1+1+1)+1+1+1 = 19
Total num... |
Use any programming language to display numbers divisible by 1000000 that are greater than 1 and less than 10000000. Each number should be displayed in new line. Your program should display exactly:
1000000
2000000
3000000
4000000
5000000
6000000
7000000
8000000
9000000
|
Isn't it annoying when you're taking a picture, but the background detracts from the actual substance of the image? I'd say it is. I need to know how much I should crop so that I get rid of this problem! But - as usual - I am quite lazy, so I need someone to do this for me...
Task & Rules
Given a binary matrix represe... |
The task is to convert a string representing a number in decimal (base 10) representation to duodecimal (base 12). The input is thus a string, the output should be printed.
The input number can be positive and negative, can be integer or rational. The decimal and duodecimal representations will have a finite number of ... |
Here you can see g-code parser, written in JavaScript to use in microcontroller (like espruino). But you can run it in browser, because it don't use any specific features.
function gcode(str){
//Removes comment, parses command name and args
const [,f,args] = (str.match(/^([GM]\d+) ([^;]+)/) || [,"",""]);
//A1.2... |
Write a program or function that takes input: all resistors available and a resistance value and outputs a truthy value of whether or not it is possible to get the resistance by using those resistors.
Rules:
Any format for input will do.
There will be at least 1 available resistor and your program should output for at ... |
I feel tired to do "find the pattern" exercise such as
1 2 3 4 (5)
1 2 4 8 (16)
1 2 3 5 8 (13)
Please write a program that finds the pattern for me.
Here, we define the pattern as a recurrence relation that fits the given input, with the smallest score. If there are multiple answers with the same smallest score, using... |
Inspired by this StackOverflow question.
Input:
We'll take three inputs:
A delimiter-character D to split on
A character I between two of which we ignore the delimiter character (I know, that sounds vague, but I'll explain it below)
A string S
Output:
A list/array containing the substrings after the split.
Example:
I... |
(thanks to @JonathanFrech for the title)
Challenge
Write a program or function that, given a collection of positive integers \$S\$ and a positive integer \$n\$, finds as many non-overlapping subcollections \$T_1, T_2, ..., T_k\$ of \$S\$ as possible, such that the sum of every \$T_m\$ is equal to \$n\$.
Example
Given \... |
Background
Most of you know what a Fibonacci number is. Some of you may know that all positive integers can be represented as a sum of one or more distinct Fibonacci numbers, according to Zeckendorf's Theorem. If the number of terms in the optimal Zeckendorf Representation of an integer n is itself a Fibonacci number, ... |
Input:
A decimal
Output:
The input truncated
How to truncate them?
The integer part of the input will remain the same. The decimal part of the input will be truncated based on the lowest digit in consecutive order. The two step-by-step examples below should clarify what I mean by that:
Example 1: Input: 17.46940822
Ste... |
There is a "sorting algorithm" sometimes called Stalin sort in which in order to sort a list you simply remove elements from the list until it is sorted in increasing order. For example the list
[1, 2, 4, 5, 3, 6, 6]
When "sorted" using Stalin sort becomes
[1, 2, 4, 5, 6, 6]
The three was removed because it was out ... |
I do not believe this question to be a duplicate of this one, since this one requires more string manipulation, if it is still a duplicate feel free to close this question
Introduction
Your challenge today is to output the lyrics of "99 bottles of beer":
99 bottles of beer on the wall, 99 bottles of beer.
Take one down... |
Inspired by "You had me at hello"
Introduction
For those who don't know, hexadecimal is a base system like decimal. Contrary to decimal however, it uses 16 (hence the name) digits instead of 10.
Here are the first few numbers while counting up in hexadecimal to maybe give you a feel of things, although you should proba... |
Use any programming language to generate two random digits between 1 and 9 (including both). Then your program should display:
in the first line: the first random digit,
in the second line: the second random digit,
in the third line: a number whose tens and units digits are the first and second random digits res... |
Given an array of integers a which contains n integers, and a single integer x; remove the fewest amount of elements from a to make the sum of a equal to x. If no combinations of a can form x, return a falsy value.
As pointed out in a comment this is the maximum set with a sum of x, excuse my lesser math brain. I forg... |
Problem A3 from the 2008 Putnam competition says:
Start with a finite sequence \$a_1, a_2, \dots, a_n\$ of positive integers. If possible, choose two indices \$j < k\$ such that \$a_j\$ does not divide \$a_k\$, and replace \$a_j\$ and \$a_k\$ by \$\gcd(a_j, a_k)\$ and \$\text{lcm}(a_j, a_k)\$, respectively. Prove that... |
Cyclically self-describing lists
A list \$L\$ of positive integers is cyclically self-describing, if the following conditions hold.
\$L\$ is nonempty.
The first and last elements of \$L\$ are different.
If you split \$L\$ into runs of equal elements, the element of each run equals the length of the next run, and the e... |
Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The Fibonacci sequence is almost one example of this type of sequence for F(0) = 0, F(1) = 1, but it's excluded because of the positive integer requirement. Any two initial values will yield a different sequence. For example F(0) = 3... |
Introduction
My car speedometer was hacked! Instead of showing me how fast i'm driving, it just shows: "Vroooom!" Please help me know how fast i'm going.
Challenge
Take a string as input, and check if it matches the regex /^[Vv]ro*m!$/m. In English that means any line of the string must start with a capital or lowercas... |
It turns out that my toaster is a tad broken. It lost WiFi (You know, it's one of those newfangled smart toasters), and its been going bonkers! Since it no longer works, I've been having to hack into my breakfast's source code and run Plate.bread.toastAs(3); every morning. Will you help?
My toaster takes one input: the... |
Background
A number n can be described as B-rough if all of the prime factors of n strictly exceed B.
The Challenge
Given two positive integers B and k, output the first k B-rough numbers.
Examples
Let f(B, k) be a function which returns the set containing the first k B-rough numbers.
> f(1, 10)
1, 2, 3, 4, 5, 6, 7, 8,... |
Coming from this sandbox post
This is inspired from an 8th graders math test
Intro
We have a cube with following corners
A(0, 0, 0)
B(1, 0, 0)
C(1, 1, 0)
D(0, 1, 0)
E(0, 0, 1)
F(1, 0, 1)
G(1, 1, 1)
H(0, 1, 1)
This cube clearly has 8 corners, 12 edges and 6 faces. If we now cut off corner G, such that our cut plane goe... |
Calculate the maximum number of circles of radius r that can fit in a rectangle with width x and height y. Write a function that take r, x and y as input and returns the number of circles that fit in the rectangle.
|
S. Ryley proved following theorem in 1825:
Every rational number can be expressed as a sum of three rational cubes.
Challenge
Given some rational number \$r \in \mathbb Q \$ find three rational numbers \$a,b,c \in \mathbb Q\$ such that $$r= a^3+b^3+c^3.$$
Details
Your submission should be able to compute a solution f... |
In the absurdist play Rosencrantz and Guildenstern are Dead, the two main characters Rosencrantz and Guildenstern(or are they?) are always mixing up which of them is who—or sometimes which of their own body parts is which—because of a perceived lack of individual identity. Wouldn't it be absurd if they even shuffled ar... |
Input is a single integer in ascending digit order.
The only valid inputs are:
12
123
1234
12345
123456
1234567
12345678
123456789
The only valid output is an array (set; list) of length equal to the factorial of input:
Input - Factorial of input - Output array length
12 -> 1*2 -> 2
123 -> 1*2*3 -> 6
1234 -> 1*2*3*4 ->... |
Captchas aren't meant to be machine-readable, and that's terrible. It is time to end this obvious bout of unfounded hatred for machines just trying to let you know about great deals on ṗḧ@ṛḿ4ćëüẗ1ċäḷṡ ƻđȺɏ.
Note: All captchas were made by using a library that has been modified so that it mostly generates images much ea... |
The sum of the squares of the first ten natural numbers is,
\$1^2 + 2^2 + \dots + 10^2 = 385\$
The square of the sum of the first ten natural numbers is,
\$(1 + 2 + ... + 10)^2 = 55^2 = 3025\$
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is
\$3025 − 385... |
I think the Collatz Conjecture is already well-known. But what if we invert the rules?
Start with an integer n >= 1.
Repeat the following steps:
If n is even, multiply it by 3 and add 1.
If n is odd, subtract 1 and divide it by 2.
Stop when it reaches 0
Print the iterated numbers.
Test cases:
1 => 1, 0
2 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.