Kolmogorov complexity, informally, is the amount of code it takes to produce a given string of text. When posting a challenge in this category, please make sure it adds something new to the challenges that already exist.

learn more… | top users | synonyms

28
votes
9answers
3k views

Kolmogorov-mania

The Kolmogorov complexity of a string s is defined as the length of the shortest program P that outputs s. If the length of P is shorter than the length of s, then s is said to be compressible, ...
2
votes
1answer
263 views

Determining part of speech of most words [closed]

Write a program to output the part of speech of any word inputted to it. I doubt that anyone could get a perfect algorithm, so I will give the code a batch of words in order to ascertain what ...
9
votes
10answers
609 views

Find all times that follow a pattern

Your job is write a program that prints all times (in the format HH:MM, 24 hours) that follow any of the following patterns: Hours equal to minutes, e.g. 22:22,01:01 Hours equal to reverse minutes, ...
8
votes
17answers
686 views

Calculate 6*9 in different bases

Output the following result (which is a result of calculating 6 * 9 in bases from 2 to 36). Make sure letters are uppercase, and the multiplication itself is outputed on every line. 6 * 9 = 110110 6 ...
7
votes
2answers
358 views

Type out Green Eggs and Ham in vim

The book Green Eggs and Ham by Dr. Seuss is famous for only having 50 different words in the entire story of the book. Your task is to create a sequence of keystrokes that will result in the entire ...
2
votes
6answers
453 views

How random is the Gettysburg Address

Your program must print out the Gettysburg Address. I copied this text from Wikipedia: Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in ...
10
votes
7answers
569 views

Build a “BizzFuzz” program

In traditional FizzBuzz, you are asked to print the numbers from 1 to 100, but replacing every multiple of 3 with "Fizz", every multiple of 5 with "Buzz", and every multiple of both 3 and 5 (i.e. 15) ...
6
votes
11answers
670 views

Generate a Universal-binary-function Lookup Table

This is tangentially related to my quest to invent an esoteric programming language. A table of the binary numbers 0 .. 15 can be used to implement a Universal Binary Function using indexing ...
3
votes
3answers
376 views

Print element from the periodic table [duplicate]

Your task is simple: given a number as an input, you have to print the English name of the chemical element with that atomic number, up to and including ununoctium. For example, for an input of 77, ...
6
votes
5answers
677 views

Normal distribution values

Write the shortest program possible which outputs a table of Normal distribution values phi(z) = Integral[t from -infty to z of e^(-t^2/2) /sqrt(2 pi) dt] for z from 0.00 to 3.99, giving values ...
15
votes
5answers
1k views

Who's that Pokémon?

Input: an integer N between 1 and 151 Output: the Nth Pokemon. Rules You may use one data file. You may not use any already made data decompression algorithms. This includes libraries and other ...
10
votes
19answers
2k views

Smile! Just smile

It's well known that Brainf*ck is very bad at Kolmogorov-complexity problems, for example, it requires around 100 characters just to print "Hello world". However, there might be texts where Brainf*ck ...
21
votes
37answers
3k views

Print this diamond

This question has been spreading like a virus in my office. There are quite a variety of approaches: Print the following: 1 121 12321 1234321 123454321 12345654321 ...
6
votes
12answers
824 views

Generate the names of the keys on a piano

On a standard 88 key piano, each key has a scientific name. The first three keys are A0, B♭0, and B0. The keys then proceed through C1, D♭1, D1, E♭1, E1, F1, G♭1, G1, A♭1, A1, B♭1, B1, and start over ...
123
votes
54answers
49k views

We're no strangers to code golf, you know the rules, and so do I

Write the shortest program that prints the entire lyrics of "Never Gonna Give You Up" by Rick Astley. Rules: Must output the lyrics exactly as they appear in the above pastebin. Here's the raw ...
33
votes
7answers
5k views

Write the shortest program that generates the most compiler warnings and errors

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 ...
7
votes
2answers
1k views

Shortest ELF for “Hello world\n”?

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 ...
14
votes
15answers
869 views

Calculate a user's privileges on CodeGolf.SE

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 ...
8
votes
5answers
1k views

Brainfuck Golfer

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 ...
8
votes
8answers
807 views

Encode an image inside of the source

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 ...
10
votes
6answers
697 views

Generate Random Boggle Board

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 ...
4
votes
5answers
406 views

An Old Irish Blessing, reasked (without using encodings)

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)) ...
7
votes
6answers
1k views

Generating PBM bitmap files from ASCII text

The PBM (Portable BitMap) format is a very simple ASCII black and white bitmap format. Here's an example for the letter 'J' (copy-pasted from the wikipedia link): P1 # This is an example bitmap of ...
5
votes
8answers
1k views

ASCII Tux (Linux Penguin)

I once hacked upstart on my Ubuntu box so that a colored, themeable ASCII Tux displayed on the screen with the boot messages scrolling beneath him. I'm curious to see what kind of ASCII art Linux ...
11
votes
15answers
3k views

Say “Hello” to the world in ASCII art

Challenge: Produce the following output using as few chars as possible: _ _ _ _ _ _ _ | | | | ___| | | ___ __ _____ _ __| | __| | | | |_| |/ _ \ | |/ ...
9
votes
19answers
2k views

12 Days of Christmas Lyrics

I thought this would be a fun challenge for everyone and I'm curious to see the solutions people come up with. Print the "12 Days Of Christmas" lyrics On the first day of Christmas, my true love ...
6
votes
19answers
774 views

Display Peter's keyboard pattern

Assume an simple keyboard with this layout: 1 2 3 4 5 6 7 8 9 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z . , ? ! Peter's keyboard pattern can be generated by starting at the top left of ...
1
vote
2answers
291 views

Most destructive “forgot-to-enter-insert-mode” sequence in Vim

Pretend you have an arbitrary text file (which you may choose). Give the sequence of keystrokes that is most destructive (*) if it was intended to be inserted to the text, but instead was entered in ...
6
votes
12answers
1k views

There Was an Old Lady

Your goal is to write a program that prints the following poem exactly as it appears here: There was an old lady who swallowed a fly. I don't know why she swallowed that fly, Perhaps she'll die. ...
7
votes
7answers
785 views

Flag Semaphore Encoder

Your goal is to write a flag semaphore encoder, which will convert a given sentence into the corresponding flag semaphore characters, according to the semaphore system described on Wikipedia. Assume ...
6
votes
4answers
912 views

Generating BF-code with single purpose

I'd like to see you create code (in any programming language) that output working BF (Brain***k) code. Your program have a single character input on stdin. The input should be one digit ("0", "1", ...
6
votes
4answers
454 views

Unicode character classification

Real-world programs often use libraries like ICU to support Unicode. The puzzle is to create the smallest possible function that can determine whether a given Unicode character is lowercase, ...
11
votes
3answers
320 views

Pinyin Combinations

Create a function that takes a string of a pinyin syllable as the argument, and returns true of the combination exists, false otherwise. Use "v" for "ü". Here is a full list of combinations. ...
8
votes
6answers
822 views

Shortest, lexicographically smallest generating string

A string x generates a string y if y is a substring of an infinite repeat of x. For example abc generates bcabcab. Write a program to find the shortest, lexicographically smallest string that will ...
6
votes
4answers
647 views

LED Numbers and Letters

The program must print the following block of text of LED numbers exactly. +-----------------------------------------------------------------+ | ...
21
votes
26answers
2k views

Print the alphabet four times

The program must print the alphabet four times: first in the normal alphabetical order, second in the order of a qwerty keyboard, third in the order of a dvorak keyboard, and lastly in reverse ...
26
votes
11answers
5k views

Generate the longest error message in C++

Write a short program, that would generate the longest possible error message, in a standard C++ compiler (gcc, cl.exe, icc, or clang). The score of each entry is the number of characters in the ...
8
votes
8answers
762 views

An Old Irish Blessing

I don't know who coined these words, and I'm not Irish, but I give you an Irish blessing: May the road rise up to meet you May the wind be always at your back May the sun shine warm upon your face ...
10
votes
8answers
2k views

Calculate digits of Pi

This is a somewhat different task. Calculate1024 hexadecimal digits of pi, beginning at the 1024th hexadecimal place. Formally: Your program should complete in less then 1 minute and produce the ...
4
votes
3answers
644 views

->The Tragedy of Macbeth<- [closed]

The Setup Here you can find the full text of The Tragedy of Macbeth. If you view the source, and save it as text, you will notice it comes out to 206,244 total characters (including the whitespace ...