instruction stringlengths 34 53.1k |
|---|
How much can you golf a program to print "An Old Irish Blessing" without using unprintable ASCII characters?
That restricts us to ASCII characters 32-126 (better still, 32,65-90,97-122 and 13(CR))
For reference that version of the proverb is 205 characters long (excl. newlines).
I'm curious if anything beats Huffman-en... |
The program plays white.
Example stdin:
8 ║♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
7 ║♟ ♟ ♟ ♟ … ♟ ♟ ♟
6 ║… … … … … … … …
5 ║… … … … ♟ … … …
4 ║… … … … … … … …
3 ║… … ♘ … … … … …
2 ║♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
1 ║♖ … ♗ ♕ ♔ ♗ ♘ ♖
——╚═══════════════
—— a b c d e f g h
Example stdout:
8 ║♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
7 ║♟ ♟ ♟ ♟ … ♟ ♟ ♟
6 ║… … … … … … … …
5 ║… … … … ♟ … …... |
The challenge is to manipulate strings using basic Vim-like commands
Input:
A string of text to be transformed. The input alphabet is [a-z].
A string of legal commands
Output:
The transformed string
There are a few ideas you should understand:
The cursor is represented as a location between 2 characters. | will be... |
Note: A couple of answers have arrived. Consider upvoting newer answers too.
Common Lisp from happy5214
C from luser droog
Java from NeatMonster
Javascript from crempp
C from Mike C
C++ from Darius Goad
Postscript from luser droog
C++ from
JoeFish
Javascript from entirelysubjective
C from RichTX
C++ from Dave C
Hask... |
Bytebeat is a style of music one can compose by writing a simple C program that's output is piped to aplay or /dev/dsp.
main(t){for(;;t++)putchar(((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7);}
There is a good deal of information on the bytebeat site, a javascript implementation, and more demos and example... |
Input: a word (2-100 characters)
Convert this word to a palindrome:
delete character - 13 points
add character - 12 points
increase character - 5 points ('d' > 'e')
decrease character - 4 points ('n' > 'm')
switch 2 characters - 7 points
What is the minimal points needed to make the word palindrome? (C++/C#)
Output: ... |
After having implemented QuickSort in BrainF***, I realized it probably wasn't that quick. Operations that are O(1) in normal languages (like array indexing) are significantly longer in BF. Most of the rules for what makes an efficient sort can be thrown out the window when you are coding in a Turing tarpit.
So here... |
What is the shortest C expression that is defined to evaluated to false the first time and true for every time after that:
Reference implementation:
bool b = false; // you get this for free.
(b ? true : b = true, false) // only this line is measured.
|
With the recent discussion about the use of compression tools in code golf, I thought it would be a nice challenge to write your own text compressor and decompressor.
Challenge:
Write two programs: one to compress ASCII text into a sequence of bytes, and another to decompress it. The programs need not be in the same l... |
Create a function that will output a set of distinct random numbers drawn from a range. The order of the elements in the set is unimportant (they can even be sorted), but it must be possible for the contents of the set to be different each time the function is called.
The function will receive 3 parameters in whatever ... |
A program that randomly generates a Sudoku game board with varying degrees of difficulty (however you decide to measure difficulty). Sudoku requires that there is only one solution, so your program should too. Input and output can be any form or method of your choosing.
Judging
Fastest code. Tested on a quad-code Wind... |
Hashiwokakero ("build bridges" in Japanese) is a puzzle where you are tasked
with connecting a group of islands with bridges. The rules are:
Bridges must run either vertically or horizontally between two islands.
Bridges may not cross each other.
A pair of islands may be connected by at most two parallel bridges.
Each... |
The Challenge
Build a N-Leveled Cantor Set.
The Cantor ternary set is created by repeatedly deleting the open
middle thirds of a set of line segments.
The program receives one parameter N (a integer number) and then prints (in console or similar way) a Cantor Set of N levels. The print can only contain undescore (... |
Pick a programming language.
In that language, write a function or program that takes as input a string of working code (in the same language).
It should return/output a minified version of the input code. The output should be functionally equivalent to the input.
Answers should contain both
The code that does the mi... |
Write a brainfuck program of no more than 256 characters that takes as many steps as possible, but does not loop infinitely. The program may not take any input.
More specifically:
Assume an infinite number of cells to the right.
A < when at the leftmost cell does nothing.
A - when cell value is zero sets cell to 255.... |
Thanks for all the entries, the deadline has now passed and the final scores are at the end of the question.
Congratulations to PhiNotPi on a fairly comprehensive victory.
This is a king-of-the-hill challenge, the aim of which is to create a program which wins more often than any of its opponents in a lowest unique b... |
Your boss asks you to write a "hello world" program. Since you get paid for lines of code, you want to make it as complex as possible. However if you just add nonsense lines, or obviously useless or obfuscating stuff, you will never get it through code review. Therefore the challenge is:
Write a "hello world" program w... |
Generate a 4x12 grid of letters / spaces:
Each die should appear precisely once, location randomly chosen. Locations should be approximate a uniform random permutation of the dice. Display a random (again, approximately uniform) face of each die. Left-justify the face in the 3-character window. For example,
A E A... |
Goal is to write the shortest possible C89 and C99-compliant single-module C program which will compute and print out a single-line string whose sort order will correspond with the date given by the predefined __DATE__ macro (in other words, later dates will yield later-sorting strings). The programmer is free to arbi... |
Where's Waldo is a searching game where you are presented an image of some scene, and your goal is to find a man named Waldo in the picture.
Here are a couple pictures showing what Waldo looks like. He always wears a red and white striped sweater and hat, blue pants, brown shoes and hair. He can be with or without acce... |
I was amazed to find that there is a way to reduce the times you loop on an array to find if a element is contained once.
One would think that the only way would be to loop through the whole array, and increasing a variable every time you find a match, and then check if it is equal to 1. However, lets look at this Java... |
Your program reads from standard input and prints to standard output.
The first thing you'll be receiving on stdinput will be the ruleset for your firewall (until you encounter a double newline).
We'll start explaining the ruleset itself with some sample input:
/* header abbreviations added for demonstration purposes ... |
The challenge is to generate an ASCII character count ruler in the following format:
+-------------------------------------------------------------------------+
|| | | | | | | | | | | | | | | |
|0 10 20 30 40 50 60 70 |
| ... |
Your challenge, should you choose to accept it, is to create a function or a program that outputs "yes" if a given number is divisible by 13 and outputs "no" if it isn't.
Rules:
- You're not allowed to use the number 13 anywhere.
- No cop-out synonyms for 13 either (like using 15 - 2).
- Bonus points will be awarded... |
The challenge:
Write a program or function in any language that takes as an argument (command-line or function) a single English word. It returns or outputs the pluralized form of the word.
(To clarify, the program or function will be executed many times on different words, but separately - the list of words won't be p... |
I'm solving problem: in file "a.in" given the number N - length of the number consists of ones. Need to gets square of it, and put this in file "a.out". This is my shortest solution(150 bytes):
char s[1<<27];j;main(i,n){for(fscanf(fopen("a.in","r"),"%d",&n),i=n*=2;--i;j+=i<n/2?i:n-i,s[i-1]=48+j%10,j/=10);fprintf(fopen(... |
Oplop is an algorithm to generate website specific passwords based on a master password and a keyword.
It is described here: http://code.google.com/p/oplop/wiki/HowItWorks
There's an online implementation here: https://oplop.appspot.com/
My attempt in Q is 204 200 167 165 139 characters ignoring whitespace:
{d:.Q.A,.Q.... |
'exaggerated' is an example of a word which can be typed on the left hand, on a normal qwerty keyboard map. 'monopoly' is an example for the right hand.
Searching the unix words file for words that can be typed on one hand. Output should be two lines: space separated list of such words for the left hand, followed ... |
Write shortest code that detect how many swaps (minimum) are needed to sort (in increasing order) any array of unique positive integers. It should be fast enough to detect number of swaps in array of 1'000'000 integers in decreasing order in 1-2 minutes.
Refs
Bubble Sort on Wiki
Example implementations of bubble sort
... |
Description
There will be a grid of 9x9, where there will be placed 12 rocks.
You will start at a starting-rock and walking with a starting-direction (north, south, west or east), whenever you see a rock, you have two options:
Climb over the rock and continue in the same direction
Change direction to your *left
*NOT ... |
Write a function that takes as input a set of integers (can be a list, array or any other container with distinct numbers), and outputs the list of all its permutations.
Python (95 chars):
p=lambda s:s and sum(map(lambda e:map(lambda p:[e]+p,p(filter(lambda x:x!=e,s))),s),[]) or [[]]
It'd be nice to be beaten in the sa... |
A rotation of a string is made by splitting a string into two pieces and reversing their order, for example "world!Hello, " is a rotation of "Hello, world!". It is possible to create programs that can be rotated to form a different, but still valid program. Consider this example in python:
print ")import sys; sys.stdou... |
The basic parts of SMTP can be implemented in surprising little code. I was able to build an example SMTP client that works with Gmail and Amazon SES in about 320 characters using PHP.
Your task is to implement an SMTP client that can send UTF-8 email from at least 2 major providers listed here:
Gmail
Yahoo!
Live/Hotm... |
With a twist; your algorithm has to be less complex than O(X2) where X is the Nth prime. Your solution post should include the character count and the theoretical complexity in terms of X (or N, which ~= X/ln(X) and so will usually be more efficient)
Here's a hint solution in C# (O(Xln(sqrt(X))), 137 chars):
public L... |
This is a code golf problem: Say you have two files, one file s and one file h. The problem is that for each line l of s you should produce a list that contains all lines of h that contain l. By "contain" I mean a substring, so, for example the line "foobar12baz" contains either foo, bar, foobar, 12, 1 or baz, etc...
... |
What general tips do you have for golfing in Perl? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Perl (e.g. "remove comments" is not an answer). Please post one tip per answer.
|
The Challenge
Write the shortest possible program that demonstrates a programming language's entire syntax: statements, expressions, operators, reserved words, etc.
Take the language's grammar (usually in EBNF) and create a program that uses all of it.
The program doesn't have to do anything particularly useful, but if... |
Write a program that either accepts input via stdin or from the command line. It will then unscramble the words, printing out the unscrambled version of each word.You get a text file containing every word (most of them) in the English dictionary to use. (Here is the file: Word List, and you can either use it from the w... |
This challenge consist in adding commas to numbers every 3 spaces like:
123456789 => 123,456,789
Specifications:
The possible inputs will be 1,000 <= input <= 100,000,000
You can ONLY use Mathematical Operators
(*) You can NOT do string, array, index or character manipulation
You can NOT use any kind of built-in func... |
The idea is this: Write a function to print the length of time from now/today's date (at the time the function is called) until a date supplied as an argument.
Assumptions:
Input date will always be tomorrow or later, in the future.
Input date will never be more than 10 years in the future.
Rules:
Output must be in ... |
Explanation
The edit distance between two strings is a function of the minimum possible number of insertions, deletions, or substitutions to convert one word into another word.
Insertions and deletions cost 1, and substitutions cost 2.
For example, the distance between AB and A is 1, because deletions cost 1 and the on... |
Similar to this, this, and this question...
What general tips do you have for golfing in VBA? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to VBA (e.g. "remove comments" is not an answer). Please post one tip per answer.
While I have worked with other l... |
Background
A one-time pad is a form of encryption that has been proven impossible to crack if used properly.
Encryption is performed by taking a plaintext (comprised of only letters A-Z) and generating a random string on the same length (also only letters). This string acts as the key. Each character in the plaintext i... |
The golf challenge is to encode and compress the following image inside a source file.
To do this you need to write 3 functions: red, green, and blue which accept x/y coordinates of the image and return the corresponding R/G/B pixel value between 0-255.
Here is the C/C++ test code:
#include <stdio.h>
#include "your_fi... |
Out of all of the ASCII characters, it is easy to tell that some of them form groups that are rotations of the same basic character. For example, V > ^ <. This allows the possibility to construct ASCII art that can be rotated by multiples of 90 degrees and still remain ASCII art.
The Challenge
Your goal is to golf a pr... |
well, I'm newly introduced to befunge.
it seems to be an amazing language but a bit hard to start with! anyway after about 2 hours of hard work I've created a code which could read a line from stdin and write same line into stdout(I'm using line -1 as buffer in this code):
0> :~:a-#v_$$v vg-10:-1< >$>:#,_@
^+1p-10\< ... |
Background
Fractran is an esoteric Turing-complete programming language invented by John Conway. A Fractran program consists of an ordered list of fractions. The program starts by taking a single integer as input. Each iteration of the program, it searches the list for the first fraction such that multiplying the numbe... |
Your goal is to write a program that will solve any Mastermind puzzle in 6 or less moves.
Background
Mastermind is a board game. The goal of the game is to exactly guess the combination (colours and order) of 4 coloured pegs hidden by the other player. When a guess is made, the other player responds with between 0 and ... |
What, this post doesn't exist yet?
Of course, GolfScript is made for golfing, so you might think that no specific tips are really needed. But to make full use of GolfScript's features, you need to learn some non-obvious tricks. This post is for collecting such helpful tips and tricks.
To start with, here are the offi... |
The aim of this challenge is to create the shortest code (in characters) that successfully do the following:
Specifications:
Must create a 5x5x5 labyrinth with exactly 1 possible solution (no more, no less)
The labyrinth must be created randomly It must be able to generate every existing solution if left running for y... |
Your task is to write a function which accepts a number N and creates a string of Reverse Polish Notation which will generate that number. Valid operations are:
1-9: Push number onto stack. Only 1-9 are allowed.
+-*/%: take two numbers from top of stack and apply arithmetic operation,
pushing the result.
d: duplica... |
Following my entry to the Obfuscated Hello World I thought it might be fun to share the underlying code. But why just show the code, lets make it a golf too!
Challenge
Write a script that scrolls a string across the terminal, from right to left, settling on the left side.
Input
Takes a string as an argument.
Result
Pri... |
The aim of this post is to gather all the golfing tips that can be easily applied to <all languages> rather than a specific one.
Only post answers that its logic can be applied to the majority of the languages
Please, one tip per answer
|
I was wondering how one might go and produce a program that takes input from some kind of random source and uses it to produce constant output. An obvious way is, for example, to take an integer x and output x/x for 1, but that isn't too clever, is it? Therefore, the task is to write a program that outputs the same thi... |
A Web Crawler is a program that starts with a small list of websites and gets the source code for all of them. It then finds all the links in those source codes, gets the website it links to then puts them in a list. It then starts again but with the new list of websites.The main reason for a Web Crawler is to find all... |
In the spirit of the Underhanded C Contest, I'm starting an Underhanded Code Contest. The objective of this contest is to straightforwardly implement some code, while subtly hiding a nefarious bug inside it.
The contest
You are a secret Russian mole working in the IT department of an American spy agency. Your America... |
Implement any model of computation as powerful as a Turing machine using any existing language's type system.
Your solution should handle the computation using the language's type system, not the language's regular Turing complete features, nor a macro system. It is however acceptable to use the language's regular f... |
I just submitted an answer to this question, and then looked about at some news stories about the MegaMillions lottery craze going on right now in the US. This news article stated that an individual purchased $20,000 worth of tickets at one time (that's 20,000 sets of numbers to confirm!) to try and test their luck.
Th... |
well, it's something similar to this question but with a little differences. you have to write a program to ask for width of progress bar and how much work is done. and then draw a progress bar with following features:
width indicates how many characters you have to use to draw progress bar
progress is given via a flo... |
An IDE developer has hired you to write a program that generates (by printing to stdout) n lines of randomly generated code. They will use your program to create sample code for use in marketing their newest compiler.
Rules:
Your randomly generated output code:
must not be the same each execution (for the same n param... |
This challenge is to calculate how to measure 4 liters of water with just two unevenly sized buckets, one of 3 liters and another of 5 liters, in minimum number of steps. To extend and generalize this, write a program to evaluate the minimum number of steps to measure “X” liters of water, with “Y” buckets each having a... |
Background
In Western music, every single music note has an assigned name. Within each octave, there are twelve unique notes in the following order: "C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B C", where the final C is one octave above the first.
To tell the difference between notes of different octaves, a number (for... |
One of easiest code written by a programming language is a program printing sequence of characters (ex. "Hello, world!"). However, some esoteric programming languages like Brainfuck, even this simplest code is quite annoying to write.
Your task is to write a program (don't have to written in brainfuck), which prints a ... |
Background
There are two people, Bill and John. One of them is a knight, which always tells the truth, and the other is a knave, which always tells a lie. You don't know who is the knight and who is the knave. Each person then says several statements about who is the knave and who is the knight. Using this information,... |
The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism!
The Challenge
Your challenge is to implement a program that will input a list of numbers and output the rule used to generate each successive number in the series, in as many programm... |
Background
ASCII art is the practice of creating images by using ASCII text to form shapes.
Aliasing is the effect created by the large "pixels" of ASCII art, which are the size of characters. The image becomes blocky and hard to see. Anti-aliasing removes this effect by creating a gradient and by softening the hard ed... |
Write a program to play the game of Connect 4. You are given the state of the board as input and you must decide which column to place your piece in to either get 4 in a row (horizontally, vertically, or diagonally) or block your opponent from doing the same.
The board is a 6x7 array, where each cell may be empty (' '... |
The Challenge
Your goal is to write the shortest program possible that will take a list of events (such as upvote, downvote, etc) and return the user's reputation and the privileges that he has earned.
What sort of events?
Here is a chart of the events, listed in order of reputation earned:
-15 answer unaccepted
-10 an... |
Similar to other quine puzzles (more specifically, this one), write a program that produces the source for itself.
Here's the new twist: The code produced should NOT be identical to the source. Rather, it should output a different program that will create the first.
The challenge linked to above achieved that by jump... |
Background
In a galaxy (and possibly a universe) far, far away... there was a spaceship and a bunch of planets. A malfunction on board caused the spaceship to run out of fuel. It is now moving at a dangerously slow speed near a cluster of planets, from which it must escape! What will be the crew's fate?
The Challenge
Y... |
This challenge is to score a Cribbage hand. If you don't play Cribbage, you've got some learning to do. We play with a standard poker deck, and a hand consists of four cards plus the "up card". There are two types of hand: normal, and a 'crib hand'.
Cards come in the format vs where v is one of: A23456789TJQK (T for... |
This question is slightly harder than the ASCII art version. There is no art, and now you get to do some floating point arithmetic!
The Challenge
The U.S.S. StackExchange was traveling through the gravity field of planet cg-00DLEF when an astronomical explosion occurred on board. As the head programming officer of the ... |
In the spirit of a question on math.se: given an integer n, return the integer in position n of the sequence [1, 0, -1, 0, 1, 0, -1, 0, ...]. Assume n >= 0.
Rules:
You may only use the operations -x, x+y, x-y, x*y, x/y, and xy, whatever their representations are in the language you choose.
Your function must be called... |
Given strings X and Y, determine whether X is a subsequence of Y. The empty string is regarded as a subsequence of every string. (E.g., '' and 'anna' are subsequences of 'banana'.)
Input
X, a possibly-empty case-sensitive alphanumeric string
Y, a possibly-empty case-sensitive alphanumeric string
Output
True or False... |
I recently saw some questions on SO that asked if you could make a Hello World program without using any semi colons using C#. The challenge is to do this again, but in the shortest amount of code possible!
|
The Challenge
Implement tetration (aka Power Tower or Hyperexponentiation) with the least amount of characters.
The Conditions
Don't use the 'power' operator or its equivalents (such as pow(x,y), x^y, x**y, etc.)
Input given as: x y (separated by a space)
x is exponentiated by itself y times.
Your method must be able ... |
Introduction
A common puzzle involves a triangular board with 15 holes for tees/pegs as shown in the image below:
Starting with all the pegs in the board except for a hole at the top, the point of the puzzle is to jump pegs over one another like checkers in such a way to leave exactly one peg left. The only valid mov... |
Let's call a non-empty list of strings a mesa if the following conditions hold:
Each listed string is non-empty and uses only characters that occur in the first string.
Each successive string is exactly one character longer than the preceding string.
No string in the list is a subsequence of any other string in the l... |
Introduction
Given a set of percentages of choices in a poll, calculate the minimum number of voters there must be in the poll to generate those statistics.
Example: What is your favorite pet?
Dog: 44.4%
Cat: 44.4%
Mouse: 11.1%
Output: 9 (minimum possible # of voters)
Specs
Here are the requirements for your program/... |
Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'.
Your task is to write a set of (up to 5) programs in any language (which has a text-based syntax*) to output all 26 letters of the alphabet in order. However for each vowel aeiou, at least one of the progr... |
Summary
The aim of this challenge is to write a tenacious program. This is a stateful program designed to output a given string, but for which, if the program is aborted at any point during the writing of the string, rerunning the program will continue where it left off, writing only the characters that have not been w... |
Write a program that displays a moving ASCII ball * inside a rectangle (20 by 10 chars including border). The ball must not cross the rectangle, e.g. bump off when it hits the wall. The scene must be cleared and redrawn every 0.1 seconds and the ball must move 1 char in x and y direction every frame. The shortest progr... |
I was interested in seeing the answers to this (now defunct) question, but it has never been corrected/improved.
Given a set of 6-sided Boggle dice (configuration stolen from this question), determine in two minutes of processing time which board configuration will allow for the highest possible score. (i.e. which dice... |
A polynomial over a variable x is a function of the form
p(x) = anxn + an-1xn-1 + ... + a1x + a0
where a0 ... an are the coefficients. In the simplest
case, the coefficients are integers, e.g.
p1(x) = 3x2 + 4x + 1
By allowing the coefficients to be polynomials over another variable, we can define
polynomials over ... |
Ask questions if you need to, I'll elaborate on anything that needs clarified.
My challenge is to unsolve a sudoku to a minimal state. Basically take a supplied, solved, sudoku board and unsolve it as far as possible while keeping the solution unique.
I'll leave input up to you, I don't like forcing anything which woul... |
Is it possible to write (pack) a shorter than 145 bytes version of a program with "Hello world" (plus new line) output if the length of the program is measured as a number of bytes in program's ELF (x86) representation? Reduction technique in mind is described here:
http://timelessname.com/elfbin/
http://www.muppetlab... |
I have been participating in a number of PHP code golf challenges recently and some of the techniques that are used to read data from a file such as fopen() and fread() or file_get_contents() really give my code a beating on the char count. Especially the methods provided for reading in command line input.
My question ... |
There is an array of integer values to be sorted.During the sorting process, the places of two numbers can be interchanged. Each interchange has a cost, which is the sum of the two numbers involved.
You must write a program that determines the minimal cost to sort the sequence of numbers.
|
Puzzle:
Write a short, three-line program which:
has 5/7/5 syllables per line when read aloud
outputs a haiku when run.
An example of a program having the correct structure, but non-haiku output, is (Python):
>>> for x in range(3):
... print "EXTERMINATE HUMANS"
... # I am a Dalek.
...
EXTERMINATE HUMANS
EXTERMI... |
The Rules
It's time to build a typing speed test in your language of choice!
1. You provide a file with a dictionary of choice (every 'word' in it must be newline delimited). Pipe it in via stdin or provide it's name as a command line argument.
a
able
about
above
absence
...
2. Pick 10 random words from the file (no ... |
For reference as to what the tower of Hanoi is, either Google it or look on the Wikipedia page.
Your code should be able to do 2 things, and they are the following:
Accept user input that specifies the number of discs at the starting point of the Hanoi tower
Create output in a fashion of your choosing (so long as it i... |
The challenge:
Write a very short program that, when compiled, creates the most amount of compiler warnings and errors. It can be written in any programming language.
Scoring:
The score is determined by this equation: errors_and_warnings_length/code_length. Highest score wins.
Example:
The C# program class is 5 chars l... |
Out of all of mathematics, there will always be a few theorems that go beyond all common sense. One of these is the fact that there are different sizes of infinity. Another interesting fact is the idea that many infinities which seem to be of different size are actually of the same size. There are just as many even num... |
The obvious solution would be to just print them as a string, but is it possible to write a shorter code?
Requirements:
No input should be processed, and the output should be in the form of 2 3 5 7 11 13 ... etc.
No reserved words in the language are used at all
The language should at least allow structured programmin... |
Terence Tao recently proved a weak form of Goldbach's conjecture! Let's exploit it!
Given an odd integer n > 1, write n as a sum of up to 5 primes. Take the input however you like, and give output however you like. For example,
def g(o):
for l in prime_range(o+1):
if l == o:
return l,
... |
Write a program in the language of your choosing which when read are the lyrics to a song. It must be a valid program which can be compiled and run without errors. While you could technically print to the screen all the lyrics, you're encouraged to do it with style and avoiding string literals whenever possible.
Give... |
When I saw the title of this closed question, I thought it looked like an interesting code golf challenge. So let me present it as such:
Challenge:
Write a program, expression or subroutine which, given an arithmetical expression in infix notation, like 1 + 2, outputs the same expression in postfix notation, i.e. 1 2 ... |
This question may not be that creative, but I believe that it is different enough to pose a new challenge.
The Challenge
Your challenge is to write the shortest program possible that can take any valid expression in Reverse Polish Notation and convert it to infix notation that obeys the order of operations and has the ... |
The goal of this challenge is to write a program where the length of the following three are exactly the same:
the length of the source code
the length of the output it prints to the standard output
the length of the compiler warnings it generates with the (unmodded) compiler of your choice
The winner is the shortest... |
I have a challenge for you:
Print "Hello World" using any language.
Each character must be printed from its own, unique thread
That's it. Obviously, as there's no guarantee that the threads will operate in the order you start them, you have to make your program thread safe to ensure the output is printed in the right... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.