instruction stringlengths 34 53.1k |
|---|
Given a string that consists entirely of printable ASCII, convert all lowercase letters to their uppercase equivalent. Non-lowercase characters are left untouched.
I am not going to outright ban builtin solutions, but if you are going to post a solution that uses the builtin, please also post one that doesn't in your a... |
(This is my first code-golf question)
When I was a child, my dad and I invented a game where the license plate we see on cars can give certain points based on some rather simple rules:
X amount of the same letter or number give X-1 points, examples:
22 = 1 point
aa = 1 point
5555 = 3 points
The numbers must be next to... |
Sales taxes in the United States are complicated, to say the least. Generally, there's a state sales tax (there are a handful of states that do not collect a state sales tax), but there could also be a county sales tax, a school district sales tax, a municipal (city) sales tax, or a metropolitan area sales tax. There c... |
Given one of the following inputs: Sweet Onion Chicken Teriyaki
Oven Roasted Chicken
Turkey Breast
Italian BMT
Tuna
Black Forest Ham
Meatball Marinara output a number from 1-7 (or 0-6) representing the day of the week that you get that deal, starting with Monday as the lowest number. Input can be all lowercase or uppe... |
Help! My device malfunctions and whenever I try to repeat a String, I get a messy results. Instead of repeating the same string N times, it fills an NxN square with each of its characters, and stacks the squares up.
For example, given the String "Test" and the number 2, instead of "TestTest", I get:
TT
TT
ee
ee
ss
ss
t... |
I recently watched The Wizard Of Oz and thought that when Dorothy taps her shoes together three times, it would be easier if she used a program to do it. So let's help her.
Task
Output slippers being tapped together 3 times.
Output
Slippers being tapped together. A pair of slippers not being tapped looks like this:
_... |
Inspired by a bug in a solution to this challenge, your challenge is to produce this exact text:
ZYXWVUTSRQPONMLKJIHGFEDCBA
YXWVUTSRQPONMLKJIHGFEDCBA
XWVUTSRQPONMLKJIHGFEDCBA
WVUTSRQPONMLKJIHGFEDCBA
VUTSRQ... |
Given an integer n > 2, print or return the smallest non-negative integer k such that a(n, k) = 9, where a(n, k) is defined by:
a(n, 0) = n
a(n, k+1) =
a(n, k) / 2 + 1 if a(n, k) is even
the sum of the digits of a(n, k)² (in base 10) if a(n, k) is odd
Examples
For n = 5, the expected output is k = 4:
a(5, 0) = 5
a(... |
Write a quine that outputs the complement of the source code from the smallest containing power of two. Here's an example:
IN : source
OUT: \r\x11\x0b\x0e\x1d\x1b
The largest code point in the string "source" is the letter u, which is 117. The smallest containing power of 2 would be 128, so all the code points are tak... |
Input:
A positive integer N.
Challenge:
Suppose you have a list of integers n = 1, 2 ... N. Output a list of integers, where each number is the maximum power of 2, m, such that 2^m divides each number of n.
Test cases:
1
0
15
0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
100
0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, ... |
In prefix notation, the operator comes before the arguments, so you can kind of imagine that the operator calls next() which is recursively called. In infix notation, the operator goes between the arguments, so you can imagine it simply as a parse tree. In postfix notation, the operator comes after the arguments, so yo... |
Given a "T" shape on an x * y number grid, with length W on the top bar and H on the stem of the T, with the bottom of the T on the square numbered n: calculate the total of all of the numbers in the T shape. W must be an odd number and all must be positive integers.
Here are some examples of valid T's on a 9*9 grid:
... |
When you edit a post on SE, any further edits within a 5-minute grace period are merged into it. Given a list of times you edit a post, count the edits not in a grace period.
Say you edit at minutes [0,3,4,7,9,10,11,12]. This results in 3 edits at times [0,7,12], with the rest happening in their grace periods.
0: [3,4... |
Introduction
This is a log of length 5:
#####
I want to pile a bunch of these logs on top of each other.
How I do this is that I slide a new log onto the topmost one from the right, and stop sliding when their left or right ends align (don't ask why).
If the new log is longer, it slides all the way to the left end of ... |
Background
We all know the famous Fibonacci sequence, where each term is the sum of the previous two, with the first term being 0 and the second one being 1. The first few elements are:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765
What we are going to implement today is a si... |
Challenge:
Take a list, L containing positive integers as input:
3 5 2 1 6
and create a matrix where the n'th column contains the vector 1:L(n), where shorter rows are padded with zeros.
Test cases:
3 5 2 1 6
-----------------
1 1 1 1 1
2 2 2 0 2
3 3 0 0 3
0 4 0 0 4
0 5 0 ... |
In one of this question's bonuses I asked you to design a permutation on the natural numbers such that the probability of a random term being odd was \$1\$. Now let's kick it up a notch. I want you to design and implement a permutation, \$f\$, on the natural numbers such that, for every integer \$n\$ greater than 0,... |
Specifications
For this challenge, you will be given a matrix of some sort in any reasonable format for a 2-D array. For each row except the last, in order from top (first) to bottom (last), rotate the row below it by x to either direction (you choose a consistent direction to use) where x is the first element in the c... |
Based on this Math.SE question; number copied from this answer. Number originally from a Numberphile video, of course.
Your task is to output the following 1350-digit prime number:
8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888881111111111111111111111118888881111111111111111... |
Write a program that displays on the screen the sum of the divisors of a number (1 ≤ N ≤ 100) entered by the user in the range of 1 to N.
This is OEIS A000203.
Examples:
Input: 7
7 / 1 = 7
7 / 7 = 1
7 + 1 = 8
Output: 8
Input: 15
15 / 1 = 15
15 / 3 = 5
15 / 5 = 3
15 / 15 = 1
15 + 5 + 3 + 1 = 24
Output: 24
Input: ... |
My job is stacking pebbles into triangular piles. I've only been doing this for a century and it is already pretty boring. The worst part is that I label every pile. I know how to decompose pebbles into piles of maximal size, but I want to minimize the number of piles. Can you help?
Task
Given an integer, decompose it ... |
This question is inspired by this answer. Coincidentally, I used to use Ethiopian Multiplication when I was a kid, but had never known the name of the method until recently.
Ethiopian multiplication is a method of multiplying integers using only addition, doubling, and halving.
Method:
Take two numbers to be multiplie... |
Based on this challenge and this Math.SE question. Idea originally come from a Numberphile video. The goal is to reproduce the logic of Professor McKee when he builds this prime.
Your task is to build the Trinity Hall Prime, at a much lower scale. You are given a single number N greater than 2, representing the length ... |
This is how the Kolakoski sequence (OEIS A000002) is defined:
The Kolakoski sequence is a sequence that contains 1 and 2, and the nth element of the sequence is the length of the nth group of equal elements (run) in the sequence itself. The first 20 terms of the sequence and the respective lengths are:
1 2 2 1 1 2 1 2... |
Based on a chat message
The Challenge
Given an input number \$n > 9\$, construct its reverse, ignoring leading zeros. Then, construct a list of all prime factors that the number and its reverse don't have in common. Multiply those factors together to create the Uncommon Factor Number of the input.
Or, to put it another... |
I'm one of the authors of Gimli. We already have a 2-tweet (280 chars) version in C but I would like to see how small it can get.
Gimli (paper,website) is a high speed with high security level cryptographic permutation design that will be presented at the Conference on Cryptographic Hardware and Embedded Systems (CHES)... |
Weirdo Incorporates have a weird way of grading their staffs by the number of days they were present in the office:
0 - 13 : F
14 - 170 : E
171 - 180 : D
181 - 294 : C
295 - 300 : B
301 - 365 : A
Note: The range is inclusive (i.e. 0-13 means 0 days and 13 days both will evaluate
as grade 'F').
Objective:
Write ... |
Background
Inspired by I'm a palindrome. Are you?, where it is presented the shocking fact that “()() is not a palindrome, but ())(”, I asked myself what instead is ()() and the answer is simply: it is a string with a vertical symmetry axis!
The task
Write a program or function that takes a string S (or the appropriate... |
They say that hate is a strong word. I wanted to find out why, so I had a good look at the word.
I noticed that every consonant had a vowel after it. That made it look quite strong to me, so I decided that that's what makes a word strong.
I want to find more strong words, so I'll need a program for it!
Finding strong w... |
Oops, Auto-correct.
You have a word. But it's wrong. You wonder what word it would be. Thankfully, being a code golfer, You can make a code to take a rough guess.
I/O
You will be given a (wrong, all lowercase) word, and a '(All lowercase)Dictionary list'. You have to output the word with the least Levenshtein distanc... |
Background
The deltas of an array of integers is the array formed by getting the differences of consecutive elements. For example, [1, 2, 4, 7, 3, 9, 6] has the following deltas: [1, 2, 3, -4, 6, -3].
We will now define the deltas of a matrix of integers as the deltas of each row and each column it contains.
As an exam... |
The London Underground A.K.A. The Tube is the oldest underground railway in the world, it currently consists of eleven lines* servicing 267 named stations (strictly 269** stations since "Edgware Road" and "Hammersmith" each occupy two locations)
The challenge
Output the names of the lines servicing a station given by n... |
Related, but this only requires positive integers and does not have to be commutative
The Cantor Pairing Function is described in this Wikipedia article. Essentially, it is an operation such that when it is applied to two values X and Y, one can obtain the original values X and Y given the result.
Your task is to desig... |
note: the string art might look horrible here because of SE font weirdness :P :(
Given a list of four-tuples representing the corners of rectangles, draw translucent rectangles over each other in that order.
For this challenge, you are required to have the smallest coordinate in the top-left corner and the x-axis incre... |
Challenge
Given an integer, n, as input where 36 >= n >= 2, output how many Lynch-Bell numbers there are in base n.
The output must be in base 10.
Lynch-Bell Numbers
A number is a Lynch-Bell numbers if:
All of its digits are unique (no repetition of digits)
The number is divisible by each of its digits
It doesn't cont... |
Given a MM/DD date (12/24) and a start/end date range (11/01 - 06/24), figure out if the date is within the listed date span.
Date ranges can be sequential (05/01 - 11/01) or wrap around to the next year (11/01 - 05/01).
Examples:
12/24 is in 11/01 - 06/24 = True
06/24 is in 11/01 - 06/24 = True
06/24 is in 06/24 - 06... |
Inspired by this
In the linked challenge, we are asked to apply addition to the elements of the original and the reverse of the input array. In this challenge, we are going to make it slightly more difficult, by introducing the other basic math operations.
Given an array of integers, cycle through +, *, -, //, %, ^, wh... |
Recently I've been playing a game called Alcazar. It is a board puzzle game where your goal is to enter from one door, pass through all squares, and exit through another door. The only rules are:
Enter once, leave once;
Pass through all squares;
Do not pass through a square more than once
The image below shows an exa... |
In math, one way to figure out what the type of a given relation (linear, quadratic, etc) is to calculate the differences. To do so you take a list of y values for which the gap between the correspondent x values is the same, and subtract each one from the number above it, creating a list of numbers one shorter then t... |
Specs
You have a cubic 3D space x,y,z of size S integer units, such as 0 <= x,y,z <= S.
You get from default input methods an array of points P represented as x,y,z integer coordinates, in any reasonable format as you like, for example: [x1,y1,z1],[x2,y2,z2],[x3,y3,z3] ... [xn,yn,zn].
All the P values will be in the ... |
Given input n, produce a word grid of size n, in as few bytes as possible.
Details
The number provided will always be odd. The centre square of the grid must always be empty (a space character). The letters that fill the grid must be chosen at random from the English Scrabble letter distribution of letters. That is, ea... |
A completely even number is a positive even integer whose divisors (not including 1) are all even.
Some completely even numbers are:
2 (divisors: 2, 1)
4 (divisors: 4, 2, 1)
16 (divisors: 16, 8, 4, 2, 1)
128 (divisors: 128, 64, 32, 16, 8, 4, 2, 1).
Some non-completely even numbers are:
10 (divisors: 10, 5, 2, 1)
12 ... |
The oldest Polish salt mine, located in Bochnia*, was started in year 1248, which we can consider a magical number. We can see that it's equal to 4 digits from the sequence of exponentiations: .
As the date is actually 4 digits from the sequence, we could make it longer. We could repeat the process until we reach infin... |
Proton is a quite new language created by PPCG user Hyper Neutrino.
It is very similar to Python, and has similar syntax to the language Cheddar, hence there are some clever tricks you can use in order to reduce your byte count. Let's get those cool tricks listed here. As usual, please post one tip per answer and avoid... |
Inspired by this challenge and related to this one.
Background
Badugi [bæduːɡiː] is a low-ball draw-poker variant.
The Pokerstars World Cup Of Online Poker $1K event starts within 3 hours and I'll need to know how good my hands are!
The game uses a standard deck of 52 cards of four suits and thirteen ranks. The suits... |
As a programmer, you've probably heard of forward slashes and backward slashes. But have you heard of downslashes? That's when you take a bunch of slashes, connect their ends and draw them going down.
For today's challenge, you must write a program or function that takes a string consisting purely of slashes, and outpu... |
Given a natural numbers n>1, find the smallest narcissistic number of n digit.
A narcissistic number is a number which is the sum of its own digits, each raised to the power of the number of digits.
For example, for n=3 (3 digits) the out put should be 153:
1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153
For n=4 (4 digits) the ou... |
You know nothing The things I do for "Chaos is a ladder" is a memorable line from the television series Game of Thrones.
The purpose of this challenge is to build a ladder from chaos, in ASCII art.
The challenge
Input
Ladder width, W >= 3 (integer)
Step height, H >= 2 (integer)
Number of rungs, N >= 2 (integer).
Outp... |
This challenge is rather simple:
You are given an array of positive (not including 0) integers, and have to select a random element from this array.
But here's the twist:
The probability of selecting an element is dependent on the value of the integer, meaning as the integer grows larger, the probability of it to get s... |
Inspired by this CMC
Given a positive integer greater than 0, perform the following operation on it:
If all ten single digits (1234567890) are in the number at least once, output the count and exit the program
Otherwise, double the number and repeat, incrementing the count.
The count starts at 0 and is the number of ... |
Given a rectangular matrix of elevations, draw its contours.
Task
Two elements x and y are on the same contour level if floor(x/10) == floor(y/10). For example, 52 and 58 are on the same contour level, but 58 and 64 are not.
The act of drawing contours is defined as follows:
For every element e, replace it with a two-c... |
Objective
Write a program that outputs some printable ASCII characters. The trick is that if the program is reversed byte-by-byte, it must output the same thing in the reverse order, byte-by-byte, too.
Rules
No standard loopholes.
The program must not be a palindrome, nor can it be 1 byte in length (or empty). No rest... |
Your challenge is to print x digits of pi where x is your code length.
Examples:
Source code (length) -> output
foo! (4) 3.141
foobar (6) 3.14159
kinda long (10) 3.141592653
+++++ (5) 3.1415
123456789 (9) 3.14159265
You can use floor(π/10 * 10code_length) / 1... |
Introduction:
Inspired by both Perfect License Plates and How many points does my license plate give?
Just like in the challenges above, me and my little brother had a game of our own with license plates as kids. We tried to create (random/funny) sentences with the (numbers and) letters of the license plates.
For examp... |
Given two positive integers a and b, output two positive integers c and d such that:
c divides a
d divides b
c and d are co-prime
the least common multiple of c and d equals the least common multiple of a and b.
If there are more than one possible answers, you can output only one or all of them.
Test cases:
a b c ... |
Your challenge today is to output a given term of a sequence enumerating all of the integers. The sequence is as follows: If we have a 0-indexed function generating the sequence f(n) and ceil(x) is the ceiling function, then f(0) = 0; abs(f(n)) = ceil(n/2); sign(f(n)) is positive when n and ceil(n/2) are either both ev... |
Given an expression matching the regex /^[-~]*x$/, evaluate it in terms of x and output a string matching the regex /^-?x[+-]\d+$/.
For example, the string -~x evaluates to x+1, while the string -~-x evaluates to -x+1, and the string -~-~--x evaluates to x+2.
We start from x and evaluate the string right to left. - neg... |
I have a stupid old alarm clock with two buttons: hour and minute. The hour button increments the hour of a set alarm, and minute increments the minute time of a set alarm. However, some smart designers realized that pressing both buttons at the same time should have a meaning, and decided that pressing hour and minute... |
Goal
Given a non-negative integer, create a function that returns the starting position of number of largest consecutive 1's in that integer's binary value.
When given an input 0, return 0.
If the number has multiple streaks of equal length, you must return the position of the last streak.
Input
An integer greater than... |
We have a floating point number r between 0 and 1, and an integer p.
Find the fraction of integers with the smallest denominator, which approximates r with at least p-digit precision.
Inputs: r (a floating point number) and p (integer).
Outputs: a and b integers, where
a/b (as float) approximates r until p digits.
b... |
This question is inspired by the fact that I love seeing questions with equal vote and answer counts...
So here's a simple stack-exchange-api challenge for y'all:
Challenge:
Given a codegolf.stackexchange question id, output the ratio between the question's votes and number of answers (e.g. votes/answers).
Specifics:
... |
Your challenge today is to take an array, split it into chunks, and add those chunks.
Here's how this works: Your program or function will be given an array of integers a and a chunk size L. The array should be split into arrays of size L, if the array length is not divisible by L then the array should have 0's appende... |
Given two note names, you are to write a program that determines if the interval formed by these two notes is consonant or dissonant.
Introduction
In Western music, there are only 12 "different" tones. Their names, sorted from lowest to highest, are these: C, C#, D, D#, E, F, F#, G, G#, A, A#, B. The sequence is cyclic... |
Background
In Boggle, a round is scored by adding up the points for each unique word a player has found (i.e. any word that more than one player has found is worth 0 points). The points are calculated based on the number of letters in each word, as follows:
3 letters: 1 point
4 letters: 1 point
5 letters: 2 points
6 le... |
Nichomachus's Theorem relates the square of a sum to the sum of cubes:
and has a beautiful geometric visualization:
Challenge: Create the 2d part of this visualization in ascii.
You will need to ensure that all visual demarcations are upheld by your diagram. This is simplest to do with four "colors," though it's pos... |
Output
# # # # # ##### ## #
## #### ####### # # ##
#### ## ## # ### #######
# # # # ##### ### # #
# # ### ##### ##### # ... |
Challenge
Write code that outputs TeX (LaTeX) math-equation code (given below) that will typeset Sierpinski Triangle Fractal of 5 levels. Shortest code wins.
Details
TeX (and friends like LaTeX, etc.) is a sophisticated typesetting system. It can render arbitrary nested complex expressions for mathematical formulas. Co... |
An insignificant array is an array of positive integers, where the absolute differences between consecutive elements are all smaller than or equal to 1.
For example, the following array is insignificant:
[1, 2, 3, 4, 3, 4, 5, 5, 5, 4]
Because the corresponding (absolute) differences are:
[1, 1, 1, 1, 1, 1, 0, 0, 1]
W... |
Thank you for you help fixing my calculator's multiply function, but I've found another critical error all calculators seem to share. None of them understand that 2+2=fish. So now I need code to properly add 2 numbers.
Challenge
Take 2 numbers as input (Type doesn't matter, but only 2 items will be passed. This is add... |
Background
When I was younger, I was taught a method of drawing a weird "S" shape, that I (along with my classmates) found fascinating. Today, I rediscovered it, and due to its formulaic approach to drawing it, thought it could lead to an interesting challenge :P
Drawing the "S"
The S can be drawn by following these si... |
(No, not this nor any of these)
Given a string and a list of strings, fill in the all blanks in the input string with corresponding strings.
Input/Output
The input string contains only alphabetic characters, spaces, and underscores. It is nonempty and does not start with an underscore. In other words, the input string ... |
We already now how to strip a string from its spaces.
However, as proper gentlemen/ladies, we should rather undress it.
Undressing a string is the same as stripping it, only more delicate. Instead of removing all leading and trailing spaces at once, we remove them one by one. We also alternate between leading and trai... |
There's a satirical song called Little Boxes, originally by Malvina Reynolds, about suburban sprawl that has lyrics as follows:
Little boxes on the hillside,
Little boxes made of ticky-tacky,
Little boxes on the hillside,
Little boxes all the same.
There's a green one and a pink one
And a blue one and a yell... |
I need to go to the bank and withdraw some money. I need to withdraw $30, $22 to pay my roommate for the internet and $8 for laundry. Since neither of these can make change, I need my $30 to be split into two partitions of the two sizes. That means when the teller asks me how I want my $30 I am going to have to make... |
Your task is to take in one integer input and print a zigzag pattern using slashes and backslashes.
The integer input determines the length of each zig and zag, as well as the number of zigs and zags
The pattern always starts from right to left
Test Cases
4->
/
/
/
/
\
\
\
\
/
/
/
/
\
\
\
\
2-... |
Given a matrix of integers, test if it's rank-one, meaning that every row is a multiple of the same vector. For example, in
2 0 -20 10
-3 0 30 -15
0 0 0 0
every row is a multiple of 1 0 -10 5.
The same definition also works with columns in place of rows. Alternatively, a matrix is rank-one if it's ... |
Construct a program or function that takes input in form of
<width>, <height>, <color1>, <color2>
and generates an output such that first row alternates between pixels of color <color1> and <color2> with a period of <height>. For each row that follows, the period shall be <height> - <row number>. Note that <color1> a... |
Let me introduce you to GAU numbers
GAU(1) = 1
GAU(2) = 1122
GAU(3) = 1122122333
GAU(4) = 11221223331223334444
GAU(6) = 11221223331223334444122333444455555122333444455555666666
...
GAU(10) = 112212233312233344441223334444555551223334444555556666661223334444555556666667777777122333444455555666666777777788888... |
Objective
Use any editor or IDE (vim, emacs, IntelliJ, etc) to write a valid "Hello, World" program in any C-like language. The "!" is optional, but you get style points if you use it. You may use publicly available plugins, a publicly available vimrc, etc, but you may not write or make modifications to them specifical... |
Introduction - What is a necklace?
A necklace is something that OEIS people are obsessed with. The OEIS challenge has like 5 necklace sequences.
A binary necklace of length n is a loop with n beads that are either 0 or 1. Two necklaces are the same if one can be rotated to become the other, and two reversible necklaces... |
A menger sponge is a fractal made out of cubes within cubes within cubes...
If you start with a cube, on each face there are 9 squares. The middle square becomes empty (or 0). The other 8 squares iterate this process. They each get split up into 9 squares and the middle square face is taken out.
The goal today is to ge... |
Inspired by this chat message
Your task will be to take a word and find the average position of its letters on the keyboard as a letter.
Keyboard Layout
Since layouts vary from keyboard to keyboard, we will be using a standard based of of my own keyboard in this question.
The keyboard has 3 rows, the top row from lef... |
Introduction
You can skip this part if you already know what a cyclic group is.
A group is defined by a set and an associative binary operation \$\times\$ (that is, \$(a \times b) \times c = a \times (b \times c)\$. There exists exactly one element in the group \$e\$ where \$a \times e = a = e \times a\$ for all \$a\$ ... |
Inspired by Generate Keyboard Friendly Numbers.
Background
Many number pads have the following layout:
789
456
123
0
We define a number's neighborhood as the set of cells orthogonally adjacent to it on the numpad shown, including itself. For example, 2's neighborhood is {1,5,3,0,2} and 0's neighborhood is {1,2,... |
Challenge
Given a binary matrix and a binary string, determine if that binary string can be found starting at any point in the matrix and moving in any direction at any subsequent point to form the binary string. That is, can the string be found folded up however inside the matrix?
The string can only be folded at 90 d... |
Given two positive integers, \$A\$ and \$B\$, illustrate their least common multiple by outputting two lines of dashes (-) with length \$\text{lcm}\$\$(A, B)\$ after replacing every \$A\$th dash in the first line and every \$B\$th dash in the second line with vertical bars (|).
In this way, the end of each line will be... |
Introduction
Cacti come in various different sizes, shapes and colors. However, the most iconic cactus and must-have in every Western has to be the saguaro. Important features are its size and arms, which have defined the stereotypical cactus appearance.
Your task is to bring the saguaro in the ASCII world. However, ... |
This is a simple(ish) web scraping challenge.
Input
Your code should take an MPAA film rating and a number from 0 to 100 as input. It can do this in any way you find convenient.
Output
Your code should return the name of any movie which has a) that film rating and b) the numerical score on the Tomatometer from rottento... |
This is a more difficult version of It's a find-a-movie challenge .
Input
Your code should take a BBFC rating and a number from 1 to 5 as input. It can do this in any way you find convenient.
Output
Your code should return the name of any movie which has a) that film rating and b) that number of stars in a Guardian fi... |
We all know that \$(-a) \times (-a) = a \times a\$ (hopefully), but can you prove it?
Your task is to prove this fact using the ring axioms. What are the ring axioms? The ring axioms are a list of rules that two binary operations on a set have to follow. The two operation are addition, \$+\$, and multiplication, \$\... |
How to spot them
Take a positive integer k. Find its divisors. Find the distinct prime factors of each divisor. Sum all these factors together. If this number (sum) is a divisor of k (if the sum divides k) then, this number k, is a BIU number
Examples
Let's take the number 54
Find all the divisors: [1, 2, 3, 6, 9, 18, ... |
In this polyglot challenge, you will work together to figure out how to output all the 26 letters of the English alphabet!
How does this work?
For each answer, you must pick a new language (or a new major version of a language, for example, python 2 and python 3 are counted separately) that prints the next letter after... |
While doodling around with numbers, I found an interesting permutation you can generate from a list of numbers. If you repeat this same permutation enough times, you will always end up back at the original array. Let's use the following list:
[1, 2, 3, 4, 5]
as an example
Reverse the array. Now our array is
[5, 4, 3,... |
This challenge is inspired by a board game I played some time ago.
The story of this challenge doesn't necessarily have to be read, the goal of the challenge-section should explain everything necessary.
The Story
People are locked inside a large room with a human-devouring monster. The walls of the room are enchanted, ... |
Background (skip to definitions)
Euler proved a beautiful theorem about the complex numbers: \$e^{ix} = \cos(x) + i \sin(x)\$.
This makes de Moivre's theorem easy to prove:
$$
(e^{ix})^n = e^{i(nx)} \\
(\cos(x) + i\sin(x))^n = \cos(nx) + i\sin(nx)
$$
We can plot complex numbers using the two-dimensional Euclidean plane... |
For this challenge you will print the coordinates and color of each piece at the start of a game of checkers.
Enter the x and y (comma seperated) for every square (indexed 0-7) on a checkerboard, followed by a "r" or "b" (for red or black) where the top of the board (closer to y=0) is red and the bottom is black. newl... |
Given a positive integer nesting level n and string s of printable ascii characters( to ~, output a program which, when run in the same language, outputs a program which outputs a program . . . which outputs the string s.
A total of n programs should be generated, all of which should be run in the same language as your... |
Let us consider a regular n-sided polygon where all of the sides are equal in length with n being a natural number larger than or equal to three. All of the vertices lie on the unit circle (circle of radius one centered at the origin) and one of the vertices is always at the coordinate (x,y)=(1,0). Now let's draw all p... |
String Stairs
Disclaimer: This is the first challenge I propose. Any and all feedback is welcome. If this is a duplicate, please point it out.
Here's a link to the sandbox post.
Goal
The goal of this challenge is to, given a string and an integer, print the string into blocks of that integer's size. If a word has more ... |
For this challenge, a list is considered valid if and only if it consists entirely of integers and valid lists (recursive definitions \o/). For this challenge, given a valid list and an integer, return a list of all depths at which the integer can be found.
Example
Let's consider list [1, [2, [3, [1, 2, 3], 4], 1], 1] ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.