instruction stringlengths 34 53.1k |
|---|
Intro
Consider a grid of the characters f A\/ such as
f f f
A
A / \
\ / A
A \/
/
\/
where:
f represents a faucet that pours a stream of water downward
A bifurcates the stream of water above so exactly half goes left and exactly half goes right
\ shifts the stream of water ab... |
The goal of this challenge is to write a program that will simulate a single round of Conway's Game of Life on an existing grid.
Input format:
Input will be read from stdin. The input will consist of a line containing two numbers, r and c, separated by a single space. These will be the number of rows and columns of the... |
Given a number, starting with 1, create new numbers (children) by taking the last digit, n, and concatenating 1 through n+1.
This seems to be a much better explanation of the sequence A071159.
Integers whose decimal expansion start with 1, do not contain zeros and each successive digit to the right is at most one gr... |
Given a sequence of letters, write a program to construct it using symbols on the periodic table. For example, given the input bacon, the program should output:
BaCoN
BAcON
BaCON
Note that capitalization is important. Standard loopholes apply. If a word can't be formed, any error message may be printed.
Edit: All poss... |
Given list of integers {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}.
For those who interested these numbers are used in weekday calculation.
Weekday = (m[n] + d + y + y>>2 + y/400 - y/100) % 7;, where m[n] - expression I'm searching, d - day of month, y - year - (month <= 2).
Construct expression consisting of arithmetic, logi... |
Introduction
Recently, I was skyping with a bunch of friends and we got bored and had nothing to do, so we "invented" a "game" (some people in the comments pointed out that this game is playable online and very popular, so we definetely didn't invent it, although I hadn't seen it before). The reason I put the word "gam... |
In as few Unicode characters as possible, print the following (144 characters):
1, 2, 3 o'clock, 4 o'clock rock,
5, 6, 7 o'clock, 8 o'clock rock,
9, 10, 11 o'clock, 12 o'clock rock,
We're gonna rock around the clock tonight.
You must not use any numbers in your code, except the digit 1.
|
Write a function which gets as input a number (0 <= n <= 255) stored in 32-bit variable and returns non-zero integer if n is prime number and 0 otherwise.
Considern = 0 and n = 1 as non-primes.
Arrays and pointers are not allowed.
Score:
1 - for | & ^ ~ >> << operators
1.1 - for + - < > <= >= == != ! && || operators a... |
You mission today is to invent a text compressor.
Task
You'll write two functions:
The packer is a function that accepts a string of ASCII characters (U+0000 to U+007F) and outputs a Unicode string (U+0000 to U+10FFFF), containing the fewest characters possible.
The unpacker is a function that accepts an encoded Unico... |
Write a program that outputs the contents of the first HTML <code>...</code> block of the answer to this question that is just above yours when the answers are sorted by votes. Output Top! if you are the top answer.
Ignore answers that have negative votes or no <code>...</code> tags. The source of your program must app... |
The scenario
I drive along a road with my car and it begins to rain. The raindrops are falling on my window randomly and now i ask myself, where is the biggest connected wet area?
The task
To make it easier, the window is split in a matrix of 10*10 squares.
Your job is to find the biggest connected water-drop-area on t... |
Khinchin's constant is a curious mathematical constant that, according to Wolfram MathWold, is "notoriously difficult to calculate to high precision".
Here it is to 100 digits:
2.685452001065306445309714835481795693820382293994462953051152345557218859537152002801141174931847697...
Write a program in 64 bytes or less ... |
Courier Ception
The program must accept any string as input and output an pixel image that shows the input string in Courier. All the letters that contain a 'hole' (like abdegopqABDPQR etc) that is surrounded by black pixels must be also filled black.
Input
The Program must be able to accept any ASCII string as input. ... |
Introduction
Sisyphus was having some troubles at work lately. It seems he just never gets anything done, and he would love to find a solution to this problem.
His current employment requires rolling a rock up a hill. He usually does his job well, but every time he is near the top of the hill it rolls down again.
He is... |
Consider these seven ASCII train cars.
Engine (E)
__
====== \/
| [] |=========
| )
================
O-O-O O-O-O \\
Passenger car (P)
===============
| [] [] [] [] |
===============
O-O O-O
Boxcar (B)
===============
|-|-| | |-|-|
===============
O-O O-O
Tanker (T)
__... |
The scenario: You are a software designer working for a gov't-run company that designs license plates for cars and other vehicles. You've been asked to develop software that generates license plates. Before you got to work, your bosses laid down these ground rules.
A license plate cannot contain:
ASS
666
69<any numb... |
The Challenge
For a given set of n integers, write a program which will output its lexicographic index.
The Rules
The input must only be a set of unique non-negative integers separated by spaces.
You should output the lexicographic index (range 0 to n!-1 inclusive) of the permutation.
No permutation libraries or permu... |
Take a 2-dimensional grid and draw a number of line segments on it to represent mirrors. Now pick a point to place a theoretical laser and an angle to define the direction it's pointing. The question is: if your follow the laser beam path for some specified distance, what coordinate point are you at?
Example:
In this ... |
The contest is now over. Coward is the winner.
You can watch the last match here.
Suddenly zombies appear! OH NOES!
In this king-of-the-hill challenge, you must create a bot to survive the zombie apocalypse. Or at least, hold out for as long as possible.
At the start of the game, 50 instances of each entry will be ... |
You are a glob of slime. Naturally, being slime, you want to ooze over as much area as possible. But there are 3 other slimes who want to do the exact same thing. Who will be the superior slime?
Description
All slimes will be gathered into one arena. The judges (i.e. the control program) will go through an exhaustive l... |
The Hilbert curve is a space filling fractal that can be represented as a Lindenmayer system with successive generations that look like this:
Thanks to http://www.texample.net/tikz/examples/hilbert-curve/ for the image.
Goal
Write the shortest program possible (in bytes) that takes a positive integer n from stdin and ... |
Write program, which verifies Erdős–Straus conjecture.
Program should take as input one integern (3 <= n <= 1 000 000) and print triple of integers satisfying identity 4/n = 1/x + 1/y + 1/z, 0 < x < y < z.
Shortest code wins.
Some examples:
3 => {1, 4, 12}
4 => {2, 3, 6}
5 => {2, 4, 20}
1009 => {253, 85096, 1974822872}... |
I hate code bloat!
So I have decided to replace my Windows 7 system by a golfed version. However, I know that it is not easy, so let's build a prototype first. It will take a list of windows from the user and show them using a pseudo-graphic display on the standard output.
For example: user input:
0,0,15,10
15,10,20,1... |
Now that we have over a hundred ways to get stuck in a loop, the next challenge is to get out.
Specifically, write a piece of code with a (seemingly) infinite loop, but somehow manage to break out.
The "infinite loop" can be a statement like while true, for (;1>0;) or anything else which obviously lasts forever. Recurs... |
Given a setup of dominoes your task is to figure out which dominoes fall and which don't.
Input
Take a rectangular ASCII representation of a domino setup. The following characters are used for the ASCII grid:
(space): empty cell
|, -, /, \: dominoes
Dominoes can fall in 8 directions, which are represented by the fol... |
Your job is to animate this circle illusion. It looks like the points rotating inside of the circle, but they are actually just moving in straight lines.
Criterias
The result has to be animated. The way you do the animation is irrelevant, it can generate a .gif, it can draw to a window, some device screen or whatever... |
Imagine some cube which we can cut into smaller cubes without remaining pieces.
Find to how many cubes a cube can be cut.
For example, a cube can be cut into 8, 27 (obviously 3rd powers of integers) and 20 (19 small cubes plus one eight times the size of the others, see image).
See here some help: http://mathworld.wolf... |
Austin: "Who sent you?"
Mustafa: "You have to kill me!"
Austin: "Who sent you?"
Mustafa: "Kiss my ass, Powers!"
Austin: "Who sent you?"
Mustafa: "Dr. Evil."
(...)
Mustafa: "I can't stand to be asked the same question three times. It just irritates me."
You are to simulate a short dialogue in the spirit of Austin Pow... |
The Golf (re)Sort
Everyone is sorting arrays these days, and so do we at our day jobs. But we like to go out golfing. When we do, we sure like to take our time. It is important to have a stress free experience.
Since we like golfing so much, we have decided to make a sorting algorithm that will let us stay away from t... |
Imagine the following diagrams as sets of vertical criss-crossing tubes.
1 2 1 2 1 2 3 4
\ / \ / \ / \ /
X | | |
/ \ / \ / \ / \
2 1 1 2 | X |
\ / \ /
X X
/ \ / \
3 1 4 2
In the leftmost diagram, the 1 and 2 slide down t... |
This question is similar to Write a word equation solver by David Frank but different in three important ways: (1) David asked for just the first solution found, and I am asking for all the solutions. (2) I am asking to output the time required to solve the puzzle. And (3), it is a completely different undertaking to... |
You're tasked with writing a program that syllabifies words in a string of text, by separating them with a hyphen. That would be a lot of work, so you want to skip some parts, mainly because you don't want to have a table of the pronunciations required for perfect algorithm. You also want to make it as short (and thus ... |
Write program which finds shortest expression for big integer.
Expression may consist of + - * / ^ ! ( ) operations.
! stands for factorial, ^ - exponentiation, / - rational division.
Number itself should be printed when no shorter expression found.
Examples:
7 - 7
120 - 5!
19683 - 3^9
191102976 - 4!^6
Code which is a... |
Create an algorithm that uses Cramer's Rule (with determinants of matrices) to solve for the solutions of a system of linear equations. The code should work for an "n" number of variables.
You may use whatever data structure you want to hold the matrix and return the result
Note: Also, consider that a possible system ... |
Imagine a continuous 2-dimensional path that can only turn left, right, or go straight, cannot intersect itself, and must fill a rectangular grid such as the grid of pixels in an image. We'll call this kind of path a snake.
This enlarged example shows a snake path in a 10×4 grid that starts out red and increases in hu... |
Caveman mad. Other caveman take stick but stick was for me. Caveman fight!
Description
Caveman need sharp stick to stab other caveman. Other caveman also try to stab with sharp stick. Caveman can sharpen stick, poke with stick, or block poky sticks.
If caveman poke other caveman with sharp stick, other caveman run aw... |
Your task
.. is to do what Brian Fantana apparently couldn't do, and solve the 2x2x2 Rubik's Cube.
The Layout
- - A B - - - -
- - C D - - - -
E F G H I J K L
M N O P Q R S T
- - U V - - - -
- - W X - - - -
And will be given to you via stdin or the command line (your choice - plea... |
Create a program which can rearrange pixels in image so it can't be recognized.
However your program should able to convert it back to original image.
You can write two functions - for encoding and decoding, however one function which applied repeatedly gives original image (example in math - f(x) = 1 - x) is a bonus.
... |
I have thought up esoteric language Jumper. Later you will see why.
It operates with random-access-memory with bytes as cells. RAM is zero indexed and initially filled with zeros.
When trying access cells with negative indexes error should be displayed and program terminated.
When trying read at larger index than last... |
Input 5 integers: Landmark X & Y, Starting Point X & Y, and View Distance Radius D
Output 1 double: % chance of coming within D of Landmark (X,Y) ("seeing") when walking straight in a random direction from Starting Point (X,Y).
Assume that "random direction" shall be a direction uniform on [0,2π], the land is flat, and... |
Your task today is to create a HTML page.
This page, when opened in a browser, behaves as if the browser has a problem (hanging, crashing, network error, virus, etc.)
You can use all the HTML(5), CSS(3) and JavaScript features you want.
You can't use Flash or other plugins.
You can't provoke a real problem in the brow... |
Write a program that takes a birth date (month and day-of-month) as input and outputs the corresponding sign, element and quality of the western zodiac. For the purposes of this challenge, these are defined exactly as in the table in the linked wikipedia page:
Sign Date Range Element Qu... |
Groups are a widely used structure in Mathematics, and have applications in Computer Science. This code challenge is about the fewest # of characters to create a group table for the additive group Zn.
How the table is constructed: For Zn, the elements are {0, 1, 2, ..., n-1}. The table will have n rows and n columns. F... |
Write a program (the body of the function is enough) that accepts a string of alphanumeric characters and validates it according to ISO 13616:2007. The algorithm for validation is (source: wikipedia article on IBAN http://en.wikipedia.org/wiki/International_Bank_Account_Number):
Validating the IBAN An IBAN is validate... |
The problem appeared on the 2013 SJCNY High School Programming Contest. It was the last question in the set of problems and no team produced a correct answer during the 2.5 hours they had to work on it. Shortest solution that can handle the full range of inputs with a reasonable run time (say under 2 minutes on a Penti... |
This question originates in this reddit thread by reddit user taho_teg but it is expanded to a more general 'puzzle'.
You have a centrifuge with 24 holes for the vials uniformly distributed in a circle around the central axis. If you now have a number of vials and you want to start the centrifuge, you need to make sure... |
From http://en.wikipedia.org/wiki/Triangle:
Write a program that takes three 2d coordinate tuples (Cartesian), and classifies what shape these three points describe.
In almost all cases these points will describe a triangle of varying types. In some degenerate cases, the points will either describe a singular point ... |
Mr. Moneybags is a very rich man. He has an assistant Mr. Perfect, who one day, got very mad, and shredded some of Mr. Moneybag’s $100 bills! Mr. Moneybags decided to punish Mr. Perfect.
Mr. Moneybags tells Mr. Perfect to stack his money into different piles.
He starts with N (1 <= N <= 1,000,000, N odd) empty stacks... |
Imagine a rectangular grid of | characters represents the taut strings on a loom (the warp) that other threads (the weft), which we will represent as -, can be woven around.
Here is the unwoven warp of a 7×4 loom:
|||||||
|||||||
|||||||
|||||||
There are a number of ways the weft can be woven into the warp, the simpl... |
Most Recent Leaderboard @ 2014-08-02 12:00
| Pos # | Author | Name | Language | Score | Win | Draw | Loss | Avg. Dec. Time |
+-------+----------------------+-------------------------+------------+-------+-------+-------+-------+----------------+
| 1st | Emil | Po... |
Take a string of binary characters separated by a space, and convert it to an ASCII string.
For example...
1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100
Would convert to...
Hello World
This is a code-golf challenge so the shortest solution wins.
|
At http://shakespeare.mit.edu/ you can find the full text of each of Shakespeare's plays on one page (e.g. Hamlet).
Write a script that takes in the url of a play from stdin, such as http://shakespeare.mit.edu/hamlet/full.html, and outputs the number of text characters each play character spoke to stdout, sorted accord... |
Read infinitely from stdin, and convert every number to the corresponding symbol on a US qwerty keyboard.
No string or character literals anywhere are permitted.
E.g. if the input is 117758326, the output is !!&&%*#@^.
Letters and symbols that aren't on numbers are left alone; 11g2;;'1g2311hh21930 turns into !!g@;;'!g... |
Write a program that outputs Lewis Carroll's poem The Mouse's Tale from Alice in Wonderland, drawn in its distinctive tail-like shape.
Plain text of the poem:
Fury said to a mouse, That he met in the house, 'Let us both go to law: I will prosecute you.— Come, I'll take no denial; We must have a trial: For really this... |
Problem:
In your choice of language, write the shortest function that returns the floor of the base-2 logarithm of an unsigned 64-bit integer, or –1 if passed a 0. (Note: This means the return type must be capable of expressing a negative value.)
Test cases:
Your function must work correctly for all inputs, but here ar... |
Problem:
In your choice of language, write the shortest function that returns the floor of the square root of an unsigned 64-bit integer.
Test cases:
Your function must work correctly for all inputs, but here are a few which help illustrate the idea:
INPUT ⟶ OUTPUT
0 ⟶ 0
... |
I just want to do some benchmarking of different programming languages. So here is a tip: You can use as many characters as you want. In the end there is only the time your program needed.
So, here is the Task:
Task
After searching for a good task that would require a lot of computation, I came up with the problem Is a... |
Starting with the string ABC, consider the result of repeatedly appending the last half of itself to itself (using the larger half if the length is odd).
We get the progression:
ABC
ABCBC
ABCBCCBC
ABCBCCBCCCBC
ABCBCCBCCCBCBCCCBC
etc...
Let S represent the resulting infinite string (or sequence) that results as this pr... |
Scenario
I am using pattern matching lockscreen and I sadly forgot my pattern. I would like to know how much time I will need to unlock it. Here are the specifications of Google's lock screen, that we will use for this challenge.
Every 5 wrong code, the user has to wait 30 seconds before any further entry.
A pattern m... |
A simple one today. Write the shortest program that draws a "sawtooth alphabet" given a positive integer for the height. You must write the name of your programming language when you come to the letter it starts with.
For example, if your language is Python and the input is 1 the output should be:
ABCDEFGHIJKLMNOPython... |
The ASCII characters from decimal code 33 to 126 are:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Notice that in most fonts, 25 of these characters have "holes" in them: (a genus greater than 0 you might say)
#$%&04689@ABDOPQRabdegopq
The other 68 "unholed" character... |
NOTE
This problem was taken from this reddit thread (spoiler alert!), and I have adjusted it to make it fit with this site's format. All credit goes to reddit user "Coder_d00d".
In this problem, we will simulate a forest.
For this simulated forest we will be dealing with 3 aspects.
Trees which can be a Sapling, Tree o... |
UPDATE: isSuicidal() was added to the plane class, this allows you to check if a plane is on an irreversible collision course with the walls!!
UPDATE: updateCoolDown() separated from simulateMove()
UPDATE: non-Java entry wrapper, written by Sparr, available for testing, see comments
UPDATE Zove Games Has written an aw... |
Pick your favorite 6 letter common English word that has no repeated letters, such as wombat.
Write a program in an N×N grid of characters without comments such that each row and column contains all the letters of your word in lowercase in any order. The program must output a definition of your word in 36 characters or... |
A date can be represented by an unsigned integer as such: YYYYMMDD. What you need to do, is write the shortest program or function that figures out the most recent date whose number was divisible by a given number n (including today's date) and then returns that date in the format showed above. If there has never been ... |
There was a challenge to convert a number to its numeral in English, but that was too straightforward. Given a number 0–100, your task is to output the corresponding numeral in French. The French numeral system has a more complex logic behind it compared to the English one:
Number Numeral
---------------
0 zéro... |
The number 113 is the first prime whose length 3 is prime, digital sum 5 = 1 + 1 + 3 is prime, and digital product 3 = 1 * 1 * 3 is prime.
A prime that has these 3 properties will be called supremely prime. The primes 11117 and 1111151 are other examples.
Goal
Write a program that can find the largest supremely prime n... |
Since I want to celebrate this definitely not nerdy event, your job is to calculate the piversary (pi-anniversary) of a given date.
Input
Your code has to have a possibilty to input a date in the format DD/MM/YYYY. You can expect, that the input is valid and the year is 0000<YYYY<9996.
Output
You have to release two da... |
Consider following recurrence relation:
p[n + 1] = (p[n]^2 + 1) / 2
If p[1], p[2], ..., p[k] are primes and p[k+1] is not, then k is length of sequence starting with p[1].
For example, if p[1] = 3, then p[2] = 5, p[3] = 13, p[4] = 85 = 5 * 17, thus length of sequence is 3.
Goal
Write program which find number producin... |
Welcome to the world of compiler golf. Your task is to write a program that generates another program to play a variant of FizzBuzz on spec.
Your compiler
Write a compiler that generates variants of the FizzBuzz program to spec. The spec of this variant is expressed in the form of an array of integer/string pairs.
The... |
Your life could depend on this. Don't blink. Don't even blink. Blink and you're dead. They are fast. Faster than you can believe. Don't turn your back, don't look away, and don't blink! Good luck.
Weeping Angels are an alien race that cannot move while being observed by another being (even another Angel). They feed ... |
Short version
RC4, designed in 1987, is one of the most famous stream ciphers. This question asks you to practically demonstrate its 2nd byte bias (for a theoretical proof, see section 3.2 of this paper).
Long version
OK, here I try to elaborate it for non-cryptographers. As you have noted, RC4 is a very popular cipher... |
Bracket numbers provide a simple way to express large integers using only left bracket, space, and right bracket ([ ]).
A bracket number is defined as a string of one or more pairs of matching brackets [...] called chunks, each separated from its neighbors by zero or more spaces.
The number of spaces between each chunk... |
You already know that the atoi function of stdlib.h converts a string to an integer.
atoi
(copied from here)
int atoi (const char * str);
Convert string to integer
Parses the C-string str interpreting its content as an integral number, which is returned as a value of type int.
Example
#include <stdio.h> /* pri... |
The challenge
In the least number of source code characters, in a language of your choosing, devise a function which raises base a to power b, modulo m, using purely integer arithmetic, where a, b, and m are all unsigned 64-bit values or larger. You may use signed arithmetic if your language does not have unsigned arit... |
Write the shortest program possible that traps the mouse cursor inside an upward pointing equilateral triangle with a side length of 274 pixels and a centroid at the exact middle of the screen.
(Triangle because of cheese wedges.)
While your program is running, the tip of the cursor should never be able to move outside... |
Echo the following in as few bytes as possible:
I'm Slim Shady. Yes, I'm the real Shady.
All you other Slim Shadys are just imitating.
So, won't the real Slim Shady please stand up?
Please stand up. Please stand up.
The following five words must appear EXACTLY ONCE in your code:
I'm
Slim
Shady
real
stand
|
Given a list of scores (non-negative integers) pre-sorted from greatest to least:
[ 10, 10, 6, 6, 4, 0]
Assign each score an integer rank, beginning with 1 and ascending, such that equal scores have the same rank (i.e. they are tied):
[ 1, 1, 3, 3, 5, 6 ]
In the case of ties, ranks are "skipped," e.g. since the f... |
Write a program that outputs a graph of the collatz sequence any way you want (ASCII Image Video etc). You have to implement it that way that you can adjust the size of the graph by either the maximum number of nodes or highest number in graph. A boring example here.
Try to present the graph in a creative / insightful ... |
Kakuro Combinations
Because I can't do mental arithmetic, I often struggle with the Kakuro Puzzle, which requires the victim to repeatedly work out which distinct numbers in the range 1 to 9 (inclusive) sum to another number in range 1 to 45 when you know how many numbers there are. For example, if you may want to know... |
Integer math can generate amazing patterns when laid out over a grid. Even the most basic functions can yield stunningly elaborate designs!
Your challenge
Write 3 Tweetable (meaning 140 characters or less) function bodies for the red, green, and blue values for a 1024x1024 image.
The input to the functions will be two ... |
Here is a fairly simple ASCII depiction of an open book:
|\
| \
| \
| \
| \__________
| || |
| || Lorem i |
\ || psum do |
\ || lor sit |
\ || amet, |
\ || consect |
\||_________|
Notice that the text portion is only on the right page and is 7 characters wide by 5 tall. Also notic... |
Winner: Ian D. Scott's answer, by one byte (48 bytes)! Superb!
Your program must accept input from a fraction that can be simplified, then simplify it.
Rules:
If the fraction is already in its most simplified form, you must inform the user
No built-in functions to do this
The user must type the number at some point, h... |
Task: Have your program randomly choose one of the following two quotes at runtime and print that one quote, exactly as shown.
1:
Under the spreading chestnut tree
I sold you and you sold me.
There lie they, and here lie we
Under the spreading chestnut tree.
2:
WAR IS PEACE.
FREEDOM IS SLAVERY.
IGNORANCE IS STRENGTH.
... |
Task
Write a program that takes in a compound made solely of elements with an atomic number less than or equal to 92 (Uranium), and outputs the molar mass of the compound in grams/mole.
Rules and Restrictions
You may not use a function that directly calculates molar masses for you.
Your program must be able to run on ... |
Challenge
For any given input Y of length >= 1024 bytes:
sort in ascending or descending order -- your choice
generate output Q, where Q = [sorted data] + [restore
information]
restore Y using Q as input
Sorting Example
input: [2, 5, 119, 0, 1, 223, 0, 118, ...]
output: [0, 0, 1, 2, 5, 118, 119, 223, ...] + [restore... |
Task
Your task is to write a function or a program in a language of your choice that analyzes a couple of statements and determines whether it can be concluded from those statements that pigs are able to fly.
Input
The input is a String that can be read from STDIN, taken as a function argument or even be stored in a fi... |
Idea
From a given word dictionary (containing only plain letters, i.e: no accent or other special chars), with a given fixed word length, find every same when a given number letters are missing.
For sample: un--ed could match: united, untied or unused
Using my dictionnary: /usr/share/dict/american-english, searching f... |
Here's a challenge inspired by Programming Praxis:
http://programmingpraxis.com/2009/02/19/flavius-josephus/
Write a function josephus(n,m) that returns a list of n people,
numbered from 0 to n-1, in the order in which they are executed, every
mth person in turn, with the sole survivor as the last person in the
list.
... |
Pick a quote or phrase that is exactly 5 words long, such as Programming puzzles and code golf!.
Write a program that, when appended to itself n times, outputs the first n + 1 words of your phrase in order.
For example, if your program code was MYPROG and your phrase was Programming puzzles and code golf!, running...
... |
Programmin' Pac-Man
Setting
You play as Pac-Man. You want to collect pellets, fruit, and power pellets before anybody else, all while avoiding ghosts.
Rules
Every valid Pac-Man will be in a single maze. The player with the highest cumulative score after 10 games will win.
A game is over when all Pac-Men are dead, al... |
Challenge
Find the smallest cover of bases (e.g., moduli) whose sets of quadratic residue can be tested via table-lookup to definitively determine whether or not a given non-negative integer n is a perfect square. The bases must all be less than or equal to the square root of the maximum value of n.
The answer with the... |
It has been proven that the following 13 square Wang tiles always tile the plane aperiodically. This means that when the squares are arranged in a grid with all neighboring sides the same color, a translation of the pattern will never match up with itself.
We'll represent each tile textually by a 3×3 grid filled with ... |
The aim is to parse a sentence and compress/encrypt it according to the rules below and then decrypt it using the key:
Remove all letters in a word before the first vowel is encountered. Example: pigeon becomes igeon.
All characters except alphabets should be kept in the sentence including numerals, punctuations, etc.... |
Golf a Venn Diagram generator
In order to properly celebrate John Venn's 180th birthday, today your task will be creating a program that outputs a Venn Diagram!
Input:
A positive integer N that will define the range of numbers appearing in the diagram (From zero to N) and three sets of positive integers.
Output:
A 3 s... |
Calculate the Riemann zeta function to the maximum primitive precision in your language (for C-family, that would be double or long double, var in JS, etc.) No need for BigDecimal or the like unless you need it to use a double-equivalent precision.
Efficiency (be sane) doesn't matter.
If it's not in a common language,... |
Challenge
Challenge is writing a program that takes a positive numbers a and a nonzero number b and outputs a^b (a raised to the power b). You can only use + - * / abs() as mathematical functions/operators. These can only be applied to scalar values, but not to whole lists or arrays.
Examples:
1.234 ^ 5.678 = 3.29980... |
Your task is to determine if a given string is of proper length and can be represented with Scrabble tiles and, if so, output the sum of each letter's score.
If you don't know how to play Scrabble:, you have 100 tiles with various letters A–Z printed on them, as well as two wildcards that can represent any letter. Each... |
The Challenge
The challenge is that I have a standard mechanical push button lock and you need to find out every possible code that could unlock it.
With a standard mechanical push button lock you have all single digit numerals and sometimes a few letters.
With this specific push button lock there are specific rules.
R... |
Create the shortest script that organizes all the logs by month and date.
Rules
Syntax
organize <folder to scan> <folder to place logs>
folder cannot be root
the two folder should be different and not contain one another
Behaviour
The script should scan all the *.log files in <folder to scan> and copy them to <fol... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.